上週新上架了一個 CoronaSDK transition API helper plugin,主要的目的是為了可以用 string 設定控制所有的動作巨集,方便動作資料預設。
一般來說,如果要使用 transition 達成物件跳躍後往右邊移動,一般語法如下:
transition.to( target, {y = target.y-100, transition=easing.outSine, time = 400} )
transition.to( target, {y = target.y+100, transition=easing.inSine, time = 300, delay=400} )
transition.to( target, {x = target.x+300, transition=easing.inSine, time = 600, delay=700} )
如果改用 tweentrain 就可以寫成:
tweentrain.set( target,
{ "transition:to", {y="-100", transition="outSine", time=400} },
{ "transition:to", {y="100", transition="inSine", time=300} },
{ "transition:to", {x="300", transition="inSine", time=600} }
)
tweentrain.start( target )
是不是就簡單很多了呢?
View the Document on Github
Get it from Corona Plugin Store now. =D
Comments
Post a Comment