Skip to content

Instantly share code, notes, and snippets.

@nishinoshake
Last active September 21, 2016 13:33
Show Gist options
  • Save nishinoshake/7670f594bd47fd37fc52aaf95b0d40ef to your computer and use it in GitHub Desktop.
Save nishinoshake/7670f594bd47fd37fc52aaf95b0d40ef to your computer and use it in GitHub Desktop.
easingを関数として使う
// $.easing.easing(null, current_time, start_value, end_value, total_time);
// http://gsgd.co.uk/sandbox/jquery/easing/
// プラグインが必要
var duration = 600;
var startTime = (new Date()).getTime();
// *
// * ループをRAFでまわしたりする
// * valueにeasingが加味された値が返る
// *
var now = (new Date()).getTime();
var passedTime = now - startTime;
var progress = passedTime / duration;
var value = $.easing.easeOutSine(null, passedTime, 0, 1, duration);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment