mirror of
https://github.com/wassname/phaser.git
synced 2026-08-19 12:30:07 +08:00
Preparing for new release
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Bounce {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return 1 - Phaser.Easing.Bounce.Out(1 - k);
|
||||
|
||||
}
|
||||
|
||||
public static 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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public static 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;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Circular {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return 1 - Math.sqrt(1 - k * k);
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
return Math.sqrt(1 - (--k * k));
|
||||
|
||||
}
|
||||
|
||||
public static InOut(k) {
|
||||
|
||||
if ((k *= 2) < 1) return -0.5 * (Math.sqrt(1 - k * k) - 1);
|
||||
return 0.5 * (Math.sqrt(1 - (k -= 2) * k) + 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Cubic {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return k * k * k;
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
return --k * k * k + 1;
|
||||
|
||||
}
|
||||
|
||||
public static InOut(k) {
|
||||
|
||||
if ((k *= 2) < 1) return 0.5 * k * k * k;
|
||||
return 0.5 * ((k -= 2) * k * k + 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Elastic {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
var s, a = 0.1, p = 0.4;
|
||||
if (k === 0) return 0;
|
||||
if (k === 1) return 1;
|
||||
if (!a || a < 1) { a = 1; s = p / 4; }
|
||||
else s = p * Math.asin(1 / a) / (2 * Math.PI);
|
||||
return -(a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
var s, a = 0.1, p = 0.4;
|
||||
if (k === 0) return 0;
|
||||
if (k === 1) return 1;
|
||||
if (!a || a < 1) { a = 1; s = p / 4; }
|
||||
else s = p * Math.asin(1 / a) / (2 * Math.PI);
|
||||
return (a * Math.pow(2, -10 * k) * Math.sin((k - s) * (2 * Math.PI) / p) + 1);
|
||||
|
||||
}
|
||||
|
||||
public static InOut(k) {
|
||||
|
||||
var s, a = 0.1, p = 0.4;
|
||||
if (k === 0) return 0;
|
||||
if (k === 1) return 1;
|
||||
if (!a || a < 1) { a = 1; s = p / 4; }
|
||||
else s = p * Math.asin(1 / a) / (2 * Math.PI);
|
||||
if ((k *= 2) < 1) return -0.5 * (a * Math.pow(2, 10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p));
|
||||
return a * Math.pow(2, -10 * (k -= 1)) * Math.sin((k - s) * (2 * Math.PI) / p) * 0.5 + 1;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Exponential {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return k === 0 ? 0 : Math.pow(1024, k - 1);
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
return k === 1 ? 1 : 1 - Math.pow(2, -10 * k);
|
||||
|
||||
}
|
||||
|
||||
public static 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Linear {
|
||||
|
||||
public static None(k) {
|
||||
|
||||
return k;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Quadratic {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return k * k;
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
return k * (2 - k);
|
||||
|
||||
}
|
||||
|
||||
public static InOut(k) {
|
||||
|
||||
if ((k *= 2) < 1) return 0.5 * k * k;
|
||||
return -0.5 * (--k * (k - 2) - 1);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Quartic {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return k * k * k * k;
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
return 1 - (--k * k * k * k);
|
||||
|
||||
}
|
||||
|
||||
public static InOut(k) {
|
||||
|
||||
if ((k *= 2) < 1) return 0.5 * k * k * k * k;
|
||||
return -0.5 * ((k -= 2) * k * k * k - 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Quintic {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return k * k * k * k * k;
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
return --k * k * k * k * k + 1;
|
||||
|
||||
}
|
||||
|
||||
public static InOut(k) {
|
||||
|
||||
if ((k *= 2) < 1) return 0.5 * k * k * k * k * k;
|
||||
return 0.5 * ((k -= 2) * k * k * k * k + 2);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
/// <reference path="../../Game.ts" />
|
||||
|
||||
/**
|
||||
* Phaser - Easing
|
||||
*
|
||||
* @desc Based heavily on tween.js by sole (https://github.com/sole/tween.js)
|
||||
*
|
||||
* @version 1.0 - 11th January 2013
|
||||
*
|
||||
* @author Richard Davey, TypeScript conversion and Phaser integration. See Phaser.TweenManager for the full tween.js author list
|
||||
*/
|
||||
|
||||
module Phaser.Easing {
|
||||
|
||||
export class Sinusoidal {
|
||||
|
||||
public static In(k) {
|
||||
|
||||
return 1 - Math.cos(k * Math.PI / 2);
|
||||
|
||||
}
|
||||
|
||||
public static Out(k) {
|
||||
|
||||
return Math.sin(k * Math.PI / 2);
|
||||
|
||||
}
|
||||
|
||||
public static InOut(k) {
|
||||
|
||||
return 0.5 * (1 - Math.cos(Math.PI * k));
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user