phaser/Phaser/system/easing/Exponential.js
Richard Davey e74114f384 Docs
2013-08-12 00:52:35 +01:00

35 lines
1.1 KiB
JavaScript

var Phaser;
(function (Phaser) {
/// <reference path="../../Game.ts" />
/**
* Phaser - Easing - Exponential
*
* For use with Phaser.Tween
*/
(function (Easing) {
var Exponential = (function () {
function Exponential() { }
Exponential.In = function In(k) {
return k === 0 ? 0 : Math.pow(1024, k - 1);
};
Exponential.Out = function Out(k) {
return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
};
Exponential.InOut = function InOut(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 = {}));