Skip to content

Commit 9850ccb

Browse files
committed
Removed un-used visible property and added jsdocs.
1 parent 7943748 commit 9850ccb

2 files changed

Lines changed: 62 additions & 70 deletions

File tree

src/animations/Animation.js

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -462,8 +462,6 @@ var Animation = new Class({
462462
});
463463
}
464464

465-
// console.table(frames);
466-
467465
if (!Array.isArray(frames) || frames.length === 0)
468466
{
469467
return out;
@@ -480,23 +478,17 @@ var Animation = new Class({
480478
continue;
481479
}
482480

481+
// Could be an integer or a string
483482
var frame = GetValue(item, 'frame', 0);
484483

484+
// The actual texture frame
485485
var textureFrame = textureManager.getFrame(key, frame);
486486

487487
animationFrame = new Frame(key, frame, index, textureFrame);
488488

489489
animationFrame.duration = GetValue(item, 'duration', 0);
490490
animationFrame.onUpdate = GetValue(item, 'onUpdate', null);
491491

492-
var visible = GetValue(item, 'visible', null);
493-
494-
if (visible !== null)
495-
{
496-
animationFrame.setVisible = true;
497-
animationFrame.visible = visible;
498-
}
499-
500492
animationFrame.isFirst = (!prev);
501493

502494
// The previously created animationFrame

src/animations/AnimationFrame.js

Lines changed: 60 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,156 +1,156 @@
11
var Class = require('../utils/Class');
22

3-
// Phaser.Animations.AnimationFrame
4-
53
var AnimationFrame = new Class({
64

75
initialize:
86

97
/**
10-
* [description]
8+
* A single frame in an Animation sequence.
9+
*
10+
* An AnimationFrame consists of a reference to the Texture it uses for rendering, references to other
11+
* frames in the animation, and index data. It also has the ability to fire its own `onUpdate` callback
12+
* and modify the animation timing.
13+
*
14+
* AnimationFrames are generated automatically by the Animation class.
1115
*
1216
* @class AnimationFrame
13-
* @memberOf Phaser.Animations.AnimationFrame
17+
* @memberOf Phaser.Animations
1418
* @constructor
1519
* @since 3.0.0
1620
*
17-
* @param {undefined} textureKey - [description]
18-
* @param {undefined} textureFrame - [description]
19-
* @param {undefined} index - [description]
20-
* @param {undefined} frame - [description]
21+
* @param {string} textureKey - The key of the Texture this AnimationFrame uses.
22+
* @param {string|integer} textureFrame - The key of the Frame within the Texture that this AnimationFrame uses.
23+
* @param {integer} index - The index of this AnimationFrame within the Animation sequence.
24+
* @param {Phaser.Textures.Frame} frame - A reference to the Texture Frame this AnimationFrame uses for rendering.
2125
*/
2226
function AnimationFrame (textureKey, textureFrame, index, frame)
2327
{
24-
// The keys into the Texture Manager of the texture + frame this uses
25-
2628
/**
27-
* [description]
29+
* The key of the Texture this AnimationFrame uses.
2830
*
2931
* @property {string} textureKey
32+
* @since 3.0.0
3033
*/
3134
this.textureKey = textureKey;
3235

3336
/**
34-
* [description]
37+
* The key of the Frame within the Texture that this AnimationFrame uses.
3538
*
36-
* @property {Phaser.Textures.Frame} textureFrame
39+
* @property {string|integer} textureFrame
40+
* @since 3.0.0
3741
*/
3842
this.textureFrame = textureFrame;
3943

40-
// The index of this frame within the Animation.frames array
41-
4244
/**
43-
* [description]
45+
* The index of this AnimationFrame within the Animation sequence.
4446
*
4547
* @property {integer} index
48+
* @since 3.0.0
4649
*/
4750
this.index = index;
4851

49-
// Texture Frame
50-
5152
/**
52-
* [description]
53+
* A reference to the Texture Frame this AnimationFrame uses for rendering.
5354
*
5455
* @property {Phaser.Textures.Frame} frame
56+
* @since 3.0.0
5557
*/
5658
this.frame = frame;
5759

58-
// Read-only
59-
6060
/**
61-
* [description]
61+
* Is this the first frame in an animation sequence?
6262
*
6363
* @property {boolean} isFirst
6464
* @default false
65+
* @readOnly
66+
* @since 3.0.0
6567
*/
6668
this.isFirst = false;
6769

68-
// Read-only
69-
7070
/**
71-
* [description]
71+
* Is this the last frame in an animation sequence?
7272
*
7373
* @property {boolean} isLast
7474
* @default false
75+
* @readOnly
76+
* @since 3.0.0
7577
*/
7678
this.isLast = false;
7779

78-
// The frame that comes before this one in the animation (if any)
79-
// Read-only
80-
8180
/**
82-
* [description]
81+
* A reference to the AnimationFrame that comes before this one in the animation, if any.
8382
*
84-
* @property {?[type]} prevFrame
83+
* @property {?Phaser.Animations.AnimationFrame} prevFrame
8584
* @default null
85+
* @readOnly
86+
* @since 3.0.0
8687
*/
8788
this.prevFrame = null;
8889

89-
// The frame that comes after this one in the animation (if any)
90-
// Read-only
91-
9290
/**
93-
* [description]
91+
* A reference to the AnimationFrame that comes after this one in the animation, if any.
9492
*
95-
* @property {?[type]} nextFrame
93+
* @property {?Phaser.Animations.AnimationFrame} nextFrame
9694
* @default null
95+
* @readOnly
96+
* @since 3.0.0
9797
*/
9898
this.nextFrame = null;
9999

100-
// Additional time (in ms) this frame should appear for - added onto the msPerFrame
101-
102100
/**
103-
* [description]
101+
* Additional time (in ms) that this frame should appear for during playback.
102+
* The value is added onto the msPerFrame set by the animation.
104103
*
105104
* @property {number} duration
106105
* @default 0
106+
* @since 3.0.0
107107
*/
108108
this.duration = 0;
109109

110-
// What % through the animation progress is this frame?
111-
// Read-only
112-
113110
/**
114-
* [description]
111+
* What % through the animation does this frame come?
112+
* This value is generated when the animation is created and cached here.
115113
*
116114
* @property {number} progress
117115
* @default 0
116+
* @readOnly
117+
* @since 3.0.0
118118
*/
119119
this.progress = 0;
120120

121-
// Callback if this frame gets displayed
122-
123121
/**
124-
* [description]
122+
* A frame specific callback, invoked if this frame gets displayed and the callback is set.
125123
*
126-
* @property {?[type]} onUpdate
124+
* @property {?function} onUpdate
127125
* @default null
126+
* @since 3.0.0
128127
*/
129128
this.onUpdate = null;
130-
131-
// When this frame hits, set sprite.visible to this
132-
133-
/**
134-
* [description]
135-
*
136-
* @property {boolean} setVisible
137-
* @default false
138-
*/
139-
this.setVisible = false;
140-
141-
this.visible = false;
142129
},
143130

131+
/**
132+
* Generates a JavaScript object suitable for converting to JSON.
133+
*
134+
* @method Phaser.Animations.AnimationFrame#toJSON
135+
* @since 3.0.0
136+
*
137+
* @return {object} The AnimationFrame data.
138+
*/
144139
toJSON: function ()
145140
{
146141
return {
147142
key: this.textureKey,
148143
frame: this.textureFrame,
149-
duration: this.duration,
150-
visible: this.visible
144+
duration: this.duration
151145
};
152146
},
153147

148+
/**
149+
* Destroys this object by removing references to external resources and callbacks.
150+
*
151+
* @method Phaser.Animations.AnimationFrame#destroy
152+
* @since 3.0.0
153+
*/
154154
destroy: function ()
155155
{
156156
this.frame = undefined;

0 commit comments

Comments
 (0)