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

37 lines
1.3 KiB
JavaScript

var Phaser;
(function (Phaser) {
/// <reference path="../../Game.ts" />
/**
* Phaser - Easing - Bounce
*
* For use with Phaser.Tween
*/
(function (Easing) {
var Bounce = (function () {
function Bounce() { }
Bounce.In = function In(k) {
return 1 - Phaser.Easing.Bounce.Out(1 - k);
};
Bounce.Out = function Out(k) {
if(k < (1 / 2.75)) {
return 7.5625 * k * k;
} else if(k < (2 / 2.75)) {
return 7.5625 * (k -= (1.5 / 2.75)) * k + 0.75;
} else if(k < (2.5 / 2.75)) {
return 7.5625 * (k -= (2.25 / 2.75)) * k + 0.9375;
} else {
return 7.5625 * (k -= (2.625 / 2.75)) * k + 0.984375;
}
};
Bounce.InOut = function InOut(k) {
if(k < 0.5) {
return Phaser.Easing.Bounce.In(k * 2) * 0.5;
}
return Phaser.Easing.Bounce.Out(k * 2 - 1) * 0.5 + 0.5;
};
return Bounce;
})();
Easing.Bounce = Bounce;
})(Phaser.Easing || (Phaser.Easing = {}));
var Easing = Phaser.Easing;
})(Phaser || (Phaser = {}));