Tween.delay, Tween.repeat and Tween.yoyo will no longer throw an error if called before a TweenData object has been created (via Tween.to or Tween.from) (thanks @SomMeri #1419)

This commit is contained in:
photonstorm 2014-12-07 11:31:48 +00:00
parent e7f3b9188e
commit 38a224df3e
2 changed files with 20 additions and 7 deletions

View file

@ -9,7 +9,7 @@
- [How to Build](#how-to-build)
- [Koding](#koding)
- [Bower / NPM](#bower)
- [CDNJS](#cdnjs)
- [jsDelivr](#jsdelivr)
- [Requirements](#requirements)
- [Build Files](#build-files)
- [Learn By Example](#example)
@ -79,6 +79,8 @@ Version 2.2.2 - "Alkindar" - in development
### Bug Fixes
* Tween.delay, Tween.repeat and Tween.yoyo will no longer throw an error if called before a TweenData object has been created (via Tween.to or Tween.from) (thanks @SomMeri #1419)
For details about changes made in previous versions of Phaser see the full Change Log at https://github.com/photonstorm/phaser/blob/master/CHANGELOG.md
![div](http://phaser.io/images/div3.png)
@ -124,16 +126,18 @@ Nice and easy :)
![div](http://phaser.io/images/div6.png)
<a name="cdnjs"></a>
## CDNJS
<a name="jsdelivr"></a>
## jsDelivr
Phaser is now available on [CDNJS](http://cdnjs.com). You can include the following in your html:
Phaser is now available on [jsDelivr](http://jsdelivr.com) - a "super-fast CDN for developers and webmasters." You can include the following in your html:
`http://cdnjs.cloudflare.com/ajax/libs/phaser/2.2.2/phaser.min.js`
`//cdn.jsdelivr.net/phaser/2.2.2/phaser.min.js`
Or if you prefer you can leave the protocol off, so it works via http and https:
or the non-minified version:
`//cdnjs.cloudflare.com/ajax/libs/phaser/2.2.2/phaser.min.js`
`//cdn.jsdelivr.net/phaser/2.2.2/phaser.js`
More details on the [jsDelivr Phaser page](http://www.jsdelivr.com/#!phaser).
![div](http://phaser.io/images/div1.png)

View file

@ -359,6 +359,7 @@ Phaser.Tween.prototype = {
/**
* Sets the delay in milliseconds before this tween will start. If there are child tweens it sets the delay before the first child starts.
* The delay is invoked as soon as you call `Tween.start`. If the tween is already running this method doesn't do anything for the current active tween.
* If you have not yet called `Tween.to` or `Tween.from` at least once then this method will do nothing, as there are no tweens to delay.
* If you have child tweens and pass -1 as the index value it sets the delay across all of them.
*
* @method Phaser.Tween#delay
@ -368,6 +369,8 @@ Phaser.Tween.prototype = {
*/
delay: function (duration, index) {
if (this.timeline.length === 0) { return this; }
if (typeof index === 'undefined') { index = 0; }
if (index === -1)
@ -388,6 +391,7 @@ Phaser.Tween.prototype = {
/**
* Sets the number of times this tween will repeat.
* If you have not yet called `Tween.to` or `Tween.from` at least once then this method will do nothing, as there are no tweens to repeat.
* If you have child tweens and pass -1 as the index value it sets the number of times they'll repeat across all of them.
* If you wish to define how many times this Tween and all children will repeat see Tween.repeatAll.
*
@ -398,6 +402,8 @@ Phaser.Tween.prototype = {
*/
repeat: function (total, index) {
if (this.timeline.length === 0) { return this; }
if (typeof index === 'undefined') { index = 0; }
if (index === -1)
@ -419,6 +425,7 @@ Phaser.Tween.prototype = {
/**
* A Tween that has yoyo set to true will run through from its starting values to its end values and then play back in reverse from end to start.
* Used in combination with repeat you can create endless loops.
* If you have not yet called `Tween.to` or `Tween.from` at least once then this method will do nothing, as there are no tweens to yoyo.
* If you have child tweens and pass -1 as the index value it sets the yoyo property across all of them.
* If you wish to yoyo this Tween and all of its children then see Tween.yoyoAll.
*
@ -429,6 +436,8 @@ Phaser.Tween.prototype = {
*/
yoyo: function(enable, index) {
if (this.timeline.length === 0) { return this; }
if (typeof index === 'undefined') { index = 0; }
if (index === -1)