Skip to content

Commit 305b12d

Browse files
committed
Adding docs.
1 parent fa15f80 commit 305b12d

64 files changed

Lines changed: 6271 additions & 2685 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Intro.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2013 Photon Storm Ltd.
4+
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
5+
* @module Phaser.Intro
6+
*/
7+
18
/**
29
* Phaser - http://www.phaser.io
310
*

src/Phaser.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
/**
2+
* @author Richard Davey <rich@photonstorm.com>
3+
* @copyright 2013 Photon Storm Ltd.
4+
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
5+
* @module Phaser
6+
*/
7+
18
/**
29
* @module Phaser
310
*/

src/animation/Animation.js

Lines changed: 42 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**
22
* @author Richard Davey <rich@photonstorm.com>
33
* @copyright 2013 Photon Storm Ltd.
4-
* @license https://github.com/photonstorm/phaser/blob/master/license.txt MIT License
4+
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
55
* @module Phaser.Animation
66
*/
77

@@ -92,7 +92,18 @@ Phaser.Animation = function (game, parent, name, frameData, frames, delay, loope
9292
*/
9393
this._frameIndex = 0;
9494

95+
/**
96+
* @property {number} _frameDiff
97+
* @private
98+
* @default
99+
*/
95100
this._frameDiff = 0;
101+
102+
/**
103+
* @property {number} _frameSkip
104+
* @private
105+
* @default
106+
*/
96107
this._frameSkip = 1;
97108

98109
/**
@@ -108,9 +119,9 @@ Phaser.Animation.prototype = {
108119
* Plays this animation.
109120
*
110121
* @method play
111-
* @param {Number} [frameRate=null] The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.
112-
* @param {Boolean} [loop=null] Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.
113-
* @return {Phaser.Animation} A reference to this Animation instance.
122+
* @param {number} [frameRate=null] - The framerate to play the animation at. The speed is given in frames per second. If not provided the previously set frameRate of the Animation is used.
123+
* @param {boolean} [loop=null] - Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.
124+
* @return {Phaser.Animation} - A reference to this Animation instance.
114125
*/
115126
play: function (frameRate, loop) {
116127

@@ -169,7 +180,7 @@ Phaser.Animation.prototype = {
169180
* Stops playback of this animation and set it to a finished state. If a resetFrame is provided it will stop playback and set frame to the first in the animation.
170181
*
171182
* @method stop
172-
* @param {Boolean} [resetFrame=false] If true after the animation stops the currentFrame value will be set to the first frame in this animation.
183+
* @param {boolean} [resetFrame=false] - If true after the animation stops the currentFrame value will be set to the first frame in this animation.
173184
*/
174185
stop: function (resetFrame) {
175186

@@ -287,6 +298,14 @@ Phaser.Animation.prototype = {
287298
};
288299

289300
/**
301+
* Sets the paused state of the Animation.
302+
* @param {boolean} value - Set to true to pause the animation or false to resume it if previous paused.
303+
*
304+
*//**
305+
*
306+
* Returns the paused state of the Animation.
307+
* @returns {boolean}
308+
*
290309
*/
291310
Object.defineProperty(Phaser.Animation.prototype, "paused", {
292311

@@ -318,12 +337,14 @@ Object.defineProperty(Phaser.Animation.prototype, "paused", {
318337

319338
});
320339

340+
/**
341+
*
342+
* Returns the total number of frames in this Animation.
343+
* @return {number}
344+
*
345+
*/
321346
Object.defineProperty(Phaser.Animation.prototype, "frameTotal", {
322347

323-
/**
324-
* @method frameTotal
325-
* @return {Number} The total number of frames in this animation.
326-
*/
327348
get: function () {
328349
return this._frames.length;
329350
}
@@ -369,12 +390,18 @@ Object.defineProperty(Phaser.Animation.prototype, "frame", {
369390

370391
});
371392

372-
/*
373-
* Really handy function for when you are creating arrays of animation data but it's using frame names and not numbers.
374-
* For example imagine you've got 30 frames named: 'explosion_0001-large' to 'explosion_0030-large'
375-
* You could use this function to generate those by doing: Phaser.Animation.generateFrameNames('explosion_', 1, 30, '-large', 4);
376-
* The zeroPad value dictates how many zeroes to add in front of the numbers (if any)
377-
*/
393+
/**
394+
* Really handy function for when you are creating arrays of animation data but it's using frame names and not numbers.
395+
* For example imagine you've got 30 frames named: 'explosion_0001-large' to 'explosion_0030-large'
396+
* You could use this function to generate those by doing: Phaser.Animation.generateFrameNames('explosion_', 1, 30, '-large', 4);
397+
*
398+
* @param {string} prefix - The start of the filename. If the filename was 'explosion_0001-large' the prefix would be 'explosion_'.
399+
* @param {number} min - The number to start sequentially counting from. If your frames are named 'explosion_0001' to 'explosion_0034' the min is 1.
400+
* @param {number} max - The number to count up to. If your frames are named 'explosion_0001' to 'explosion_0034' the max is 34.
401+
* @param {string} [suffix=''] - The end of the filename. If the filename was 'explosion_0001-large' the prefix would be '-large'.
402+
* @param {number} [zeroPad=0] - The number of zeroes to pad the min and max values with. If your frames are named 'explosion_0001' to 'explosion_0034' then the zeroPad is 4.
403+
* @method generateFrameNames
404+
*/
378405
Phaser.Animation.generateFrameNames = function (prefix, min, max, suffix, zeroPad) {
379406

380407
if (typeof suffix == 'undefined') { suffix = ''; }

0 commit comments

Comments
 (0)