Skip to main content

[CoronaSDK] TweenTrain, the transition helper class


上週新上架了一個 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

Popular posts from this blog

[書評] 拖延心理學:為什麼我老是愛拖延?是與生俱來的壞習慣,還是身不由己?

作者: Jane B. Burka & Lenora M . Yuen 推薦指數 ★★★★★ 有時候,只是想了解事情發生原因而不是尋求解法 在這邊不是要講這本書的內容,而是想聊它對我的影響。