phaser/Phaser/tweens/easing/Back.ts

38 lines
632 B
TypeScript
Raw Normal View History

/// <reference path="../../_definitions.ts" />
2013-04-18 13:16:18 +00:00
/**
2013-04-18 15:49:08 +00:00
* Phaser - Easing - Back
*
* For use with Phaser.Tween
*/
2013-04-18 13:16:18 +00:00
module Phaser.Easing {
export class Back {
public static In(k) {
var s = 1.70158;
return k * k * ((s + 1) * k - s);
}
public static Out(k) {
var s = 1.70158;
return --k * k * ((s + 1) * k + s) + 1;
}
public static InOut(k) {
var s = 1.70158 * 1.525;
if ((k *= 2) < 1) return 0.5 * (k * k * ((s + 1) * k - s));
return 0.5 * ((k -= 2) * k * ((s + 1) * k + s) + 2);
}
}
}