admin管理员组文章数量:1301541
Here's a simple tween in Tween.js. A simple loop happens after an interval.
cjs.Tween.get(mySymbol).wait(50).to({x:10}).to({x:0});
Is there a way to make it repeat say 5 times after the interval, without repeating the interval?
By adding loop:true
I can make it loop but the loop would include the wait().
cjs.Tween.get(mySymbol, {loop:true}).wait(50).to({x:10}).to({x:0});
Is there any way to add tweens to the timeline sequentially in Tween.js?
Here's a simple tween in Tween.js. A simple loop happens after an interval.
cjs.Tween.get(mySymbol).wait(50).to({x:10}).to({x:0});
Is there a way to make it repeat say 5 times after the interval, without repeating the interval?
By adding loop:true
I can make it loop but the loop would include the wait().
cjs.Tween.get(mySymbol, {loop:true}).wait(50).to({x:10}).to({x:0});
Is there any way to add tweens to the timeline sequentially in Tween.js?
Share Improve this question asked May 20, 2013 at 13:22 josefjosef 1,02513 silver badges32 bronze badges2 Answers
Reset to default 7Answer courtesy of Grant Skinner:
cjs.Tween.get(ball).wait(1000).play(
cjs.Tween.get(ball,{paused:true, loop:true})
.to({x:450},1000)
.to({x:50},1000)
);
To loop 5 times you can use a callback:
var tl = new createjs.Timeline();
tl.addTween(createjs.Tween.get(mySymbol).wait(500).call(loop, [mySymbol, 0], this));
var i;
var loopMax = 5;
function loop(target, initI){
if (initI != null) {
i = initI;
} else {
i++
}
if (i < loopMax) createjs.Tween.get(target).to({x:450},1000).to({x:50},1000).call(loop, [target]);
}
本文标签: javascriptLoop part of a tween with tweenjsStack Overflow
版权声明:本文标题:javascript - Loop part of a tween with tween.js - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741673268a2391729.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论