mirror of
https://github.com/photonstorm/phaser
synced 2024-12-24 12:03:36 +00:00
35 lines
984 B
JavaScript
35 lines
984 B
JavaScript
|
var Phaser;
|
||
|
(function (Phaser) {
|
||
|
/// <reference path="../../_definitions.ts" />
|
||
|
/**
|
||
|
* Phaser - Easing - Back
|
||
|
*
|
||
|
* For use with Phaser.Tween
|
||
|
*/
|
||
|
(function (Easing) {
|
||
|
var Back = (function () {
|
||
|
function Back() {
|
||
|
}
|
||
|
Back.In = function (k) {
|
||
|
var s = 1.70158;
|
||
|
return k * k * ((s + 1) * k - s);
|
||
|
};
|
||
|
|
||
|
Back.Out = function (k) {
|
||
|
var s = 1.70158;
|
||
|
return --k * k * ((s + 1) * k + s) + 1;
|
||
|
};
|
||
|
|
||
|
Back.InOut = function (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);
|
||
|
};
|
||
|
return Back;
|
||
|
})();
|
||
|
Easing.Back = Back;
|
||
|
})(Phaser.Easing || (Phaser.Easing = {}));
|
||
|
var Easing = Phaser.Easing;
|
||
|
})(Phaser || (Phaser = {}));
|