pixijs+alloytouch滚动地图的写法



<script src="js/pixi.min.js" type="text/javascript">
</script>
<script src="js/alloytouch.js" type="text/javascript">
</script>
<script type="text/javascript">
const app = new PIXI.Application({ width: 750, height: 1206 });
document.body.appendChild(app.view);

const container = new PIXI.Container();

app.stage.addChild(container);

// Create a new texture
const texture = PIXI.Texture.from('https://pixijs.io/examples/examples/assets/bunny.png');

// Create a 5x5 grid of bunnies
for (let i = 0; i < 25; i++) {
const bunny = new PIXI.Sprite(texture);
bunny.anchor.set(0.5);
bunny.x = i * 40;
bunny.y =i* 240;
container.addChild(bunny);
}

var alloyTouch=new AlloyTouch({
touch:'body',
vertical:true,
maxSpeed:0.8,
max:0,
min:-3000,
bindSelf:false,
initialValue:0,
change:function(value){
console.log(value);
container.y=value

}
})
</script>