登录内测(欢迎小伙伴们通过右侧登录按钮进行注册和登录)
dynamic crop (这是一个动态裁剪的例子)
PHASER
		
var game = new Phaser.Game(800, 600, Phaser.CANVAS, 'phaser-example', { preload: preload, create: create, update: update, render: render });

function preload() {
    game.load.image('trsi', 'assets/pics/trsipic1_lazur.jpg');
}

var pic;
var cropRect;
var w;
var h;

function create() {
    pic = game.add.sprite(0, 0, 'trsi');
    // 获得宽高
    w = pic.width;
    h = pic.height;
	// 裁剪矩形
    cropRect = new Phaser.Rectangle(0, 0, 128, 128);
    // 应用裁剪
    pic.crop(cropRect);
}

function update() {
    if (game.input.x < w && game.input.y < h) {
        pic.x = game.input.x;
        pic.y = game.input.y;
        cropRect.x = game.input.x;
        cropRect.y = game.input.y;
        // 更新裁剪
        pic.updateCrop();
    }
}

function render() {
    game.debug.text('x: ' + game.input.x + ' y: ' + game.input.y, 32, 32);
}
		

这个例子好好体会,为什么要在update中设置pic的位置