1
作爲EaselJS的新手,我使用了與源zip文件一起打包的「Simple Sprite Sheet」示例中的代碼。我試圖讓一個精靈表加載和播放,但只有第一幀出現。使用EaselJS加載精靈表
function init() {
var stage = new Stage(document.getElementById("canvas"));
var ss = new SpriteSheet({
"frames": {
"width": 159,
"numFrames": 71,
"regX": 0,
"regY": 0,
"height": 85
},
"animations":{
"instance1": [0, 0],
"images": ["./assets/spritesheet.png"]
});
var animate = new BitmapAnimation(ss);
animate.x = 0;
animate.y = 0;
ss.getAnimation("instance1").frequency = 2;
ss.getAnimation("instance1").next = "instance1";
animate.gotoAndPlay("instance1");
stage.addChild(animate);
Ticker.setFPS(60);
Ticker.addListener(stage);
}
我不認爲我需要一個代碼的功能,因爲我沒有註冊任何事件,我只是從INSTANCE1打,框架和帆布都是大小相等的,如果我播放動畫通過用animate.play("instance1");
代替animate.gotoAndPlay("instance1");
,但循環。有什麼建議麼?提前致謝。
謝謝Lanny,我相信你回答了我在Google的EaselJS小組提出的問題。仍在試驗中,我在使用多個畫布和不同的FPS時遇到了另一個障礙,如果你能看一看,我會非常感激http://stackoverflow.com/questions/10861247/easeljs-having-two-canvases-with-different -fps – dcd0181