phaser/Docs/out/global.html
2013-10-01 16:15:45 +01:00

4516 lines
No EOL
72 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>JSDoc: Global</title>
<script src="scripts/prettify/prettify.js"> </script>
<script src="scripts/prettify/lang-css.js"> </script>
<!--[if lt IE 9]>
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">
</head>
<body>
<div id="main">
<h1 class="page-title">Global</h1>
<section>
<header>
<h2>
</h2>
</header>
<article>
<div class="container-overview">
<dl class="details">
</dl>
</div>
<h3 class="subsection-title">Methods</h3>
<dl>
<dt>
<h4 class="name" id="add"><span class="type-signature"></span>add<span class="signature">(name, <span class="optional">frames</span>, <span class="optional">frameRate</span>, <span class="optional">loop</span>, <span class="optional">useNumericIndex</span>)</span><span class="type-signature"> &rarr; {Phaser.Animation}</span></h4>
</dt>
<dd>
<div class="description">
Adds a new animation under the given key. Optionally set the frames, frame rate and loop.
Animations added in this way are played back with the play function.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The unique (within this Sprite) name for the animation, i.e. "run", "fire", "walk".</td>
</tr>
<tr>
<td class="name"><code>frames</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">An array of numbers/strings that correspond to the frames to add to this animation and in which order. e.g. [1, 2, 3] or ['run0', 'run1', run2]). If null then all frames will be used.</td>
</tr>
<tr>
<td class="name"><code>frameRate</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
60
</td>
<td class="description last">The speed at which the animation should play. The speed is given in frames per second.</td>
</tr>
<tr>
<td class="name"><code>loop</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">{boolean} - Whether or not the animation is looped or just plays once.</td>
</tr>
<tr>
<td class="name"><code>useNumericIndex</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">Are the given frames using numeric indexes (default) or strings?</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/AnimationManager.js, line 78
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The Animation object that was created.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Phaser.Animation</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="addFrame"><span class="type-signature"></span>addFrame<span class="signature">(frame)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.Frame.html">Phaser.Animation.Frame</a>}</span></h4>
</dt>
<dd>
<div class="description">
Adds a new Frame to this FrameData collection. Typically called by the Animation.Parser and not directly.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frame</code></td>
<td class="type">
<span class="param-type"><a href="Phaser.Animation.Frame.html">Phaser.Animation.Frame</a></span>
</td>
<td class="description last">The frame to add to this FrameData set.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 33
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The frame that was just added.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Animation.Frame.html">Phaser.Animation.Frame</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="checkFrameName"><span class="type-signature"></span>checkFrameName<span class="signature">(name)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
Check if there is a Frame with the given name.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the frame you want to check.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 91
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if the frame is found, otherwise false.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="destroy"><span class="type-signature"></span>destroy<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Cleans up this animation ready for deletion. Nulls all values and references.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Animation.js, line 265
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="destroy"><span class="type-signature"></span>destroy<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Destroys all references this AnimationManager contains. Sets the _anims to a new object and nulls the current animation.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/AnimationManager.js, line 243
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="generateFrameNames"><span class="type-signature"></span>generateFrameNames<span class="signature">(prefix, min, max, <span class="optional">suffix</span>, <span class="optional">zeroPad</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Really handy function for when you are creating arrays of animation data but it's using frame names and not numbers.
For example imagine you've got 30 frames named: 'explosion_0001-large' to 'explosion_0030-large'
You could use this function to generate those by doing: Phaser.Animation.generateFrameNames('explosion_', 1, 30, '-large', 4);
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>prefix</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The start of the filename. If the filename was 'explosion_0001-large' the prefix would be 'explosion_'.</td>
</tr>
<tr>
<td class="name"><code>min</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The number to start sequentially counting from. If your frames are named 'explosion_0001' to 'explosion_0034' the min is 1.</td>
</tr>
<tr>
<td class="name"><code>max</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The number to count up to. If your frames are named 'explosion_0001' to 'explosion_0034' the max is 34.</td>
</tr>
<tr>
<td class="name"><code>suffix</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
''
</td>
<td class="description last">The end of the filename. If the filename was 'explosion_0001-large' the prefix would be '-large'.</td>
</tr>
<tr>
<td class="name"><code>zeroPad</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
0
</td>
<td class="description last">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.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Animation.js, line 393
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFrame"><span class="type-signature"></span>getFrame<span class="signature">(index)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.Frame.html">Phaser.Animation.Frame</a>}</span></h4>
</dt>
<dd>
<div class="description">
Get a Frame by its numerical index.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>index</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The index of the frame you want to get.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 55
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The frame, if found.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Animation.Frame.html">Phaser.Animation.Frame</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFrameByName"><span class="type-signature"></span>getFrameByName<span class="signature">(name)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.Frame.html">Phaser.Animation.Frame</a>}</span></h4>
</dt>
<dd>
<div class="description">
Get a Frame by its frame name.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The name of the frame you want to get.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 73
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The frame, if found.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Animation.Frame.html">Phaser.Animation.Frame</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFrameIndexes"><span class="type-signature"></span>getFrameIndexes<span class="signature">(frames, <span class="optional">useNumericIndex</span>, <span class="optional">output</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<div class="description">
Returns all of the Frame indexes in this FrameData set.
The frames indexes are returned in the output array, or if none is provided in a new Array object.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frames</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.</td>
</tr>
<tr>
<td class="name"><code>useNumericIndex</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">Are the given frames using numeric indexes (default) or strings? (false)</td>
</tr>
<tr>
<td class="name"><code>output</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">If given the results will be appended to the end of this array otherwise a new array will be created.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 178
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
An array of all Frame indexes matching the given names or IDs.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFrameRange"><span class="type-signature"></span>getFrameRange<span class="signature">(start, end, <span class="optional">output</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<div class="description">
Returns a range of frames based on the given start and end frame indexes and returns them in an Array.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>start</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last">The starting frame index.</td>
</tr>
<tr>
<td class="name"><code>end</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="description last">The ending frame index.</td>
</tr>
<tr>
<td class="name"><code>output</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="description last">If given the results will be appended to the end of this array otherwise a new array will be created.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 109
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
An array of Frames between the start and end index values, or an empty array if none were found.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="getFrames"><span class="type-signature"></span>getFrames<span class="signature">(frames, <span class="optional">useNumericIndex</span>, <span class="optional">output</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<div class="description">
Returns all of the Frames in this FrameData set where the frame index is found in the input array.
The frames are returned in the output array, or if none is provided in a new Array object.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frames</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">An Array containing the indexes of the frames to retrieve. If the array is empty then all frames in the FrameData are returned.</td>
</tr>
<tr>
<td class="name"><code>useNumericIndex</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">Are the given frames using numeric indexes (default) or strings? (false)</td>
</tr>
<tr>
<td class="name"><code>output</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
</td>
<td class="description last">If given the results will be appended to the end of this array otherwise a new array will be created.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 131
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
An array of all Frames in this FrameData set matching the given names or IDs.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Array</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="JSONData"><span class="type-signature"></span>JSONData<span class="signature">(game, json, cacheKey)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a>}</span></h4>
</dt>
<dd>
<div class="description">
Parse the JSON data and extract the animation frame data from it.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type">Phaser.Game</span>
</td>
<td class="description last">A reference to the currently running game.</td>
</tr>
<tr>
<td class="name"><code>json</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The JSON data from the Texture Atlas. Must be in Array format.</td>
</tr>
<tr>
<td class="name"><code>cacheKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The Game.Cache asset key of the texture image.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Parser.js, line 96
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A FrameData object containing the parsed frames.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="JSONDataHash"><span class="type-signature"></span>JSONDataHash<span class="signature">(game, json, cacheKey)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a>}</span></h4>
</dt>
<dd>
<div class="description">
Parse the JSON data and extract the animation frame data from it.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type">Phaser.Game</span>
</td>
<td class="description last">A reference to the currently running game.</td>
</tr>
<tr>
<td class="name"><code>json</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The JSON data from the Texture Atlas. Must be in JSON Hash format.</td>
</tr>
<tr>
<td class="name"><code>cacheKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The Game.Cache asset key of the texture image.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Parser.js, line 167
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A FrameData object containing the parsed frames.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="onComplete"><span class="type-signature"></span>onComplete<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Called internally when the animation finishes playback. Sets the isPlaying and isFinished states and dispatches the onAnimationComplete event if it exists on the parent.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Animation.js, line 281
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="play"><span class="type-signature"></span>play<span class="signature">(<span class="optional">frameRate</span>, <span class="optional">loop</span>)</span><span class="type-signature"> &rarr; {Phaser.Animation}</span></h4>
</dt>
<dd>
<div class="description">
Plays this animation.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frameRate</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">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.</td>
</tr>
<tr>
<td class="name"><code>loop</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Animation.js, line 118
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
- A reference to this Animation instance.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Phaser.Animation</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="play"><span class="type-signature"></span>play<span class="signature">(name, <span class="optional">frameRate</span>, <span class="optional">loop</span>)</span><span class="type-signature"> &rarr; {Phaser.Animation}</span></h4>
</dt>
<dd>
<div class="description">
Play an animation based on the given key. The animation should previously have been added via sprite.animations.add()
If the requested animation is already playing this request will be ignored. If you need to reset an already running animation do so directly on the Animation object itself.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The name of the animation to be played, e.g. "fire", "walk", "jump".</td>
</tr>
<tr>
<td class="name"><code>frameRate</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">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.</td>
</tr>
<tr>
<td class="name"><code>loop</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/AnimationManager.js, line 158
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A reference to playing Animation instance.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Phaser.Animation</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="restart"><span class="type-signature"></span>restart<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Sets this animation back to the first frame and restarts the animation.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Animation.js, line 160
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="setTrim"><span class="type-signature"></span>setTrim<span class="signature">(trimmed, actualWidth, actualHeight, destX, destY, destWidth, destHeight)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
If the frame was trimmed when added to the Texture Atlas this records the trim and source data.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>trimmed</code></td>
<td class="type">
<span class="param-type">bool</span>
</td>
<td class="description last">If this frame was trimmed or not.</td>
</tr>
<tr>
<td class="name"><code>actualWidth</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The width of the frame before being trimmed.</td>
</tr>
<tr>
<td class="name"><code>actualHeight</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The height of the frame before being trimmed.</td>
</tr>
<tr>
<td class="name"><code>destX</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The destination X position of the trimmed frame for display.</td>
</tr>
<tr>
<td class="name"><code>destY</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The destination Y position of the trimmed frame for display.</td>
</tr>
<tr>
<td class="name"><code>destWidth</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The destination width of the trimmed frame for display.</td>
</tr>
<tr>
<td class="name"><code>destHeight</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last">The destination height of the trimmed frame for display.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Frame.js, line 129
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="spriteSheet"><span class="type-signature"></span>spriteSheet<span class="signature">(game, key, frameWidth, frameHeight, <span class="optional">frameMax</span>)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a>}</span></h4>
</dt>
<dd>
<div class="description">
Parse a Sprite Sheet and extract the animation frame data from it.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type">Phaser.Game</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">A reference to the currently running game.</td>
</tr>
<tr>
<td class="name"><code>key</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The Game.Cache asset key of the Sprite Sheet image.</td>
</tr>
<tr>
<td class="name"><code>frameWidth</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The fixed width of each frame of the animation.</td>
</tr>
<tr>
<td class="name"><code>frameHeight</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">The fixed height of each frame of the animation.</td>
</tr>
<tr>
<td class="name"><code>frameMax</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
-1
</td>
<td class="description last">The total number of animation frames to extact from the Sprite Sheet. The default value of -1 means "extract all frames".</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Parser.js, line 15
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A FrameData object containing the parsed frames.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a></span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="stop"><span class="type-signature"></span>stop<span class="signature">(<span class="optional">resetFrame</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
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.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>resetFrame</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">If true after the animation stops the currentFrame value will be set to the first frame in this animation.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Animation.js, line 179
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="stop"><span class="type-signature"></span>stop<span class="signature">(<span class="optional">name</span>, <span class="optional">resetFrame</span>)</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Stop playback of an animation. If a name is given that specific animation is stopped, otherwise the current animation is stopped.
The currentAnim property of the AnimationManager is automatically set to the animation given.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>name</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
null
</td>
<td class="description last">The name of the animation to be stopped, e.g. "fire". If none is given the currently running animation is stopped.</td>
</tr>
<tr>
<td class="name"><code>resetFrame</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
false
</td>
<td class="description last">When the animation is stopped should the currentFrame be set to the first frame of the animation (true) or paused on the last frame displayed (false)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/AnimationManager.js, line 188
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="total"><span class="type-signature"></span>total<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4>
</dt>
<dd>
<div class="description">
Returns the total number of frames in this FrameData set.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/FrameData.js, line 226
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
The total number of frames in this FrameData set.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">Number</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="update"><span class="type-signature"></span>update<span class="signature">()</span><span class="type-signature"></span></h4>
</dt>
<dd>
<div class="description">
Updates this animation. Called automatically by the AnimationManager.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Animation.js, line 199
</li></ul></dd>
</dl>
</dd>
<dt>
<h4 class="name" id="update"><span class="type-signature">&lt;protected> </span>update<span class="signature">()</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
The main update function is called by the Sprites update loop. It's responsible for updating animation frames and firing related events.
</div>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/AnimationManager.js, line 218
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if a new animation frame has been set, otherwise false.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="validateFrames"><span class="type-signature"></span>validateFrames<span class="signature">(frames, <span class="optional">useNumericIndex</span>)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
Check whether the frames in the given array are valid and exist.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th>Argument</th>
<th>Default</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>frames</code></td>
<td class="type">
<span class="param-type">Array</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last">An array of frames to be validated.</td>
</tr>
<tr>
<td class="name"><code>useNumericIndex</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
true
</td>
<td class="description last">Validate the frames based on their numeric index (true) or string index (false)</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/AnimationManager.js, line 124
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
True if all given Frames are valid, otherwise false.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type">boolean</span>
</dd>
</dl>
</dd>
<dt>
<h4 class="name" id="XMLData"><span class="type-signature"></span>XMLData<span class="signature">(game, xml, cacheKey)</span><span class="type-signature"> &rarr; {<a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a>}</span></h4>
</dt>
<dd>
<div class="description">
Parse the XML data and extract the animation frame data from it.
</div>
<h5>Parameters:</h5>
<table class="params">
<thead>
<tr>
<th>Name</th>
<th>Type</th>
<th class="last">Description</th>
</tr>
</thead>
<tbody>
<tr>
<td class="name"><code>game</code></td>
<td class="type">
<span class="param-type">Phaser.Game</span>
</td>
<td class="description last">A reference to the currently running game.</td>
</tr>
<tr>
<td class="name"><code>xml</code></td>
<td class="type">
<span class="param-type">Object</span>
</td>
<td class="description last">The XML data from the Texture Atlas. Must be in Starling XML format.</td>
</tr>
<tr>
<td class="name"><code>cacheKey</code></td>
<td class="type">
<span class="param-type">string</span>
</td>
<td class="description last">The Game.Cache asset key of the texture image.</td>
</tr>
</tbody>
</table>
<dl class="details">
<dt class="tag-source">Source:</dt>
<dd class="tag-source"><ul class="dummy"><li>
animation/Parser.js, line 241
</li></ul></dd>
</dl>
<h5>Returns:</h5>
<div class="param-desc">
A FrameData object containing the parsed frames.
</div>
<dl>
<dt>
Type
</dt>
<dd>
<span class="param-type"><a href="Phaser.Animation.FrameData.html">Phaser.Animation.FrameData</a></span>
</dd>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<nav>
<h2><a href="index.html">Index</a></h2><h3>Modules</h3><ul><li><a href="module-Phaser.html">Phaser</a></li><li><a href="Animation.html">Animation</a></li></ul><h3>Classes</h3><ul><li><a href="Phaser.Animation.Frame.html">Frame</a></li><li><a href="Phaser.Animation.FrameData.html">FrameData</a></li><li><a href="Phaser.Animation.Parser.html">Parser</a></li><li><a href="Phaser.AnimationManager.html">AnimationManager</a></li><li><a href="Animation-Phaser.Animation.html">Animation</a></li></ul><h3>Namespaces</h3><ul><li><a href="Phaser.html">Phaser</a></li></ul><h3>Global</h3><ul><li><a href="global.html#add">add</a></li><li><a href="global.html#addFrame">addFrame</a></li><li><a href="global.html#checkFrameName">checkFrameName</a></li><li><a href="global.html#destroy">destroy</a></li><li><a href="global.html#generateFrameNames">generateFrameNames</a></li><li><a href="global.html#getFrame">getFrame</a></li><li><a href="global.html#getFrameByName">getFrameByName</a></li><li><a href="global.html#getFrameIndexes">getFrameIndexes</a></li><li><a href="global.html#getFrameRange">getFrameRange</a></li><li><a href="global.html#getFrames">getFrames</a></li><li><a href="global.html#JSONData">JSONData</a></li><li><a href="global.html#JSONDataHash">JSONDataHash</a></li><li><a href="global.html#onComplete">onComplete</a></li><li><a href="global.html#play">play</a></li><li><a href="global.html#restart">restart</a></li><li><a href="global.html#setTrim">setTrim</a></li><li><a href="global.html#spriteSheet">spriteSheet</a></li><li><a href="global.html#stop">stop</a></li><li><a href="global.html#total">total</a></li><li><a href="global.html#update">update</a></li><li><a href="global.html#validateFrames">validateFrames</a></li><li><a href="global.html#XMLData">XMLData</a></li></ul>
</nav>
<br clear="both">
<footer>
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.2.0-dev</a> on Tue Oct 01 2013 16:05:08 GMT+0100 (BST)
</footer>
<script> prettyPrint(); </script>
<script src="scripts/linenumber.js"> </script>
</body>
</html>