mirror of
https://github.com/photonstorm/phaser
synced 2024-11-22 20:53:39 +00:00
Added more detail to the Tween docs.
This commit is contained in:
parent
2d676b00b4
commit
2a106473b4
3 changed files with 16 additions and 6 deletions
|
@ -130,6 +130,7 @@ Version 2.0.6 - "Jornhill" - -in development-
|
|||
* Signal.removeAll now has a new `context` parameter. If specified only listeners matching the given context are removed (thanks @lucbloom for the idea, #880)
|
||||
* Animation.next will advance to the next frame in the animation, even if it's not currently playing. You can optionally define the number of frames to advance, but the default is 1. This is also aliased from the AnimationManager, so you can do `Sprite.animations.next()`.
|
||||
* Animation.previous will rewind to the previous frame in the animation, even if it's not currently playing. You can optionally define the number of frames to rewind, but the default is 1. This is also aliased from the AnimationManager, so you can do `Sprite.animations.previous()`.
|
||||
* You can now debug render Ninja Physics AABB and Circle objects (thanks @psalaets, #972)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
|
@ -167,6 +168,7 @@ Calling addToWorld() would previously not check the _toRemove array, which could
|
|||
* Group.sendToBack (and consequently Sprite.sendToBack) no longer removes the child from the InputManager if enabled.
|
||||
* When adding a new Animation to a Sprite it would incorrectly reset the current Sprite frame to the first frame of the animation sequence, it is now left un-touched until you call `play` on the animation.
|
||||
* Tween.from now returns a reference to the tweened object in the same way that Tween.to does (thanks @b-ely, fix #976)
|
||||
* Re-ordered the parameters of Phaser.Physics.Arcade.Body.render which is used by Debug.body so it matches correctly (thanks @psalaets, #971 #970)
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ Phaser.GameObjectFactory.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Create a tween object for a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
* Create a tween on a specific object. The object can be any JavaScript object or Phaser object such as Sprite.
|
||||
*
|
||||
* @method Phaser.GameObjectFactory#tween
|
||||
* @param {object} obj - Object the tween will be run on.
|
||||
|
|
|
@ -191,10 +191,11 @@ Phaser.Tween = function (object, game, manager) {
|
|||
Phaser.Tween.prototype = {
|
||||
|
||||
/**
|
||||
* Configure the Tween
|
||||
* Sets this tween to be a `to` tween on the properties given. A `to` tween starts at the current value and tweens to the destination value given.
|
||||
* For example a Sprite with an `x` coordinate of 100 could be tweened to `x` 200 by giving a properties object of `{ x: 200 }`.
|
||||
*
|
||||
* @method Phaser.Tween#to
|
||||
* @param {object} properties - Properties you want to tween.
|
||||
* @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 {boolean} [autoStart=false] - Whether this tween will start automatically or not.
|
||||
|
@ -260,7 +261,8 @@ Phaser.Tween.prototype = {
|
|||
},
|
||||
|
||||
/**
|
||||
* Configure a Reverse Tween
|
||||
* Sets this tween to be a `from` tween on the properties given. A `from` tween starts at the given value and tweens to the current values.
|
||||
* For example a Sprite with an `x` coordinate of 100 could be tweened from `x: 200` by giving a properties object of `{ x: 200 }`.
|
||||
*
|
||||
* @method Phaser.Tween#from
|
||||
* @param {object} properties - Properties you want to tween from.
|
||||
|
@ -273,14 +275,20 @@ Phaser.Tween.prototype = {
|
|||
* @return {Phaser.Tween} This Tween object.
|
||||
*/
|
||||
from: function(properties, duration, ease, autoStart, delay, repeat, yoyo) {
|
||||
|
||||
var _cache = {};
|
||||
for(var prop in properties) {
|
||||
if (properties.hasOwnProperty(prop)) {
|
||||
|
||||
for (var prop in properties)
|
||||
{
|
||||
if (properties.hasOwnProperty(prop))
|
||||
{
|
||||
_cache[prop] = this._object[prop];
|
||||
this._object[prop] = properties[prop];
|
||||
}
|
||||
}
|
||||
|
||||
return this.to(_cache, duration, ease, autoStart, delay, repeat, yoyo);
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue