Skip to content

Instantly share code, notes, and snippets.

@baku89
Created December 27, 2013 14:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save baku89/8147453 to your computer and use it in GitHub Desktop.
Save baku89/8147453 to your computer and use it in GitHub Desktop.
一定時間かけて直前のキーフレームの値にアニメーションします。F.I F.Oを繰り返す時などに使えます。 duration: アニメーションの長さ
var duration = 1;
if (thisProperty.numKeys < 2) {
value
} else {
var pk = nearestKey(time);
(pk.index > 1 && time < pk.time) ? pk = thisProperty.key(pk.index-1) : false;
if (time - pk.time < duration && pk.index > 1) {
ease(time, pk.time, pk.time+duration, thisProperty.key(pk.index-1).value, pk.value);
} else {
pk.value;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment