mirror of
https://github.com/photonstorm/phaser
synced 2024-11-27 15:12:18 +00:00
46 lines
No EOL
861 B
PHP
46 lines
No EOL
861 B
PHP
<!DOCTYPE HTML>
|
|
<html>
|
|
<head>
|
|
<title>phaser.js - a new beginning</title>
|
|
<?php
|
|
require('js.php');
|
|
?>
|
|
</head>
|
|
<body>
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function () {
|
|
|
|
var game = new Phaser.Game(800, 600, Phaser.AUTO, '', { preload: preload, create: create, update: update });
|
|
|
|
function preload() {
|
|
game.load.image('trsi', 'assets/pics/trsipic1_lazur.jpg');
|
|
}
|
|
|
|
var r;
|
|
var pic;
|
|
|
|
function create() {
|
|
|
|
pic = game.add.sprite(game.world.centerX, 550, 'trsi');
|
|
pic.anchor.setTo(0.5, 1);
|
|
|
|
r = new Phaser.Rectangle(0, 0, pic.width, 0);
|
|
|
|
game.add.tween(r).to( { height: pic.height }, 3000, Phaser.Easing.Bounce.Out, true, 0, 1000, true);
|
|
|
|
}
|
|
|
|
function update() {
|
|
|
|
// Apply the new crop Rectangle to the sprite
|
|
pic.crop = r;
|
|
|
|
}
|
|
|
|
})();
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|