2013-09-13 16:48:47 +00:00
|
|
|
<?php
|
|
|
|
$title = "Texture Crop";
|
|
|
|
require('../head.php');
|
|
|
|
?>
|
2013-09-11 02:55:53 +00:00
|
|
|
|
|
|
|
<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, 200, pic.height);
|
|
|
|
|
|
|
|
game.add.tween(r).to( { x: pic.width - 200 }, 3000, Phaser.Easing.Bounce.Out, true, 0, 1000, true);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
function update() {
|
|
|
|
|
|
|
|
// Apply the new crop Rectangle to the sprite
|
|
|
|
pic.crop = r;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
})();
|
|
|
|
</script>
|
|
|
|
|
2013-09-13 16:48:47 +00:00
|
|
|
<?php
|
|
|
|
require('../foot.php');
|
|
|
|
?>
|