2013-10-02 00:16:40 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
< title > Phaser Source: animation/Animation.js< / title >
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
< link type = "text/css" rel = "stylesheet" href = "styles/sunlight.default.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/site.cerulean.css" >
< / head >
< body >
< div class = "container-fluid" >
< div class = "navbar navbar-fixed-top navbar-inverse" >
< div class = "navbar-inner" >
< a class = "brand" href = "index.html" > Phaser< / a >
< ul class = "nav" >
< li class = "dropdown" >
2013-10-03 01:38:35 +00:00
< a href = "namespaces.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Namespaces< b
2013-10-02 00:16:40 +00:00
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-0" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.html" > Phaser< / a >
2013-10-02 00:16:40 +00:00
< / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "classes.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Classes< b
class="caret">< / b > < / a >
< ul class = "dropdown-menu " >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 00:16:40 +00:00
< a href = "Phaser.Animation.html" > Animation< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.AnimationManager.html" > AnimationManager< / a >
2013-10-02 00:16:40 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.AnimationParser.html" > AnimationParser< / a >
2013-10-02 00:16:40 +00:00
< / li >
2014-04-29 14:39:02 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayList.html" > ArrayList< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.AudioSprite.html" > AudioSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.BitmapData.html" > BitmapData< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.BitmapText.html" > BitmapText< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Button.html" > Button< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Cache.html" > Cache< / a >
2013-10-02 00:16:40 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Camera.html" > Camera< / a >
2013-10-02 00:16:40 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Canvas.html" > Canvas< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Circle.html" > Circle< / a >
2013-10-02 00:16:40 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Color.html" > Color< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Device.html" > Device< / a >
2013-10-02 11:11:22 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.html" > Easing< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Back.html" > Back< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Bounce.html" > Bounce< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Circular.html" > Circular< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Cubic.html" > Cubic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Elastic.html" > Elastic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Exponential.html" > Exponential< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Linear.html" > Linear< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Quadratic.html" > Quadratic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Quartic.html" > Quartic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Quintic.html" > Quintic< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Easing.Sinusoidal.html" > Sinusoidal< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.Ellipse.html" > Ellipse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Events.html" > Events< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Filter.html" > Filter< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.FlexGrid.html" > FlexGrid< / a >
< / li >
< li class = "class-depth-1" >
< a href = "Phaser.FlexLayer.html" > FlexLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Frame.html" > Frame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.FrameData.html" > FrameData< / a >
2013-10-03 00:21:08 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 00:16:40 +00:00
< a href = "Phaser.Game.html" > Game< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-21 15:37:26 +00:00
< a href = "Phaser.GameObjectCreator.html" > GameObjectCreator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.GameObjectFactory.html" > GameObjectFactory< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Gamepad.html" > Gamepad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.GamepadButton.html" > GamepadButton< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Graphics.html" > Graphics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 00:16:40 +00:00
< a href = "Phaser.Group.html" > Group< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-08 07:24:22 +00:00
< a href = "Phaser.Image.html" > Image< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 12:18:58 +00:00
< a href = "Phaser.Input.html" > Input< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.InputHandler.html" > InputHandler< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Key.html" > Key< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Keyboard.html" > Keyboard< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.Line.html" > Line< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.LinkedList.html" > LinkedList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Loader.html" > Loader< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.LoaderParser.html" > LoaderParser< / a >
2013-10-02 14:05:55 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Math.html" > Math< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Mouse.html" > Mouse< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.MSPointer.html" > MSPointer< / a >
2013-10-02 11:11:22 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 19:18:24 +00:00
< a href = "Phaser.Net.html" > Net< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Particle.html" > Particle< / a >
< / li >
< li class = "class-depth-1" >
2013-10-02 19:18:24 +00:00
< a href = "Phaser.Particles.html" > Particles< / a >
< / li >
2014-10-09 15:12:53 +00:00
< li class = "class-depth-2" >
< a href = "Phaser.Particles.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2013-10-02 19:18:24 +00:00
< a href = "Phaser.Particles.Arcade.Emitter.html" > Emitter< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.html" > Physics< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Physics.Arcade.html" > Arcade< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Arcade.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.html" > Ninja< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.AABB.html" > AABB< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Circle.html" > Circle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.Ninja.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.html" > P2< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Body.html" > Body< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.BodyDebug.html" > BodyDebug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.DistanceConstraint.html" > DistanceConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.FixtureList.html" > FixtureList< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.GearConstraint.html" > GearConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.InversePointProxy.html" > InversePointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.LockConstraint.html" > LockConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Material.html" > Material< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PointProxy.html" > PointProxy< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.PrismaticConstraint.html" > PrismaticConstraint< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.RevoluteConstraint.html" > RevoluteConstraint< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-3" >
< a href = "Phaser.Physics.P2.RotationalSpring.html" > RotationalSpring< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-3" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.Physics.P2.Spring.html" > Spring< / a >
2014-02-21 15:37:26 +00:00
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.Plugin.html" > Plugin< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.PluginManager.html" > PluginManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.Point.html" > Point< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Pointer.html" > Pointer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-07 06:10:15 +00:00
< a href = "Phaser.Polygon.html" > Polygon< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.QuadTree.html" > QuadTree< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.RandomDataGenerator.html" > RandomDataGenerator< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.Rectangle.html" > Rectangle< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.RenderTexture.html" > RenderTexture< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.RequestAnimationFrame.html" > RequestAnimationFrame< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.RetroFont.html" > RetroFont< / a >
< / li >
2014-09-09 14:36:56 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.Rope.html" > Rope< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-03-14 06:36:05 +00:00
< a href = "Phaser.ScaleManager.html" > ScaleManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.Signal.html" > Signal< / a >
< / li >
2014-04-11 12:09:28 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.SignalBinding.html" > SignalBinding< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.SinglePad.html" > SinglePad< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.Sound.html" > Sound< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 00:21:08 +00:00
< a href = "Phaser.SoundManager.html" > SoundManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Sprite.html" > Sprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-18 03:01:51 +00:00
< a href = "Phaser.SpriteBatch.html" > SpriteBatch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.Stage.html" > Stage< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.State.html" > State< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.StateManager.html" > StateManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.Text.html" > Text< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tile.html" > Tile< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tilemap.html" > Tilemap< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapLayer.html" > TilemapLayer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.TilemapParser.html" > TilemapParser< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Tileset.html" > Tileset< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-25 15:54:40 +00:00
< a href = "Phaser.TileSprite.html" > TileSprite< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Time.html" > Time< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-11-28 15:57:09 +00:00
< a href = "Phaser.Timer.html" > Timer< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2014-02-05 06:29:17 +00:00
< a href = "Phaser.TimerEvent.html" > TimerEvent< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 14:05:55 +00:00
< a href = "Phaser.Touch.html" > Touch< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Tween.html" > Tween< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.TweenManager.html" > TweenManager< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Utils.html" > Utils< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-2" >
2013-10-03 01:38:35 +00:00
< a href = "Phaser.Utils.Debug.html" > Debug< / a >
< / li >
2014-04-10 22:13:43 +00:00
< li class = "class-depth-1" >
2013-10-02 11:11:22 +00:00
< a href = "Phaser.World.html" > World< / a >
< / li >
2013-10-02 00:16:40 +00:00
< / ul >
< / li >
2014-09-09 14:36:56 +00:00
2013-10-02 00:16:40 +00:00
< / ul >
< / div >
< / div >
< div class = "row-fluid" >
< div class = "span12" >
< div id = "main" >
< h1 class = "page-title" > Source: animation/Animation.js< / h1 >
< section >
< article >
< pre class = "sunlight-highlight-javascript linenums" > /**
* @author Richard Davey < rich@photonstorm.com>
2014-02-05 06:29:17 +00:00
* @copyright 2014 Photon Storm Ltd.
2013-10-02 00:16:40 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* An Animation instance contains a single animation and the controls to play it.
* It is created by the AnimationManager, consists of Animation.Frame objects and belongs to a single Game Object such as a Sprite.
*
* @class Phaser.Animation
* @constructor
* @param {Phaser.Game} game - A reference to the currently running game.
* @param {Phaser.Sprite} parent - A reference to the owner of this Animation.
* @param {string} name - The unique name for this animation, used in playback commands.
2013-10-03 01:38:35 +00:00
* @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
2014-10-09 15:12:53 +00:00
* @param {number[]|string[]} frames - An array of numbers or strings indicating which frames to play in which order.
2013-10-02 00:16:40 +00:00
* @param {number} delay - The time between each frame of the animation, given in ms.
2014-03-14 06:36:05 +00:00
* @param {boolean} loop - Should this animation loop when it reaches the end or play through once.
2013-10-02 00:16:40 +00:00
*/
2014-03-14 06:36:05 +00:00
Phaser.Animation = function (game, parent, name, frameData, frames, delay, loop) {
2013-10-02 00:16:40 +00:00
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
2013-11-28 15:57:09 +00:00
this.game = game;
2013-10-02 00:16:40 +00:00
/**
* @property {Phaser.Sprite} _parent - A reference to the parent Sprite that owns this Animation.
* @private
*/
2013-11-28 15:57:09 +00:00
this._parent = parent;
2013-10-02 00:16:40 +00:00
/**
* @property {Phaser.FrameData} _frameData - The FrameData the Animation uses.
* @private
*/
this._frameData = frameData;
/**
* @property {string} name - The user defined name given to this Animation.
*/
this.name = name;
/**
2014-02-05 06:29:17 +00:00
* @property {array} _frames
2013-10-02 00:16:40 +00:00
* @private
*/
2013-11-28 15:57:09 +00:00
this._frames = [];
2013-10-02 00:16:40 +00:00
this._frames = this._frames.concat(frames);
/**
* @property {number} delay - The delay in ms between each frame of the Animation.
*/
2013-11-28 15:57:09 +00:00
this.delay = 1000 / delay;
2013-10-02 00:16:40 +00:00
/**
2014-03-14 06:36:05 +00:00
* @property {boolean} loop - The loop state of the Animation.
*/
this.loop = loop;
/**
* @property {number} loopCount - The number of times the animation has looped since it was last started.
2013-10-02 00:16:40 +00:00
*/
2014-03-14 06:36:05 +00:00
this.loopCount = 0;
2013-10-02 00:16:40 +00:00
2013-10-23 13:00:28 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {boolean} killOnComplete - Should the parent of this Animation be killed when the animation completes?
* @default
2013-10-23 13:00:28 +00:00
*/
this.killOnComplete = false;
2013-10-02 00:16:40 +00:00
/**
* @property {boolean} isFinished - The finished state of the Animation. Set to true once playback completes, false during playback.
* @default
*/
2013-11-28 15:57:09 +00:00
this.isFinished = false;
2013-10-02 00:16:40 +00:00
/**
* @property {boolean} isPlaying - The playing state of the Animation. Set to false once playback completes, true during playback.
* @default
*/
2013-11-28 15:57:09 +00:00
this.isPlaying = false;
2013-10-02 00:16:40 +00:00
/**
* @property {boolean} isPaused - The paused state of the Animation.
* @default
*/
this.isPaused = false;
/**
* @property {boolean} _pauseStartTime - The time the animation paused.
* @private
* @default
*/
this._pauseStartTime = 0;
/**
* @property {number} _frameIndex
* @private
* @default
*/
2013-11-28 15:57:09 +00:00
this._frameIndex = 0;
2013-10-02 00:16:40 +00:00
/**
* @property {number} _frameDiff
* @private
* @default
*/
this._frameDiff = 0;
/**
* @property {number} _frameSkip
* @private
* @default
*/
this._frameSkip = 1;
/**
2013-10-03 01:38:35 +00:00
* @property {Phaser.Frame} currentFrame - The currently displayed frame of the Animation.
2013-10-02 00:16:40 +00:00
*/
2013-11-28 15:57:09 +00:00
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
2014-03-14 06:36:05 +00:00
/**
* @property {Phaser.Signal} onStart - This event is dispatched when this Animation starts playback.
*/
this.onStart = new Phaser.Signal();
2014-09-09 14:36:56 +00:00
/**
* @property {Phaser.Signal|null} onUpdate - This event is dispatched when the Animation changes frame. By default this event is disabled due to its intensive nature. Enable it with: `Animation.enableUpdate = true`.
* @default
*/
this.onUpdate = null;
2014-03-14 06:36:05 +00:00
/**
* @property {Phaser.Signal} onComplete - This event is dispatched when this Animation completes playback. If the animation is set to loop this is never fired, listen for onAnimationLoop instead.
*/
this.onComplete = new Phaser.Signal();
/**
* @property {Phaser.Signal} onLoop - This event is dispatched when this Animation loops.
*/
this.onLoop = new Phaser.Signal();
// Set-up some event listeners
this.game.onPause.add(this.onPause, this);
this.game.onResume.add(this.onResume, this);
2014-03-28 01:42:49 +00:00
2013-10-02 00:16:40 +00:00
};
Phaser.Animation.prototype = {
/**
* Plays this animation.
*
* @method Phaser.Animation#play
* @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.
2013-10-23 13:00:28 +00:00
* @param {boolean} [loop=false] - Should the animation be looped after playback. If not provided the previously set loop value of the Animation is used.
* @param {boolean} [killOnComplete=false] - If set to true when the animation completes (only happens if loop=false) the parent Sprite will be killed.
2013-10-02 00:16:40 +00:00
* @return {Phaser.Animation} - A reference to this Animation instance.
*/
2013-10-23 13:00:28 +00:00
play: function (frameRate, loop, killOnComplete) {
2013-10-02 00:16:40 +00:00
if (typeof frameRate === 'number')
{
// If they set a new frame rate then use it, otherwise use the one set on creation
this.delay = 1000 / frameRate;
}
if (typeof loop === 'boolean')
{
// If they set a new loop value then use it, otherwise use the one set on creation
2014-03-14 06:36:05 +00:00
this.loop = loop;
2013-10-02 00:16:40 +00:00
}
2013-10-23 13:00:28 +00:00
if (typeof killOnComplete !== 'undefined')
{
// Remove the parent sprite once the animation has finished?
this.killOnComplete = killOnComplete;
}
2013-10-02 00:16:40 +00:00
this.isPlaying = true;
this.isFinished = false;
2013-11-01 18:16:52 +00:00
this.paused = false;
2014-03-14 06:36:05 +00:00
this.loopCount = 0;
2013-10-02 00:16:40 +00:00
this._timeLastFrame = this.game.time.now;
this._timeNextFrame = this.game.time.now + this.delay;
this._frameIndex = 0;
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
2014-07-10 19:31:11 +00:00
this._parent.setFrame(this.currentFrame);
2013-10-02 00:16:40 +00:00
2014-03-14 06:36:05 +00:00
// TODO: Double check if required
2014-02-18 03:01:51 +00:00
if (this._parent.__tilePattern)
{
this._parent.__tilePattern = false;
this._parent.tilingTexture = false;
}
2014-03-14 06:36:05 +00:00
this._parent.events.onAnimationStart.dispatch(this._parent, this);
2014-07-10 19:31:11 +00:00
2014-03-14 06:36:05 +00:00
this.onStart.dispatch(this._parent, this);
2013-10-02 00:16:40 +00:00
return this;
},
/**
* Sets this animation back to the first frame and restarts the animation.
*
* @method Phaser.Animation#restart
*/
restart: function () {
this.isPlaying = true;
this.isFinished = false;
2013-11-01 18:16:52 +00:00
this.paused = false;
2014-03-14 06:36:05 +00:00
this.loopCount = 0;
2013-10-02 00:16:40 +00:00
this._timeLastFrame = this.game.time.now;
this._timeNextFrame = this.game.time.now + this.delay;
this._frameIndex = 0;
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
2014-07-10 19:31:11 +00:00
this._parent.setFrame(this.currentFrame);
2014-03-14 06:36:05 +00:00
this.onStart.dispatch(this._parent, this);
2013-10-02 00:16:40 +00:00
},
2014-04-29 14:39:02 +00:00
/**
* Sets this animations playback to a given frame with the given ID.
*
* @method Phaser.Animation#setFrame
* @param {string|number} [frameId] - The identifier of the frame to set. Can be the name of the frame, the sprite index of the frame, or the animation-local frame index.
* @param {boolean} [useLocalFrameIndex=false] - If you provide a number for frameId, should it use the numeric indexes of the frameData, or the 0-indexed frame index local to the animation.
*/
setFrame: function(frameId, useLocalFrameIndex) {
var frameIndex;
if (typeof useLocalFrameIndex === 'undefined')
{
useLocalFrameIndex = false;
}
// Find the index to the desired frame.
if (typeof frameId === "string")
{
for (var i = 0; i < this._frames.length; i++)
{
if (this._frameData.getFrame(this._frames[i]).name === frameId)
{
frameIndex = i;
}
}
}
else if (typeof frameId === "number")
{
if (useLocalFrameIndex)
{
frameIndex = frameId;
}
else
{
for (var i = 0; i < this._frames.length; i++)
{
if (this.frames[i] === frameIndex)
{
frameIndex = i;
}
}
}
}
if (frameIndex)
{
// Set the current frame index to the found index. Subtract 1 so that it animates to the desired frame on update.
this._frameIndex = frameIndex - 1;
// Make the animation update at next update
this._timeNextFrame = this.game.time.now;
this.update();
}
},
2013-10-02 00:16:40 +00:00
/**
* 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.
2014-03-14 06:36:05 +00:00
* If `dispatchComplete` is true it will dispatch the complete events, otherwise they'll be ignored.
2013-10-02 00:16:40 +00:00
*
* @method Phaser.Animation#stop
* @param {boolean} [resetFrame=false] - If true after the animation stops the currentFrame value will be set to the first frame in this animation.
2014-03-14 06:36:05 +00:00
* @param {boolean} [dispatchComplete=false] - Dispatch the Animation.onComplete and parent.onAnimationComplete events?
2013-10-02 00:16:40 +00:00
*/
2014-03-14 06:36:05 +00:00
stop: function (resetFrame, dispatchComplete) {
2013-10-02 00:16:40 +00:00
if (typeof resetFrame === 'undefined') { resetFrame = false; }
2014-03-14 06:36:05 +00:00
if (typeof dispatchComplete === 'undefined') { dispatchComplete = false; }
2013-10-02 00:16:40 +00:00
this.isPlaying = false;
this.isFinished = true;
2013-11-01 18:16:52 +00:00
this.paused = false;
2013-10-02 00:16:40 +00:00
if (resetFrame)
{
this.currentFrame = this._frameData.getFrame(this._frames[0]);
2014-07-10 19:31:11 +00:00
this._parent.setFrame(this.currentFrame);
2013-10-02 00:16:40 +00:00
}
2014-03-14 06:36:05 +00:00
if (dispatchComplete)
{
this._parent.events.onAnimationComplete.dispatch(this._parent, this);
this.onComplete.dispatch(this._parent, this);
}
},
/**
* Called when the Game enters a paused state.
*
* @method Phaser.Animation#onPause
*/
onPause: function () {
if (this.isPlaying)
{
this._frameDiff = this._timeNextFrame - this.game.time.now;
}
},
/**
* Called when the Game resumes from a paused state.
*
* @method Phaser.Animation#onResume
*/
onResume: function () {
if (this.isPlaying)
{
this._timeNextFrame = this.game.time.now + this._frameDiff;
}
2013-10-02 00:16:40 +00:00
},
/**
* Updates this animation. Called automatically by the AnimationManager.
*
* @method Phaser.Animation#update
*/
update: function () {
if (this.isPaused)
{
return false;
}
2014-07-10 19:31:11 +00:00
if (this.isPlaying & & this.game.time.now >= this._timeNextFrame)
2013-10-02 00:16:40 +00:00
{
this._frameSkip = 1;
// Lagging?
this._frameDiff = this.game.time.now - this._timeNextFrame;
this._timeLastFrame = this.game.time.now;
if (this._frameDiff > this.delay)
{
// We need to skip a frame, work out how many
this._frameSkip = Math.floor(this._frameDiff / this.delay);
this._frameDiff -= (this._frameSkip * this.delay);
}
// And what's left now?
this._timeNextFrame = this.game.time.now + (this.delay - this._frameDiff);
this._frameIndex += this._frameSkip;
if (this._frameIndex >= this._frames.length)
{
2014-03-14 06:36:05 +00:00
if (this.loop)
2013-10-02 00:16:40 +00:00
{
this._frameIndex %= this._frames.length;
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
2014-03-14 06:36:05 +00:00
this.loopCount++;
2013-10-02 00:16:40 +00:00
this._parent.events.onAnimationLoop.dispatch(this._parent, this);
2014-03-14 06:36:05 +00:00
this.onLoop.dispatch(this._parent, this);
2013-10-02 00:16:40 +00:00
}
else
{
2014-03-14 06:36:05 +00:00
this.complete();
2013-10-02 00:16:40 +00:00
}
}
2014-07-10 19:31:11 +00:00
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
if (this.currentFrame)
2013-10-02 00:16:40 +00:00
{
2014-07-10 19:31:11 +00:00
this._parent.setFrame(this.currentFrame);
2013-11-28 15:57:09 +00:00
2014-07-10 19:31:11 +00:00
if (this._parent.__tilePattern)
2013-11-28 15:57:09 +00:00
{
2014-07-10 19:31:11 +00:00
this._parent.__tilePattern = false;
this._parent.tilingTexture = false;
2013-11-28 15:57:09 +00:00
}
2014-09-09 14:36:56 +00:00
if (this.onUpdate)
{
this.onUpdate.dispatch(this, this.currentFrame);
}
2013-10-02 00:16:40 +00:00
}
return true;
}
return false;
},
2014-07-10 19:31:11 +00:00
/**
* Advances by the given number of frames in the Animation, taking the loop value into consideration.
*
* @method Phaser.Animation#next
* @param {number} [quantity=1] - The number of frames to advance.
*/
next: function (quantity) {
if (typeof quantity === 'undefined') { quantity = 1; }
var frame = this._frameIndex + quantity;
if (frame >= this._frames.length)
{
if (this.loop)
{
frame %= this._frames.length;
}
else
{
frame = this._frames.length - 1;
}
}
if (frame !== this._frameIndex)
{
this._frameIndex = frame;
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
if (this.currentFrame)
{
this._parent.setFrame(this.currentFrame);
if (this._parent.__tilePattern)
{
this._parent.__tilePattern = false;
this._parent.tilingTexture = false;
}
}
2014-09-09 14:36:56 +00:00
if (this.onUpdate)
{
this.onUpdate.dispatch(this, this.currentFrame);
}
2014-07-10 19:31:11 +00:00
}
},
/**
* Moves backwards the given number of frames in the Animation, taking the loop value into consideration.
*
* @method Phaser.Animation#previous
* @param {number} [quantity=1] - The number of frames to move back.
*/
previous: function (quantity) {
if (typeof quantity === 'undefined') { quantity = 1; }
var frame = this._frameIndex - quantity;
if (frame < 0)
{
if (this.loop)
{
frame = this._frames.length + frame;
}
else
{
frame++;
}
}
if (frame !== this._frameIndex)
{
this._frameIndex = frame;
this.currentFrame = this._frameData.getFrame(this._frames[this._frameIndex]);
if (this.currentFrame)
{
this._parent.setFrame(this.currentFrame);
if (this._parent.__tilePattern)
{
this._parent.__tilePattern = false;
this._parent.tilingTexture = false;
}
}
2014-09-09 14:36:56 +00:00
if (this.onUpdate)
{
this.onUpdate.dispatch(this, this.currentFrame);
}
2014-07-10 19:31:11 +00:00
}
},
2014-07-18 11:45:51 +00:00
/**
* Changes the FrameData object this Animation is using.
*
* @method Phaser.Animation#updateFrameData
* @param {Phaser.FrameData} frameData - The FrameData object that contains all frames used by this Animation.
*/
updateFrameData: function (frameData) {
this._frameData = frameData;
this.currentFrame = this._frameData ? this._frameData.getFrame(this._frames[this._frameIndex % this._frames.length]) : null;
},
2013-10-02 00:16:40 +00:00
/**
* Cleans up this animation ready for deletion. Nulls all values and references.
*
* @method Phaser.Animation#destroy
*/
destroy: function () {
2014-07-10 19:31:11 +00:00
2014-04-29 14:39:02 +00:00
this.game.onPause.remove(this.onPause, this);
this.game.onResume.remove(this.onResume, this);
2013-10-02 00:16:40 +00:00
this.game = null;
this._parent = null;
this._frames = null;
this._frameData = null;
this.currentFrame = null;
this.isPlaying = false;
2014-04-15 14:39:23 +00:00
this.onStart.dispose();
this.onLoop.dispose();
this.onComplete.dispose();
2014-03-14 06:36:05 +00:00
2014-09-09 14:36:56 +00:00
if (this.onUpdate)
{
this.onUpdate.dispose();
}
2013-10-02 00:16:40 +00:00
},
/**
2014-03-14 06:36:05 +00:00
* Called internally when the animation finishes playback.
* Sets the isPlaying and isFinished states and dispatches the onAnimationComplete event if it exists on the parent and local onComplete event.
2013-10-02 00:16:40 +00:00
*
2014-03-14 06:36:05 +00:00
* @method Phaser.Animation#complete
2013-10-02 00:16:40 +00:00
*/
2014-03-14 06:36:05 +00:00
complete: function () {
2013-10-02 00:16:40 +00:00
this.isPlaying = false;
this.isFinished = true;
2013-11-01 18:16:52 +00:00
this.paused = false;
2013-10-02 00:16:40 +00:00
2014-03-14 06:36:05 +00:00
this._parent.events.onAnimationComplete.dispatch(this._parent, this);
this.onComplete.dispatch(this._parent, this);
2013-10-02 00:16:40 +00:00
2013-10-23 13:00:28 +00:00
if (this.killOnComplete)
{
this._parent.kill();
}
2013-10-02 00:16:40 +00:00
}
};
2014-02-05 06:29:17 +00:00
Phaser.Animation.prototype.constructor = Phaser.Animation;
2013-10-02 00:16:40 +00:00
/**
* @name Phaser.Animation#paused
* @property {boolean} paused - Gets and sets the paused state of this Animation.
*/
2013-11-28 15:57:09 +00:00
Object.defineProperty(Phaser.Animation.prototype, 'paused', {
2013-10-02 00:16:40 +00:00
get: function () {
return this.isPaused;
},
set: function (value) {
this.isPaused = value;
if (value)
{
// Paused
this._pauseStartTime = this.game.time.now;
}
else
{
// Un-paused
if (this.isPlaying)
{
this._timeNextFrame = this.game.time.now + this.delay;
}
}
}
});
/**
* @name Phaser.Animation#frameTotal
* @property {number} frameTotal - The total number of frames in the currently loaded FrameData, or -1 if no FrameData is loaded.
2013-10-02 11:11:22 +00:00
* @readonly
2013-10-02 00:16:40 +00:00
*/
2013-11-28 15:57:09 +00:00
Object.defineProperty(Phaser.Animation.prototype, 'frameTotal', {
2013-10-02 00:16:40 +00:00
get: function () {
return this._frames.length;
}
});
/**
* @name Phaser.Animation#frame
* @property {number} frame - Gets or sets the current frame index and updates the Texture Cache for display.
*/
2013-11-28 15:57:09 +00:00
Object.defineProperty(Phaser.Animation.prototype, 'frame', {
2013-10-02 00:16:40 +00:00
get: function () {
if (this.currentFrame !== null)
{
return this.currentFrame.index;
}
else
{
return this._frameIndex;
}
},
set: function (value) {
2014-02-21 15:37:26 +00:00
this.currentFrame = this._frameData.getFrame(this._frames[value]);
2013-10-02 00:16:40 +00:00
if (this.currentFrame !== null)
{
this._frameIndex = value;
2014-07-10 19:31:11 +00:00
this._parent.setFrame(this.currentFrame);
2014-09-09 14:36:56 +00:00
if (this.onUpdate)
{
this.onUpdate.dispatch(this, this.currentFrame);
}
2013-10-02 00:16:40 +00:00
}
}
});
2014-03-14 06:36:05 +00:00
/**
* @name Phaser.Animation#speed
* @property {number} speed - Gets or sets the current speed of the animation, the time between each frame of the animation, given in ms. Takes effect from the NEXT frame. Minimum value is 1.
*/
Object.defineProperty(Phaser.Animation.prototype, 'speed', {
get: function () {
return Math.round(1000 / this.delay);
},
set: function (value) {
if (value >= 1)
{
this.delay = 1000 / value;
}
}
});
2014-09-09 14:36:56 +00:00
/**
* @name Phaser.Animation#enableUpdate
* @property {boolean} enableUpdate - Gets or sets if this animation will dispatch the onUpdate events upon changing frame.
*/
Object.defineProperty(Phaser.Animation.prototype, 'enableUpdate', {
get: function () {
return (this.onUpdate !== null);
},
set: function (value) {
if (value & & this.onUpdate === null)
{
this.onUpdate = new Phaser.Signal();
}
else if (!value & & this.onUpdate !== null)
{
this.onUpdate.dispose();
this.onUpdate = null;
}
}
});
2013-10-02 00:16:40 +00:00
/**
* 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);
*
* @method Phaser.Animation.generateFrameNames
2014-10-09 15:12:53 +00:00
* @static
2013-10-02 00:16:40 +00:00
* @param {string} prefix - The start of the filename. If the filename was 'explosion_0001-large' the prefix would be 'explosion_'.
2013-10-25 15:54:40 +00:00
* @param {number} start - The number to start sequentially counting from. If your frames are named 'explosion_0001' to 'explosion_0034' the start is 1.
* @param {number} stop - The number to count to. If your frames are named 'explosion_0001' to 'explosion_0034' the stop value is 34.
2013-10-02 00:16:40 +00:00
* @param {string} [suffix=''] - The end of the filename. If the filename was 'explosion_0001-large' the prefix would be '-large'.
* @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.
2014-04-29 14:39:02 +00:00
* @return {array} An array of framenames.
2013-10-02 00:16:40 +00:00
*/
2013-10-25 15:54:40 +00:00
Phaser.Animation.generateFrameNames = function (prefix, start, stop, suffix, zeroPad) {
2013-10-02 00:16:40 +00:00
if (typeof suffix == 'undefined') { suffix = ''; }
var output = [];
var frame = '';
2013-10-25 15:54:40 +00:00
if (start < stop)
2013-10-02 00:16:40 +00:00
{
2013-10-25 15:54:40 +00:00
for (var i = start; i < = stop; i++)
2013-10-02 00:16:40 +00:00
{
2013-10-25 15:54:40 +00:00
if (typeof zeroPad == 'number')
{
// str, len, pad, dir
frame = Phaser.Utils.pad(i.toString(), zeroPad, '0', 1);
}
else
{
frame = i.toString();
}
frame = prefix + frame + suffix;
output.push(frame);
2013-10-02 00:16:40 +00:00
}
2013-10-25 15:54:40 +00:00
}
else
{
for (var i = start; i >= stop; i--)
2013-10-02 00:16:40 +00:00
{
2013-10-25 15:54:40 +00:00
if (typeof zeroPad == 'number')
{
// str, len, pad, dir
frame = Phaser.Utils.pad(i.toString(), zeroPad, '0', 1);
}
else
{
frame = i.toString();
}
2013-10-02 00:16:40 +00:00
2013-10-25 15:54:40 +00:00
frame = prefix + frame + suffix;
2013-10-02 00:16:40 +00:00
2013-10-25 15:54:40 +00:00
output.push(frame);
}
2013-10-02 00:16:40 +00:00
}
return output;
2014-03-28 01:42:49 +00:00
};
2013-10-02 00:16:40 +00:00
< / pre >
< / article >
< / section >
< / div >
< div class = "clearfix" > < / div >
< footer >
< span class = "copyright" >
2014-02-05 06:29:17 +00:00
Phaser Copyright © 2012-2014 Photon Storm Ltd.
2013-10-02 00:16:40 +00:00
< / span >
< br / >
< span class = "jsdoc-message" >
2014-04-11 12:09:28 +00:00
Documentation generated by < a href = "https://github.com/jsdoc3/jsdoc" > JSDoc 3.3.0-dev< / a >
2014-10-09 15:12:53 +00:00
on Thu Oct 09 2014 16:09:45 GMT+0100 (BST) using the < a href = "https://github.com/terryweiss/docstrap" > DocStrap template< / a > .
2013-10-02 00:16:40 +00:00
< / span >
< / footer >
< / div >
< br clear = "both" >
< / div >
< / div >
< script src = "scripts/sunlight.js" > < / script >
< script src = "scripts/sunlight.javascript.js" > < / script >
< script src = "scripts/sunlight-plugin.doclinks.js" > < / script >
< script src = "scripts/sunlight-plugin.linenumbers.js" > < / script >
< script src = "scripts/sunlight-plugin.menu.js" > < / script >
< script src = "scripts/jquery.min.js" > < / script >
< script src = "scripts/jquery.scrollTo.js" > < / script >
< script src = "scripts/jquery.localScroll.js" > < / script >
< script src = "scripts/bootstrap-dropdown.js" > < / script >
< script src = "scripts/toc.js" > < / script >
< script > Sunlight . highlightAll ( { lineNumbers : true , showMenu : true , enableDoclinks : true } ) ; < / script >
< script >
$( function () {
$( "#toc" ).toc( {
2014-04-10 22:13:43 +00:00
anchorName : function(i, heading, prefix) {
2014-03-14 06:36:05 +00:00
return $(heading).attr("id") || ( prefix + i );
},
2013-10-02 00:16:40 +00:00
selectors : "h1,h2,h3,h4",
showAndHide : false,
scrollTo : 60
} );
$( "#toc>ul" ).addClass( "nav nav-pills nav-stacked" );
$( "#main span[id^='toc']" ).addClass( "toc-shim" );
} );
< / script >
< / body >
< / html >