當Tweener還未出現的時候

當我還小的時間,曾看過電腦雜誌的Flash教學,見過有人教用以下的formula做到easing的效果:

在EnterFrame的event中﹕

myMc.x += (targetX – myMc.x) / FACTOR;
//targetX 是目標的X座標
//FACTOR是一個constant,數字愈大,easing的時間愈長

可是這個方法有很多缺點:

  • 只做到減速效果
  • tweening時間不能控制
  • 令program更複雜

但當有人寫了Tweener這些tweening engine後,問題已不再存在了!

[觀看整編文章]