mirror of
https://github.com/photonstorm/phaser
synced 2025-01-11 12:48:50 +00:00
36 lines
1 KiB
JavaScript
36 lines
1 KiB
JavaScript
|
var Phaser;
|
||
|
(function (Phaser) {
|
||
|
/// <reference path="../../_definitions.ts" />
|
||
|
/**
|
||
|
* Phaser - Easing - Exponential
|
||
|
*
|
||
|
* For use with Phaser.Tween
|
||
|
*/
|
||
|
(function (Easing) {
|
||
|
var Exponential = (function () {
|
||
|
function Exponential() {
|
||
|
}
|
||
|
Exponential.In = function (k) {
|
||
|
return k === 0 ? 0 : Math.pow(1024, k - 1);
|
||
|
};
|
||
|
|
||
|
Exponential.Out = function (k) {
|
||
|
return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
|
||
|
};
|
||
|
|
||
|
Exponential.InOut = function (k) {
|
||
|
if (k === 0)
|
||
|
return 0;
|
||
|
if (k === 1)
|
||
|
return 1;
|
||
|
if ((k *= 2) < 1)
|
||
|
return 0.5 * Math.pow(1024, k - 1);
|
||
|
return 0.5 * (-Math.pow(2, -10 * (k - 1)) + 2);
|
||
|
};
|
||
|
return Exponential;
|
||
|
})();
|
||
|
Easing.Exponential = Exponential;
|
||
|
})(Phaser.Easing || (Phaser.Easing = {}));
|
||
|
var Easing = Phaser.Easing;
|
||
|
})(Phaser || (Phaser = {}));
|