1
我想設置一個持續時間在我的動畫I.E.我想讓它移動1.5秒,但是,它仍然會立即進行轉換。我試圖添加時間到我的精靈動畫與Kineticjs
的Javascript
var shift1 = new Image();
shift1.onload = function(){
var firstShift = new Kinetic.Sprite({
x: 600,
y: 221,
scaleX: 0.45,
scaleY: 0.47,
image: shift1,
animation: 'pos1',
animations: {
pos1: [1, 1, 89, 220],
pos2: [105, 1, 100, 220]
},
frameRate: 5,
frameIndex: 0
});
image_layer.add(firstShift);
firstShift.start();
document.getElementById('play').addEventListener('click', function(){
firstShift.animation('pos2').setY(198).frameRate(1).start();
});
};
shift1.src = 'http://www.html5canvastutorials.com/demos/assets/yoda.jpg';
HTML
<div id="controls">
<input type="button" id="play" value="Play">
<input type="button" id="pause" value="Pause">
<input type="button" id="reset" value="Stop">
<input type="button" id="reverse" value="< < <">
<input type="button" id="seek" value="> > >">
</div>