Created
April 19, 2013 08:07
-
-
Save edom18/5418854 to your computer and use it in GitHub Desktop.
ちょっとしたeasingの解説 ref: http://qiita.com/items/a3c2c3b229b9b8089515
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function easing(time, begin, change, de) { | |
var s = 2.5; | |
if (t / d >= 1) { | |
return b + c; | |
} | |
return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b; | |
} | |
//分かりやすく分解 | |
t = t / d - 1; | |
c * (t * t * (3.5 * t + 2.5) + 1) + b; | |
//+ bはスタートからの値を求めるため、実際にイージングを行なっているのはその前の式。 | |
//かつ、cが最終変化量でイージングの性質として0 -> 1に変化する必要があるから、 | |
//実質イージングを成しているのはcとbを抜いた部分。 | |
(t * t * (3.5 * t + 2.5) + 1) | |
//さらに、最後に+1されているため、その前の部分が-1 -> 0に変化する。よって | |
//1 < (t * t * (3.5 * t + 2.5) < 0 | |
//となる。 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment