在TweenMax中使用变量Tweening到相对位置
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了在TweenMax中使用变量Tweening到相对位置相关的知识,希望对你有一定的参考价值。
If you want to tween an object relatively, but the new value changes and needs to be a variable, just cast it as a string.
// Your everyday absolute tween that moves movieclip_mc // to 100 on the x axis, taking one second to do so TweenMax.to(movieclip_mc, 1, {x:100}); // A relative tween that moves movieclip_mc to a // position on the x axis 100 units/pixels greater // than movieclip_mc's current position TweenMax.to(movieclip_mc, 1, {x:"100"}); // An absolute tween like the first, but passing in // the new value with a variable TweenMax.to(movieclip_mc, 1, {x:newX}); // A tween that casts the variable as a string, // thus making it a relative tween TweenMax.to(movieclip_mc, 1, {x:String(newX)});
以上是关于在TweenMax中使用变量Tweening到相对位置的主要内容,如果未能解决你的问题,请参考以下文章