mirror of
https://github.com/wassname/phaser.git
synced 2026-08-11 11:23:06 +08:00
Fixed up the namespace in the documentation and finished off all sections other than Game Objects and Physics (yuck).
This commit is contained in:
+207
-240
@@ -2,10 +2,8 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.Easing
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* A collection of easing methods defining ease-in ease-out curves.
|
||||
*
|
||||
@@ -13,21 +11,20 @@
|
||||
*/
|
||||
Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Linear easing.
|
||||
*
|
||||
* @namespace Linear
|
||||
*/
|
||||
/**
|
||||
* Linear easing.
|
||||
*
|
||||
* @class Phaser.Easing.Linear
|
||||
*/
|
||||
Linear: {
|
||||
|
||||
/**
|
||||
* Ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Linear
|
||||
*
|
||||
* @method Phaser.Easing.Linear#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} k^2.
|
||||
*/
|
||||
*/
|
||||
None: function ( k ) {
|
||||
|
||||
return k;
|
||||
@@ -36,21 +33,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Quadratic easing.
|
||||
*
|
||||
* @namespace Quadratic
|
||||
*/
|
||||
/**
|
||||
* Quadratic easing.
|
||||
*
|
||||
* @class Phaser.Easing.Quadratic
|
||||
*/
|
||||
Quadratic: {
|
||||
|
||||
/**
|
||||
* Ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quadratic
|
||||
*
|
||||
* @method Phaser.Easing.Quadratic#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} k^2.
|
||||
*/
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k;
|
||||
@@ -59,12 +55,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quadratic
|
||||
*
|
||||
* @method Phaser.Easing.Quadratic#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} k* (2-k).
|
||||
*/
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
return k * ( 2 - k );
|
||||
@@ -73,12 +68,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quadratic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Quadratic#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k;
|
||||
@@ -88,21 +82,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Cubic easing.
|
||||
*
|
||||
* @namespace Cubic
|
||||
*/
|
||||
/**
|
||||
* Cubic easing.
|
||||
*
|
||||
* @class Phaser.Easing.Cubic
|
||||
*/
|
||||
Cubic: {
|
||||
|
||||
/**
|
||||
* Cubic ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Cubic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Cubic#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k * k;
|
||||
@@ -111,12 +104,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Cubic ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Cubic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Cubic#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
return --k * k * k + 1;
|
||||
@@ -125,12 +117,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Cubic ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Cubic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Cubic#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k;
|
||||
@@ -140,21 +131,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Quartic easing.
|
||||
*
|
||||
* @namespace Quartic
|
||||
*/
|
||||
/**
|
||||
* Quartic easing.
|
||||
*
|
||||
* @class Phaser.Easing.Quartic
|
||||
*/
|
||||
Quartic: {
|
||||
|
||||
/**
|
||||
* Quartic ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quartic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Quartic#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k * k * k;
|
||||
@@ -163,12 +153,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Quartic ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quartic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Quartic#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
return 1 - ( --k * k * k * k );
|
||||
@@ -177,12 +166,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Quartic ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @returns {number} Description.
|
||||
* @memberof Quartic
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Quartic#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1) return 0.5 * k * k * k * k;
|
||||
@@ -192,21 +180,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Quintic easing.
|
||||
*
|
||||
* @namespace Quintic
|
||||
*/
|
||||
/**
|
||||
* Quintic easing.
|
||||
*
|
||||
* @class Phaser.Easing.Quintic
|
||||
*/
|
||||
Quintic: {
|
||||
|
||||
/**
|
||||
* Quintic ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quintic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Quintic#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return k * k * k * k * k;
|
||||
@@ -215,12 +202,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Quintic ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quintic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Quintic#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
return --k * k * k * k * k + 1;
|
||||
@@ -229,12 +215,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Quintic ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Quintic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Quintic#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1 ) return 0.5 * k * k * k * k * k;
|
||||
@@ -244,21 +229,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Sinusoidal easing.
|
||||
*
|
||||
* @namespace Sinusoidal
|
||||
*/
|
||||
/**
|
||||
* Sinusoidal easing.
|
||||
*
|
||||
* @class Phaser.Easing.Sinusoidal
|
||||
*/
|
||||
Sinusoidal: {
|
||||
|
||||
/**
|
||||
* Sinusoidal ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Sinusoidal
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Sinusoidal#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return 1 - Math.cos( k * Math.PI / 2 );
|
||||
@@ -267,12 +251,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Sinusoidal ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Sinusoidal
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Sinusoidal#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
return Math.sin( k * Math.PI / 2 );
|
||||
@@ -281,12 +264,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Sinusoidal ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Sinusoidal
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Sinusoidal#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
return 0.5 * ( 1 - Math.cos( Math.PI * k ) );
|
||||
@@ -295,21 +277,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Exponential easing.
|
||||
*
|
||||
* @namespace Exponential
|
||||
*/
|
||||
/**
|
||||
* Exponential easing.
|
||||
*
|
||||
* @class Phaser.Easing.Exponential
|
||||
*/
|
||||
Exponential: {
|
||||
|
||||
/**
|
||||
* Exponential ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Exponential
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Exponential#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return k === 0 ? 0 : Math.pow( 1024, k - 1 );
|
||||
@@ -318,12 +299,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Exponential ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Exponential
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Exponential#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
return k === 1 ? 1 : 1 - Math.pow( 2, - 10 * k );
|
||||
@@ -332,12 +312,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Exponential ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Exponential
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Exponential#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( k === 0 ) return 0;
|
||||
@@ -349,21 +328,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Circular easing.
|
||||
*
|
||||
* @namespace Circular
|
||||
*/
|
||||
/**
|
||||
* Circular easing.
|
||||
*
|
||||
* @class Phaser.Easing.Circular
|
||||
*/
|
||||
Circular: {
|
||||
|
||||
/**
|
||||
* Circular ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Circular
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Circular#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return 1 - Math.sqrt( 1 - k * k );
|
||||
@@ -372,12 +350,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Circular ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Circular
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Circular#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
return Math.sqrt( 1 - ( --k * k ) );
|
||||
@@ -386,12 +363,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Circular ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Circular
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Circular#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( ( k *= 2 ) < 1) return - 0.5 * ( Math.sqrt( 1 - k * k) - 1);
|
||||
@@ -401,21 +377,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Elastic easing.
|
||||
*
|
||||
* @namespace Elastic
|
||||
*/
|
||||
/**
|
||||
* Elastic easing.
|
||||
*
|
||||
* @class Phaser.Easing.Elastic
|
||||
*/
|
||||
Elastic: {
|
||||
|
||||
/**
|
||||
* Elastic ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Elastic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Elastic#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
var s, a = 0.1, p = 0.4;
|
||||
@@ -429,12 +404,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Elastic ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Elastic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Elastic#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
var s, a = 0.1, p = 0.4;
|
||||
@@ -448,12 +422,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Elastic ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Elastic
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Elastic#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
var s, a = 0.1, p = 0.4;
|
||||
@@ -468,21 +441,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Back easing.
|
||||
*
|
||||
* @namespace Back
|
||||
*/
|
||||
/**
|
||||
* Back easing.
|
||||
*
|
||||
* @class Phaser.Easing.Back
|
||||
*/
|
||||
Back: {
|
||||
|
||||
/**
|
||||
* Back ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Back
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Back#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
var s = 1.70158;
|
||||
@@ -492,12 +464,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Back ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Back
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Back#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
var s = 1.70158;
|
||||
@@ -507,12 +478,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Back ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Back
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Back#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
var s = 1.70158 * 1.525;
|
||||
@@ -523,21 +493,20 @@ Phaser.Easing = {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Bounce easing.
|
||||
*
|
||||
* @namespace Bounce
|
||||
*/
|
||||
/**
|
||||
* Bounce easing.
|
||||
*
|
||||
* @class Phaser.Easing.Bounce
|
||||
*/
|
||||
Bounce: {
|
||||
|
||||
/**
|
||||
* Bounce ease-in.
|
||||
*
|
||||
* @method In
|
||||
* @param {number} k - Description.
|
||||
* @memberof Bounce
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Bounce#In
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
In: function ( k ) {
|
||||
|
||||
return 1 - Phaser.Easing.Bounce.Out( 1 - k );
|
||||
@@ -546,12 +515,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Bounce ease-out.
|
||||
*
|
||||
* @method Out
|
||||
* @param {number} k - Description.
|
||||
* @memberof Bounce
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Bounce#Out
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
Out: function ( k ) {
|
||||
|
||||
if ( k < ( 1 / 2.75 ) ) {
|
||||
@@ -576,12 +544,11 @@ Phaser.Easing = {
|
||||
|
||||
/**
|
||||
* Bounce ease-in/out.
|
||||
*
|
||||
* @method InOut
|
||||
* @param {number} k - Description.
|
||||
* @memberof Bounce
|
||||
* @returns {number} Description.
|
||||
*/
|
||||
*
|
||||
* @method Phaser.Easing.Bounce#InOut
|
||||
* @param {number} k - The value to be tweened.
|
||||
* @returns {number} The tweened value.
|
||||
*/
|
||||
InOut: function ( k ) {
|
||||
|
||||
if ( k < 0.5 ) return Phaser.Easing.Bounce.In( k * 2 ) * 0.5;
|
||||
|
||||
+52
-50
@@ -2,10 +2,8 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.Tween
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Tween constructor
|
||||
* Create a new <code>Tween</code>.
|
||||
@@ -55,6 +53,7 @@ Phaser.Tween = function (object, game) {
|
||||
|
||||
/**
|
||||
* @property {number} _duration - Description.
|
||||
* @private
|
||||
* @default
|
||||
*/
|
||||
this._duration = 1000;
|
||||
@@ -148,7 +147,7 @@ Phaser.Tween = function (object, game) {
|
||||
this._pausedTime = 0;
|
||||
|
||||
/**
|
||||
* @property {boolean} pendingDelete - Description.
|
||||
* @property {boolean} pendingDelete - If this tween is ready to be deleted by the TweenManager.
|
||||
* @default
|
||||
*/
|
||||
this.pendingDelete = false;
|
||||
@@ -181,7 +180,7 @@ Phaser.Tween.prototype = {
|
||||
/**
|
||||
* Configure the Tween
|
||||
*
|
||||
* @method to
|
||||
* @method Phaser.Tween#to
|
||||
* @param {object} properties - Properties you want to tween.
|
||||
* @param {number} duration - Duration of this tween.
|
||||
* @param {function} ease - Easing function.
|
||||
@@ -238,9 +237,9 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Starts the tween running. Can also be called by the autoStart parameter of Tween.to.
|
||||
*
|
||||
* @method start
|
||||
* @method Phaser.Tween#start
|
||||
* @param {number} time - Description.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
@@ -291,9 +290,9 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Stops the tween if running and removes it from the TweenManager. If there are any onComplete callbacks or events they are not dispatched.
|
||||
*
|
||||
* @method stop
|
||||
* @method Phaser.Tween#stop
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
stop: function () {
|
||||
@@ -306,10 +305,10 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Sets a delay time before this tween will start.
|
||||
*
|
||||
* @method delay
|
||||
* @param {number} amount - Description.
|
||||
* @method Phaser.Tween#delay
|
||||
* @param {number} amount - The amount of the delay in ms.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
delay: function ( amount ) {
|
||||
@@ -320,9 +319,9 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Sets the number of times this tween will repeat.
|
||||
*
|
||||
* @method repeat
|
||||
* @method Phaser.Tween#repeat
|
||||
* @param {number} times - How many times to repeat.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
@@ -334,10 +333,11 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* A tween that has yoyo set to true will run through from start to finish, then reverse from finish to start.
|
||||
* Used in combination with repeat you can create endless loops.
|
||||
*
|
||||
* @method yoyo
|
||||
* @param {Phaser.Tween} yoyo - Description.
|
||||
* @method Phaser.Tween#yoyo
|
||||
* @param {boolean} yoyo - Set to true to yoyo this tween.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
yoyo: function( yoyo ) {
|
||||
@@ -348,10 +348,10 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Set easing function.
|
||||
* Set easing function this tween will use, i.e. Phaser.Easing.Linear.None.
|
||||
*
|
||||
* @method easing
|
||||
* @param {function} easing - Description.
|
||||
* @method Phaser.Tween#easing
|
||||
* @param {function} easing - The easing function this tween will use, i.e. Phaser.Easing.Linear.None.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
easing: function ( easing ) {
|
||||
@@ -362,10 +362,10 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Set interpolation function.
|
||||
* Set interpolation function the tween will use, by default it uses Phaser.Math.linearInterpolation.
|
||||
*
|
||||
* @method interpolation
|
||||
* @param {function} interpolation - Description.
|
||||
* @method Phaser.Tween#interpolation
|
||||
* @param {function} interpolation - The interpolation function to use (Phaser.Math.linearInterpolation by default)
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
interpolation: function ( interpolation ) {
|
||||
@@ -376,9 +376,10 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* You can chain tweens together by passing a reference to the chain function. This enables one tween to call another on completion.
|
||||
* You can pass as many tweens as you like to this function, they will each be chained in sequence.
|
||||
*
|
||||
* @method chain
|
||||
* @method Phaser.Tween#chain
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
chain: function () {
|
||||
@@ -397,19 +398,21 @@ Phaser.Tween.prototype = {
|
||||
* .to({ x: 0 }, 1000, Phaser.Easing.Linear.None)
|
||||
* .to({ y: 0 }, 1000, Phaser.Easing.Linear.None)
|
||||
* .loop();
|
||||
* @method loop
|
||||
* @method Phaser.Tween#loop
|
||||
* @return {Tween} Itself.
|
||||
*/
|
||||
loop: function() {
|
||||
|
||||
if (this._parent) this.chain(this._parent);
|
||||
return this;
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Sets a callback to be fired when the tween starts. Note: callback will be called in the context of the global scope.
|
||||
*
|
||||
* @method onStartCallback
|
||||
* @param {object} callback - Description.
|
||||
* @method Phaser.Tween#onStartCallback
|
||||
* @param {function} callback - The callback to invoke on start.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
onStartCallback: function ( callback ) {
|
||||
@@ -420,10 +423,10 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Sets a callback to be fired each time this tween updates. Note: callback will be called in the context of the global scope.
|
||||
*
|
||||
* @method onUpdateCallback
|
||||
* @param {object} callback - Description.
|
||||
* @method Phaser.Tween#onUpdateCallback
|
||||
* @param {function} callback - The callback to invoke each time this tween is updated.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
onUpdateCallback: function ( callback ) {
|
||||
@@ -434,10 +437,10 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Sets a callback to be fired when the tween completes. Note: callback will be called in the context of the global scope.
|
||||
*
|
||||
* @method onCompleteCallback
|
||||
* @param {object} callback - Description.
|
||||
* @method Phaser.Tween#onCompleteCallback
|
||||
* @param {function} callback - The callback to invoke on completion.
|
||||
* @return {Phaser.Tween} Itself.
|
||||
*/
|
||||
onCompleteCallback: function ( callback ) {
|
||||
@@ -448,30 +451,30 @@ Phaser.Tween.prototype = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Pause.
|
||||
* Pauses the tween.
|
||||
*
|
||||
* @method pause
|
||||
* @method Phaser.Tween#pause
|
||||
*/
|
||||
pause: function () {
|
||||
this._paused = true;
|
||||
},
|
||||
pause: function () {
|
||||
this._paused = true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Resume.
|
||||
* Resumes a paused tween.
|
||||
*
|
||||
* @method resume
|
||||
* @method Phaser.Tween#resume
|
||||
*/
|
||||
resume: function () {
|
||||
this._paused = false;
|
||||
this._startTime += this.game.time.pauseDuration;
|
||||
},
|
||||
resume: function () {
|
||||
this._paused = false;
|
||||
this._startTime += this.game.time.pauseDuration;
|
||||
},
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Core tween update function called by the TweenManager. Does not need to be invoked directly.
|
||||
*
|
||||
* @method update
|
||||
* @param {number} time - Description.
|
||||
* @return {boolean} Description.
|
||||
* @method Phaser.Tween#update
|
||||
* @param {number} time - A timestamp passed in by the TweenManager.
|
||||
* @return {boolean} false if the tween has completed and should be deleted from the manager, otherwise true (still active).
|
||||
*/
|
||||
update: function ( time ) {
|
||||
|
||||
@@ -602,4 +605,3 @@ Phaser.Tween.prototype = {
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
||||
+11
-13
@@ -2,10 +2,8 @@
|
||||
* @author Richard Davey <rich@photonstorm.com>
|
||||
* @copyright 2013 Photon Storm Ltd.
|
||||
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
|
||||
* @module Phaser.TweenManager
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Phaser - TweenManager
|
||||
*
|
||||
@@ -14,10 +12,10 @@
|
||||
* Phaser.Game has a single instance of the TweenManager through which all Tween objects are created and updated.
|
||||
* Tweens are hooked into the game clock and pause system, adjusting based on the game state.
|
||||
*
|
||||
* TweenManager is based heavily on tween.js by {@link http://soledadpenades.com|sole}.
|
||||
* TweenManager is based heavily on tween.js by http://soledadpenades.com.
|
||||
* The difference being that tweens belong to a games instance of TweenManager, rather than to a global TWEEN object.
|
||||
* It also has callbacks swapped for Signals and a few issues patched with regard to properties and completion errors.
|
||||
* Please see {@link https://github.com/sole/tween.js} for a full list of contributors.
|
||||
* Please see https://github.com/sole/tween.js for a full list of contributors.
|
||||
* @constructor
|
||||
*
|
||||
* @param {Phaser.Game} game - A reference to the currently running game.
|
||||
@@ -49,7 +47,7 @@ Phaser.TweenManager = function (game) {
|
||||
Phaser.TweenManager.prototype = {
|
||||
|
||||
/**
|
||||
* Description.
|
||||
* Version number of this library.
|
||||
* @property {string} REVISION
|
||||
* @default
|
||||
*/
|
||||
@@ -57,7 +55,7 @@ Phaser.TweenManager.prototype = {
|
||||
|
||||
/**
|
||||
* Get all the tween objects in an array.
|
||||
* @method getAll
|
||||
* @method Phaser.TweenManager#getAll
|
||||
* @returns {Phaser.Tween[]} Array with all tween objects.
|
||||
*/
|
||||
getAll: function () {
|
||||
@@ -68,7 +66,7 @@ Phaser.TweenManager.prototype = {
|
||||
|
||||
/**
|
||||
* Remove all tween objects.
|
||||
* @method removeAll
|
||||
* @method Phaser.TweenManager#removeAll
|
||||
*/
|
||||
removeAll: function () {
|
||||
|
||||
@@ -79,7 +77,7 @@ Phaser.TweenManager.prototype = {
|
||||
/**
|
||||
* Add a new tween into the TweenManager.
|
||||
*
|
||||
* @method add
|
||||
* @method Phaser.TweenManager#add
|
||||
* @param {Phaser.Tween} tween - The tween object you want to add.
|
||||
* @returns {Phaser.Tween} The tween object you added to the manager.
|
||||
*/
|
||||
@@ -92,7 +90,7 @@ Phaser.TweenManager.prototype = {
|
||||
/**
|
||||
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
*
|
||||
* @method create
|
||||
* @method Phaser.TweenManager#create
|
||||
* @param {Object} object - Object the tween will be run on.
|
||||
* @returns {Phaser.Tween} The newly created tween object.
|
||||
*/
|
||||
@@ -105,7 +103,7 @@ Phaser.TweenManager.prototype = {
|
||||
/**
|
||||
* Remove a tween from this manager.
|
||||
*
|
||||
* @method remove
|
||||
* @method Phaser.TweenManager#remove
|
||||
* @param {Phaser.Tween} tween - The tween object you want to remove.
|
||||
*/
|
||||
remove: function ( tween ) {
|
||||
@@ -123,7 +121,7 @@ Phaser.TweenManager.prototype = {
|
||||
/**
|
||||
* Update all the tween objects you added to this manager.
|
||||
*
|
||||
* @method update
|
||||
* @method Phaser.TweenManager#update
|
||||
* @returns {boolean} Return false if there's no tween to update, otherwise return true.
|
||||
*/
|
||||
update: function () {
|
||||
@@ -163,7 +161,7 @@ Phaser.TweenManager.prototype = {
|
||||
/**
|
||||
* Pauses all currently running tweens.
|
||||
*
|
||||
* @method update
|
||||
* @method Phaser.TweenManager#update
|
||||
*/
|
||||
pauseAll: function () {
|
||||
|
||||
@@ -176,7 +174,7 @@ Phaser.TweenManager.prototype = {
|
||||
/**
|
||||
* Pauses all currently paused tweens.
|
||||
*
|
||||
* @method resumeAll
|
||||
* @method Phaser.TweenManager#resumeAll
|
||||
*/
|
||||
resumeAll: function () {
|
||||
|
||||
|
||||
Reference in New Issue
Block a user