diff --git a/README.md b/README.md index 898315f69..f8b3326c9 100644 --- a/README.md +++ b/README.md @@ -114,6 +114,7 @@ Version 2.1.0 - "Cairhien" - 9th September 2014 * Rectangle.topRight returns a Point object that represents the top-right coordinate of the Rectangle. * The grunt script now builds a new version of Phaser without any physics (including Arcade Physics), Tilemaps or Particles. This build is called `phaser-no-physics.js` and works stand-alone. Please note that things like the GameObjectFactory aren't changed, so they will still try and create a Tilemap for example should you ask them to (thanks @eguneys #1172) * Camera.roundPx is a new boolean. If set to `true` it will call `view.floor` as part of its update loop, keeping its boundary to integer values. Set to `false` to disable this from happening (#1141) +* Phaser.Easing.Default is a new property that is used when a specific type of ease isn't given. It defaults to Linear.None but can be overridden to anything (thanks @alvinsight) ### Updates diff --git a/src/tween/Easing.js b/src/tween/Easing.js index 753eb4814..7ea15e2f3 100644 --- a/src/tween/Easing.js +++ b/src/tween/Easing.js @@ -7,7 +7,7 @@ */ /** -* A collection of easing methods defining ease-in ease-out curves. +* A collection of easing methods defining ease-in and ease-out curves. * * @class Phaser.Easing */ @@ -21,11 +21,11 @@ Phaser.Easing = { Linear: { /** - * Ease-in. + * Linear Easing (no variation). * - * @method Phaser.Easing.Linear#In + * @method Phaser.Easing.Linear#None * @param {number} k - The value to be tweened. - * @returns {number} k^2. + * @returns {number} k. */ None: function ( k ) { @@ -561,3 +561,5 @@ Phaser.Easing = { } }; + +Phaser.Easing.Default = Phaser.Easing.Linear.None; diff --git a/src/tween/Tween.js b/src/tween/Tween.js index 60a522b41..19a99c50f 100644 --- a/src/tween/Tween.js +++ b/src/tween/Tween.js @@ -98,7 +98,7 @@ Phaser.Tween = function (object, game, manager) { * @property {function} _easingFunction - The easing function used for the tween. * @private */ - this._easingFunction = Phaser.Easing.Linear.None; + this._easingFunction = Phaser.Easing.Default; /** * @property {function} _interpolationFunction - The interpolation function used for the tween. @@ -159,12 +159,6 @@ Phaser.Tween = function (object, game, manager) { */ this.pendingDelete = false; - // Set all starting values present on the target object - why? this will copy loads of properties we don't need - commenting out for now - // for (var field in object) - // { - // this._valuesStart[field] = parseFloat(object[field], 10); - // } - /** * @property {Phaser.Signal} onStart - The onStart event is fired when the Tween begins. */ @@ -197,7 +191,7 @@ Phaser.Tween.prototype = { * @method Phaser.Tween#to * @param {object} properties - The properties you want to tween, such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object. * @param {number} [duration=1000] - Duration of this tween in ms. - * @param {function} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Linear.None. + * @param {function} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden at will. * @param {boolean} [autoStart=false] - Whether this tween will start automatically or not. * @param {number} [delay=0] - Delay before this tween will start, defaults to 0 (no delay). Value given is in ms. * @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as Number.MAX_VALUE. This ignores any chained tweens.