2013-10-03 01:38:35 +00:00
<!DOCTYPE html>
< html lang = "en" >
< head >
< meta charset = "utf-8" >
2014-11-15 20:01:46 +00:00
< title > Phaser Source: D:/wamp/www/phaser/src/tween/Tween.js< / title >
2013-10-03 01:38:35 +00:00
<!-- [if lt IE 9]>
< script src = "//html5shiv.googlecode.com/svn/trunk/html5.js" > < / script >
<![endif]-->
2014-11-15 20:01:46 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/default.css" >
2013-10-03 01:38:35 +00:00
< link type = "text/css" rel = "stylesheet" href = "styles/sunlight.default.css" >
< link type = "text/css" rel = "stylesheet" href = "styles/site.cerulean.css" >
< / head >
< body >
2014-11-25 00:23:44 +00:00
2013-10-03 01:38:35 +00:00
< div class = "container-fluid" >
< div class = "navbar navbar-fixed-top navbar-inverse" >
2014-11-25 00:23:44 +00:00
< div style = "position: absolute; width: 143px; height: 31px; right: 10px; top: 10px; z-index: 1050" > < a href = "http://phaser.io" > < img src = "img/phaser.png" border = "0" / > < / a > < / div >
2013-10-03 01:38:35 +00:00
< div class = "navbar-inner" >
2014-11-25 00:23:44 +00:00
< a class = "brand" href = "index.html" > Phaser API< / a >
2013-10-03 01:38:35 +00:00
< ul class = "nav" >
2014-11-25 00:23:44 +00:00
2013-10-03 01:38:35 +00:00
< li class = "dropdown" >
< a href = "namespaces.list.html" class = "dropdown-toggle" data-toggle = "dropdown" > Namespaces< b
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 >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-0" >
< a href = "PIXI.html" > PIXI< / a >
< / li >
2013-10-03 01:38:35 +00:00
< / 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-03 01:38:35 +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 >
< / 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 >
< / li >
2014-04-29 14:39:02 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayList.html" > ArrayList< / a >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArraySet.html" > ArraySet< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.ArrayUtils.html" > ArrayUtils< / 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 >
< / 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 >
< / 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 >
< / 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 >
< / 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 >
< / 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 >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.DOM.html" > DOM< / 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.Easing.html" > Easing< / 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 >
< / 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.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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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 >
< / 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.Math.html" > Math< / 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.Mouse.html" > Mouse< / 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.MSPointer.html" > MSPointer< / 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.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-03 01:38:35 +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-03 01:38:35 +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 >
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.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 >
< / 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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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 01:38:35 +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-03 01:38:35 +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 01:38:35 +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 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-03 01:38:35 +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-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "Phaser.TweenData.html" > TweenData< / 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-03 01:38:35 +00:00
< a href = "Phaser.World.html" > World< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.AbstractFilter.html" > AbstractFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.AjaxRequest.html" > AjaxRequest< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.AlphaMaskFilter.html" > AlphaMaskFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.AsciiFilter.html" > AsciiFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.AssetLoader.html" > AssetLoader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.AtlasLoader.html" > AtlasLoader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.BaseTexture.html" > BaseTexture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.BitmapFontLoader.html" > BitmapFontLoader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.BitmapText.html" > BitmapText< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.BlurFilter.html" > BlurFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.BlurXFilter.html" > BlurXFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.BlurYFilter.html" > BlurYFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasBuffer.html" > CanvasBuffer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasGraphics.html" > CanvasGraphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasMaskManager.html" > CanvasMaskManager< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasRenderer.html" > CanvasRenderer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CanvasTinter.html" > CanvasTinter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Circle.html" > Circle< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ColorMatrixFilter.html" > ColorMatrixFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ColorStepFilter.html" > ColorStepFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ComplexPrimitiveShader.html" > ComplexPrimitiveShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ConvolutionFilter.html" > ConvolutionFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.CrossHatchFilter.html" > CrossHatchFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DisplacementFilter.html" > DisplacementFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DisplayObject.html" > DisplayObject< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DisplayObjectContainer.html" > DisplayObjectContainer< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.DotScreenFilter.html" > DotScreenFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Ellipse.html" > Ellipse< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Event.html" > Event< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.EventTarget.html" > EventTarget< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.FilterBlock.html" > FilterBlock< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.FilterTexture.html" > FilterTexture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Graphics.html" > Graphics< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.GraphicsData.html" > GraphicsData< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.GrayFilter.html" > GrayFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.ImageLoader.html" > ImageLoader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.InteractionData.html" > InteractionData< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.InteractionManager.html" > InteractionManager< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.InvertFilter.html" > InvertFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.JsonLoader.html" > JsonLoader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Matrix.html" > Matrix< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.MovieClip.html" > MovieClip< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.NoiseFilter.html" > NoiseFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.NormalMapFilter.html" > NormalMapFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PixelateFilter.html" > PixelateFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PIXI.html" > PIXI< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PixiFastShader.html" > PixiFastShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PixiShader.html" > PixiShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Point.html" > Point< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Polygon.html" > Polygon< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PolyK.html" > PolyK< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.PrimitiveShader.html" > PrimitiveShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Rectangle.html" > Rectangle< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.RenderTexture.html" > RenderTexture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.RGBSplitFilter.html" > RGBSplitFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Rope.html" > Rope< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.RoundedRectangle.html" > RoundedRectangle< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.SepiaFilter.html" > SepiaFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.SmartBlurFilter.html" > SmartBlurFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Spine.html" > Spine< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.SpineLoader.html" > SpineLoader< / a >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.SpineTextureLoader.html" > SpineTextureLoader< / a >
< / li >
2014-11-15 20:01:46 +00:00
< li class = "class-depth-1" >
< a href = "PIXI.Sprite.html" > Sprite< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.SpriteBatch.html" > SpriteBatch< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.SpriteSheetLoader.html" > SpriteSheetLoader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Stage.html" > Stage< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Strip.html" > Strip< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.StripShader.html" > StripShader< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Text.html" > Text< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.Texture.html" > Texture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.TilingSprite.html" > TilingSprite< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.TiltShiftFilter.html" > TiltShiftFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.TiltShiftXFilter.html" > TiltShiftXFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.TiltShiftYFilter.html" > TiltShiftYFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.TwistFilter.html" > TwistFilter< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.VideoTexture.html" > VideoTexture< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.WebGLBlendModeManager.html" > WebGLBlendModeManager< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.WebGLFastSpriteBatch.html" > WebGLFastSpriteBatch< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.WebGLFilterManager.html" > WebGLFilterManager< / a >
< / li >
< li class = "class-depth-1" >
< a href = "PIXI.WebGLRenderer.html" > WebGLRenderer< / a >
< / li >
2013-10-03 01:38:35 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
2014-11-15 20:01:46 +00:00
< li class = "dropdown" >
2014-11-25 00:23:44 +00:00
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Core< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Game.html" > Game< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Group.html" > Group< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.World.html" > World< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Loader.html" > Loader< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Time.html" > Time< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Camera.html" > Camera< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.StateManager.html" > State Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TweenManager.html" > Tween Manager< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.SoundManager.html" > Sound Manager< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Input.html" > Input Manager< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.ScaleManager.html" > Scale Manager< / a > < / li >
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Game Objects< b class = "caret" > < / b > < / a >
2014-11-15 20:01:46 +00:00
< ul class = "dropdown-menu " >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.GameObjectFactory.html" > Factory (game.add)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.GameObjectCreator.html" > Creator (game.make)< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sprite.html" > Sprite< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Image.html" > Image< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Sound.html" > Sound< / a > < / li >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particles.Arcade.Emitter.html" > Particle Emitter< / a > < / li >
2014-12-03 10:39:11 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Particle.html" > Particle< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "Phaser.Text.html" > Text< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tween.html" > Tween< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapText.html" > BitmapText< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Tilemap.html" > Tilemap< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.BitmapData.html" > BitmapData< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RetroFont.html" > RetroFont< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Button.html" > Button< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Animation.html" > Animation< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Graphics.html" > Graphics< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.RenderTexture.html" > RenderTexture< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.TileSprite.html" > TileSprite< / a > < / li >
< / ul >
< / li >
2014-11-15 20:01:46 +00:00
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Geometry< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Circle.html" > Circle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Rectangle.html" > Rectangle< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Point.html" > Point< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Line.html" > Line< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Ellipse.html" > Ellipse< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Polygon.html" > Polygon< / a > < / li >
2014-11-15 20:01:46 +00:00
< / ul >
< / li >
2014-11-25 00:23:44 +00:00
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Physics< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Arcade.html" > Arcade Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Arcade.Body.html" > Body< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Physics.P2.html" > P2 Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Body.html" > Body< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.Spring.html" > Spring< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.CollisionGroup.html" > CollisionGroup< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.P2.ContactMaterial.html" > ContactMaterial< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Physics.Ninja.html" > Ninja Physics< / a > < / li >
< li class = "class-depth-2" > < a href = "Phaser.Physics.Body.html" > Body< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Input< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
< li class = "class-depth-1" > < a href = "Phaser.InputHandler.html" > Input Handler< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Pointer.html" > Pointer< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Mouse.html" > Mouse< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Keyboard.html" > Keyboard< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Key.html" > Key< / a > < / li >
< li class = "class-depth-1" > < a href = "Phaser.Gamepad.html" > Gamepad< / a > < / li >
< / ul >
< / li >
< li class = "dropdown" >
< a href = "#" class = "dropdown-toggle" data-toggle = "dropdown" > Community< b class = "caret" > < / b > < / a >
< ul class = "dropdown-menu " >
2015-01-06 06:57:25 +00:00
< li class = "class-depth-1" > < a href = "https://leanpub.com/u/photonstorm" > Phaser Books< / a > < / li >
2014-11-25 00:23:44 +00:00
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser" > Phaser Github< / a > < / li >
< li class = "class-depth-1" > < a href = "http://examples.phaser.io" > Phaser Examples< / a > < / li >
< li class = "class-depth-1" > < a href = "https://github.com/photonstorm/phaser-plugins" > Phaser Plugins< / a > < / li >
< li class = "class-depth-1" > < a href = "http://www.html5gamedevs.com/forum/14-phaser/" > Forum< / a > < / li >
< li class = "class-depth-1" > < a href = "http://stackoverflow.com/questions/tagged/phaser-framework" > Stack Overflow< / a > < / li >
< li class = "class-depth-1" > < a href = "https://confirmsubscription.com/h/r/369DE48E3E86AF1E" > Newsletter< / a > < / li >
< li class = "class-depth-1" > < a href = "https://twitter.com/photonstorm" > Twitter< / a > < / li >
< li class = "class-depth-1" > < a href = "http://www.html5gamedevs.com/topic/4470-official-phaserio-irc-channel-phaserio-on-freenode/" > IRC< / a > < / li >
< li class = "class-depth-1" > < a href = "https://www.gittip.com/photonstorm/" > GitTip< / a > < / li >
< / ul >
< / li >
2013-10-03 01:38:35 +00:00
< / ul >
< / div >
< / div >
< div class = "row-fluid" >
< div class = "span12" >
< div id = "main" >
2014-11-15 20:01:46 +00:00
< h1 class = "page-title" > Source: D:/wamp/www/phaser/src/tween/Tween.js< / h1 >
2013-10-03 01:38:35 +00:00
< 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-03 01:38:35 +00:00
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
2014-11-25 00:23:44 +00:00
* A Tween allows you to alter one or more properties of a target object over a defined period of time.
* This can be used for things such as alpha fading Sprites, scaling them or motion.
* Use `Tween.to` or `Tween.from` to set-up the tween values. You can create multiple tweens on the same object
* by calling Tween.to multiple times on the same Tween. Additional tweens specified in this way become "child" tweens and
* are played through in sequence. You can use Tween.timeScale and Tween.reverse to control the playback of this Tween and all of its children.
2013-10-03 01:38:35 +00:00
*
* @class Phaser.Tween
* @constructor
2014-11-25 00:23:44 +00:00
* @param {object} target - The target object, such as a Phaser.Sprite or Phaser.Sprite.scale.
2013-10-03 01:38:35 +00:00
* @param {Phaser.Game} game - Current game instance.
2014-03-14 06:36:05 +00:00
* @param {Phaser.TweenManager} manager - The TweenManager responsible for looking after this Tween.
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
Phaser.Tween = function (target, game, manager) {
2013-10-03 01:38:35 +00:00
/**
* @property {Phaser.Game} game - A reference to the currently running Game.
*/
this.game = game;
/**
2014-11-25 00:23:44 +00:00
* @property {object} target - The target object, such as a Phaser.Sprite or property like Phaser.Sprite.scale.
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.target = target;
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* @property {Phaser.TweenManager} manager - Reference to the TweenManager responsible for updating this Tween.
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.manager = manager;
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* @property {Array} timeline - An Array of TweenData objects that comprise the different parts of this Tween.
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.timeline = [];
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* If set to `true` the current tween will play in reverse.
* If the tween hasn't yet started this has no effect.
* If there are child tweens then all child tweens will play in reverse from the current point.
* @property {boolean} reverse
* @default
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.reverse = false;
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* The speed at which the tweens will run. A value of 1 means it will match the game frame rate. 0.5 will run at half the frame rate. 2 at double the frame rate, etc.
* If a tweens duration is 1 second but timeScale is 0.5 then it will take 2 seconds to complete.
*
* @property {number} timeScale
2013-10-03 01:38:35 +00:00
* @default
*/
2014-11-25 00:23:44 +00:00
this.timeScale = 1;
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* @property {number} repeatCounter - If the Tween and any child tweens are set to repeat this contains the current repeat count.
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.repeatCounter = 0;
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* @property {number} repeatDelay - The amount of time in ms between repeats of this tween and any child tweens.
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.repeatDelay = 0;
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* @property {boolean} pendingDelete - True if this Tween is ready to be deleted by the TweenManager.
2013-10-03 01:38:35 +00:00
* @default
2014-12-03 10:39:11 +00:00
* @readonly
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.pendingDelete = false;
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* The onStart event is fired when the Tween begins. If there is a delay before the tween starts then onStart fires after the delay is finished.
* It will be sent 2 parameters: the target object and this tween.
* @property {Phaser.Signal} onStart
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.onStart = new Phaser.Signal();
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* The onLoop event is fired if the Tween or any child tween loops.
* It will be sent 2 parameters: the target object and this tween.
* @property {Phaser.Signal} onLoop
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.onLoop = new Phaser.Signal();
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* The onRepeat event is fired if the Tween and all of its children repeats. If this tween has no children this will never be fired.
* It will be sent 2 parameters: the target object and this tween.
* @property {Phaser.Signal} onRepeat
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.onRepeat = new Phaser.Signal();
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* The onChildComplete event is fired when the Tween or any of its children completes.
* Fires every time a child completes unless a child is set to repeat forever.
* It will be sent 2 parameters: the target object and this tween.
* @property {Phaser.Signal} onChildComplete
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.onChildComplete = new Phaser.Signal();
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* The onComplete event is fired when the Tween and all of its children completes. Does not fire if the Tween is set to loop or repeatAll(-1).
* It will be sent 2 parameters: the target object and this tween.
* @property {Phaser.Signal} onComplete
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.onComplete = new Phaser.Signal();
2013-10-03 01:38:35 +00:00
/**
2014-11-25 00:23:44 +00:00
* @property {boolean} isRunning - If the tween is running this is set to true, otherwise false. Tweens that are in a delayed state or waiting to start are considered as being running.
* @default
*/
this.isRunning = false;
/**
* @property {number} current - The current Tween child being run.
2013-10-03 01:38:35 +00:00
* @default
2014-12-03 10:39:11 +00:00
* @readonly
2014-11-25 00:23:44 +00:00
*/
this.current = 0;
/**
2014-12-03 10:39:11 +00:00
* @property {object} properties - Target property cache used when building the child data values.
2014-11-25 00:23:44 +00:00
*/
this.properties = {};
/**
* @property {Phaser.Tween} chainedTween - If this Tween is chained to another this holds a reference to it.
2013-10-03 01:38:35 +00:00
*/
2014-11-25 00:23:44 +00:00
this.chainedTween = null;
/**
* @property {boolean} isPaused - Is this Tween paused or not?
* @default
*/
this.isPaused = false;
2013-10-03 01:38:35 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {function} _onUpdateCallback - An onUpdate callback.
2013-10-03 01:38:35 +00:00
* @private
* @default null
*/
this._onUpdateCallback = null;
2014-03-28 01:42:49 +00:00
2013-10-03 01:38:35 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {object} _onUpdateCallbackContext - The context in which to call the onUpdate callback.
2013-10-03 01:38:35 +00:00
* @private
* @default null
*/
2014-02-05 06:29:17 +00:00
this._onUpdateCallbackContext = null;
2013-10-03 01:38:35 +00:00
/**
2014-02-05 06:29:17 +00:00
* @property {number} _pausedTime - Private pause timer.
2013-10-03 01:38:35 +00:00
* @private
* @default
*/
this._pausedTime = 0;
2014-03-14 06:36:05 +00:00
/**
* @property {boolean} _codePaused - Was the Tween paused by code or by Game focus loss?
* @private
*/
this._codePaused = false;
2013-10-03 01:38:35 +00:00
};
Phaser.Tween.prototype = {
2013-11-28 15:57:09 +00:00
/**
2014-07-10 19:31:11 +00:00
* Sets this tween to be a `to` tween on the properties given. A `to` tween starts at the current value and tweens to the destination value given.
* For example a Sprite with an `x` coordinate of 100 could be tweened to `x` 200 by giving a properties object of `{ x: 200 }`.
2014-11-25 00:23:44 +00:00
* The ease function allows you define the rate of change. You can pass either a function such as Phaser.Easing.Circular.Out or a string such as "Circ".
* ".easeIn", ".easeOut" and "easeInOut" variants are all supported for all ease types.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#to
2014-11-25 00:23:44 +00:00
* @param {object} properties - An object containing the properties you want to tween., such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object.
2014-02-05 06:29:17 +00:00
* @param {number} [duration=1000] - Duration of this tween in ms.
2014-11-25 00:23:44 +00:00
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens.
2014-04-10 22:13:43 +00:00
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
2014-02-05 06:29:17 +00:00
* @return {Phaser.Tween} This Tween object.
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
to: function (properties, duration, ease, autoStart, delay, repeat, yoyo) {
2013-11-28 15:57:09 +00:00
2014-11-25 00:23:44 +00:00
if (typeof duration === 'undefined') { duration = 1000; }
if (typeof ease === 'undefined') { ease = Phaser.Easing.Default; }
if (typeof autoStart === 'undefined') { autoStart = false; }
if (typeof delay === 'undefined') { delay = 0; }
if (typeof repeat === 'undefined') { repeat = 0; }
if (typeof yoyo === 'undefined') { yoyo = false; }
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (typeof ease === 'string' & & this.manager.easeMap[ease])
2013-10-03 01:38:35 +00:00
{
2014-11-25 00:23:44 +00:00
ease = this.manager.easeMap[ease];
2013-10-03 01:38:35 +00:00
}
2014-11-25 00:23:44 +00:00
if (this.isRunning)
2013-10-03 01:38:35 +00:00
{
2014-11-25 00:23:44 +00:00
console.warn('Phaser.Tween.to cannot be called after Tween.start');
return this;
2014-11-15 20:01:46 +00:00
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
this.timeline.push(new Phaser.TweenData(this).to(properties, duration, ease, delay, repeat, yoyo));
2013-10-03 01:38:35 +00:00
2014-02-05 06:29:17 +00:00
if (autoStart)
{
2014-11-25 00:23:44 +00:00
this.start();
2013-10-03 01:38:35 +00:00
}
2014-11-25 00:23:44 +00:00
return this;
2013-11-28 15:57:09 +00:00
},
2013-10-03 01:38:35 +00:00
2014-05-20 09:12:48 +00:00
/**
2014-11-25 00:23:44 +00:00
* Sets this tween to be a `from` tween on the properties given. A `from` tween sets the target to the destination value and tweens to its current value.
* For example a Sprite with an `x` coordinate of 100 tweened from `x` 500 would be set to `x` 500 and then tweened to `x` 100 by giving a properties object of `{ x: 500 }`.
* The ease function allows you define the rate of change. You can pass either a function such as Phaser.Easing.Circular.Out or a string such as "Circ".
* ".easeIn", ".easeOut" and "easeInOut" variants are all supported for all ease types.
2014-05-20 09:12:48 +00:00
*
* @method Phaser.Tween#from
2014-11-25 00:23:44 +00:00
* @param {object} properties - An object containing the properties you want to tween., such as `Sprite.x` or `Sound.volume`. Given as a JavaScript object.
2014-05-20 09:12:48 +00:00
* @param {number} [duration=1000] - Duration of this tween in ms.
2014-11-25 00:23:44 +00:00
* @param {function|string} [ease=null] - Easing function. If not set it will default to Phaser.Easing.Default, which is Phaser.Easing.Linear.None by default but can be over-ridden.
* @param {boolean} [autoStart=false] - Set to `true` to allow this tween to start automatically. Otherwise call Tween.start().
* @param {number} [delay=0] - Delay before this tween will start in milliseconds. Defaults to 0, no delay.
* @param {number} [repeat=0] - Should the tween automatically restart once complete? If you want it to run forever set as -1. This only effects this induvidual tween, not any chained tweens.
2014-05-20 09:12:48 +00:00
* @param {boolean} [yoyo=false] - A tween that yoyos will reverse itself and play backwards automatically. A yoyo'd tween doesn't fire the Tween.onComplete event, so listen for Tween.onLoop instead.
* @return {Phaser.Tween} This Tween object.
*/
2014-11-25 00:23:44 +00:00
from: function (properties, duration, ease, autoStart, delay, repeat, yoyo) {
2014-07-10 19:31:11 +00:00
2014-11-25 00:23:44 +00:00
if (typeof duration === 'undefined') { duration = 1000; }
if (typeof ease === 'undefined') { ease = Phaser.Easing.Default; }
if (typeof autoStart === 'undefined') { autoStart = false; }
if (typeof delay === 'undefined') { delay = 0; }
if (typeof repeat === 'undefined') { repeat = 0; }
if (typeof yoyo === 'undefined') { yoyo = false; }
2014-07-10 19:31:11 +00:00
2014-11-25 00:23:44 +00:00
if (typeof ease === 'string' & & this.manager.easeMap[ease])
2014-07-10 19:31:11 +00:00
{
2014-11-25 00:23:44 +00:00
ease = this.manager.easeMap[ease];
2014-05-20 09:12:48 +00:00
}
2014-07-10 19:31:11 +00:00
2014-11-25 00:23:44 +00:00
if (this.isRunning)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
console.warn('Phaser.Tween.from cannot be called after Tween.start');
return this;
2013-10-03 01:38:35 +00:00
}
2014-11-25 00:23:44 +00:00
this.timeline.push(new Phaser.TweenData(this).from(properties, duration, ease, delay, repeat, yoyo));
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (autoStart)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
this.start();
2013-11-28 15:57:09 +00:00
}
2013-10-03 01:38:35 +00:00
2013-11-28 15:57:09 +00:00
return this;
2013-10-03 01:38:35 +00:00
2013-11-28 15:57:09 +00:00
},
2013-10-03 01:38:35 +00:00
2014-03-14 06:36:05 +00:00
/**
2014-11-25 00:23:44 +00:00
* Starts the tween running. Can also be called by the autoStart parameter of `Tween.to` or `Tween.from`.
* This sets the `Tween.isRunning` property to `true` and dispatches a `Tween.onStart` signal.
* If the Tween has a delay set then nothing will start tweening until the delay has expired.
2014-03-14 06:36:05 +00:00
*
2014-11-25 00:23:44 +00:00
* @method Phaser.Tween#start
* @param {number} [index=0] - If this Tween contains child tweens you can specify which one to start from. The default is zero, i.e. the first tween created.
* @return {Phaser.Tween} This tween. Useful for method chaining.
2014-03-14 06:36:05 +00:00
*/
2014-11-25 00:23:44 +00:00
start: function (index) {
2014-03-14 06:36:05 +00:00
2014-11-25 00:23:44 +00:00
if (typeof index === 'undefined') { index = 0; }
2014-03-14 06:36:05 +00:00
2014-11-25 00:23:44 +00:00
if (this.game === null || this.target === null || this.timeline.length === 0 || this.isRunning)
2014-03-14 06:36:05 +00:00
{
2014-11-25 00:23:44 +00:00
return this;
2014-03-14 06:36:05 +00:00
}
2014-11-25 00:23:44 +00:00
// Populate the tween data
for (var i = 0; i < this.timeline.length; i++)
2014-03-14 06:36:05 +00:00
{
2014-11-25 00:23:44 +00:00
// Build our master property list with the starting values
for (var property in this.timeline[i].vEnd)
2014-03-14 06:36:05 +00:00
{
2014-11-25 00:23:44 +00:00
this.properties[property] = this.target[property] || 0;
2014-03-14 06:36:05 +00:00
2014-11-25 00:23:44 +00:00
if (!Array.isArray(this.properties[property]))
2014-03-14 06:36:05 +00:00
{
2014-11-25 00:23:44 +00:00
// Ensures we're using numbers, not strings
this.properties[property] *= 1.0;
2014-03-14 06:36:05 +00:00
}
}
}
2014-11-25 00:23:44 +00:00
for (var i = 0; i < this.timeline.length; i++)
2014-09-09 14:36:56 +00:00
{
2014-11-25 00:23:44 +00:00
this.timeline[i].loadValues();
2014-09-09 14:36:56 +00:00
}
2014-11-25 00:23:44 +00:00
this.manager.add(this);
2014-09-09 14:36:56 +00:00
2014-11-25 00:23:44 +00:00
this.isRunning = true;
if (index < 0 || index > this.timeline.length - 1)
2014-03-14 06:36:05 +00:00
{
2014-11-25 00:23:44 +00:00
index = 0;
2014-03-14 06:36:05 +00:00
}
2014-11-25 00:23:44 +00:00
this.current = index;
2014-03-14 06:36:05 +00:00
2014-11-25 00:23:44 +00:00
this.timeline[this.current].start();
this.onStart.dispatch(this.target, this);
return this;
2014-03-14 06:36:05 +00:00
},
2013-11-28 15:57:09 +00:00
/**
2014-11-25 00:23:44 +00:00
* Stops the tween if running and flags it for deletion from the TweenManager.
* If called directly the `Tween.onComplete` signal is not dispatched and no chained tweens are started unless the complete parameter is set to `true`.
* If you just wish to pause a tween then use Tween.pause instead.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#stop
2014-11-25 00:23:44 +00:00
* @param {boolean} [complete=false] - Set to `true` to dispatch the Tween.onComplete signal.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-11-25 00:23:44 +00:00
stop: function (complete) {
if (typeof complete === 'undefined') { complete = false; }
2013-10-03 01:38:35 +00:00
this.isRunning = false;
2014-02-05 06:29:17 +00:00
this._onUpdateCallback = null;
2014-11-25 00:23:44 +00:00
this._onUpdateCallbackContext = null;
if (complete)
{
2015-01-06 06:57:25 +00:00
this.onComplete.dispatch(this.target, this);
2014-11-25 00:23:44 +00:00
if (this.chainedTween)
{
this.chainedTween.start();
}
}
2014-02-05 06:29:17 +00:00
2014-11-25 00:23:44 +00:00
this.manager.remove(this);
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-11-25 00:23:44 +00:00
* Sets the delay in milliseconds before this tween will start. If there are child tweens it sets the delay before the first child starts.
* The delay is invoked as soon as you call `Tween.start`. If the tween is already running this method doesn't do anything for the current active tween.
2015-01-06 06:57:25 +00:00
* If you have not yet called `Tween.to` or `Tween.from` at least once then this method will do nothing, as there are no tweens to delay.
2014-11-25 00:23:44 +00:00
* If you have child tweens and pass -1 as the index value it sets the delay across all of them.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#delay
2014-11-25 00:23:44 +00:00
* @param {number} duration - The amount of time in ms that the Tween should wait until it begins once started is called. Set to zero to remove any active delay.
* @param {number} [index=0] - If this tween has more than one child this allows you to target a specific child. If set to -1 it will set the delay on all the children.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-11-25 00:23:44 +00:00
delay: function (duration, index) {
2015-01-06 06:57:25 +00:00
if (this.timeline.length === 0) { return this; }
2014-11-25 00:23:44 +00:00
if (typeof index === 'undefined') { index = 0; }
2013-11-28 15:57:09 +00:00
2014-11-25 00:23:44 +00:00
if (index === -1)
{
for (var i = 0; i < this.timeline.length; i++)
{
this.timeline[i].delay = duration;
}
}
else
{
this.timeline[index].delay = duration;
}
2014-11-15 20:01:46 +00:00
2013-11-28 15:57:09 +00:00
return this;
},
/**
* Sets the number of times this tween will repeat.
2015-01-06 06:57:25 +00:00
* If you have not yet called `Tween.to` or `Tween.from` at least once then this method will do nothing, as there are no tweens to repeat.
2014-11-25 00:23:44 +00:00
* If you have child tweens and pass -1 as the index value it sets the number of times they'll repeat across all of them.
* If you wish to define how many times this Tween and all children will repeat see Tween.repeatAll.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#repeat
2014-11-25 00:23:44 +00:00
* @param {number} total - How many times a tween should repeat before completing. Set to zero to remove an active repeat. Set to -1 to repeat forever.
* @param {number} [index=0] - If this tween has more than one child this allows you to target a specific child. If set to -1 it will set the repeat value on all the children.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-11-25 00:23:44 +00:00
repeat: function (total, index) {
2013-11-28 15:57:09 +00:00
2015-01-06 06:57:25 +00:00
if (this.timeline.length === 0) { return this; }
2014-11-25 00:23:44 +00:00
if (typeof index === 'undefined') { index = 0; }
if (index === -1)
{
for (var i = 0; i < this.timeline.length; i++)
{
this.timeline[i].repeatCounter = total;
}
}
else
{
this.timeline[index].repeatCounter = total;
}
2014-04-29 14:39:02 +00:00
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-11-25 00:23:44 +00:00
* A Tween that has yoyo set to true will run through from its starting values to its end values and then play back in reverse from end to start.
2013-11-28 15:57:09 +00:00
* Used in combination with repeat you can create endless loops.
2015-01-06 06:57:25 +00:00
* If you have not yet called `Tween.to` or `Tween.from` at least once then this method will do nothing, as there are no tweens to yoyo.
2014-11-25 00:23:44 +00:00
* If you have child tweens and pass -1 as the index value it sets the yoyo property across all of them.
* If you wish to yoyo this Tween and all of its children then see Tween.yoyoAll.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#yoyo
2014-11-25 00:23:44 +00:00
* @param {boolean} enable - Set to true to yoyo this tween, or false to disable an already active yoyo.
* @param {number} [index=0] - If this tween has more than one child this allows you to target a specific child. If set to -1 it will set yoyo on all the children.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-11-25 00:23:44 +00:00
yoyo: function(enable, index) {
2013-11-28 15:57:09 +00:00
2015-01-06 06:57:25 +00:00
if (this.timeline.length === 0) { return this; }
2014-11-25 00:23:44 +00:00
if (typeof index === 'undefined') { index = 0; }
2014-04-29 14:39:02 +00:00
2014-11-25 00:23:44 +00:00
if (index === -1)
2014-04-29 14:39:02 +00:00
{
2014-11-25 00:23:44 +00:00
for (var i = 0; i < this.timeline.length; i++)
{
this.timeline[i].yoyo = enable;
}
}
else
{
this.timeline[index].yoyo = enable;
2014-04-29 14:39:02 +00:00
}
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-03-28 01:42:49 +00:00
* Set easing function this tween will use, i.e. Phaser.Easing.Linear.None.
2014-11-25 00:23:44 +00:00
* The ease function allows you define the rate of change. You can pass either a function such as Phaser.Easing.Circular.Out or a string such as "Circ".
* ".easeIn", ".easeOut" and "easeInOut" variants are all supported for all ease types.
* If you have child tweens and pass -1 as the index value it sets the easing function defined here across all of them.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#easing
2014-11-25 00:23:44 +00:00
* @param {function|string} ease - The easing function this tween will use, i.e. Phaser.Easing.Linear.None.
* @param {number} [index=0] - If this tween has more than one child this allows you to target a specific child. If set to -1 it will set the easing function on all children.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-11-25 00:23:44 +00:00
easing: function (ease, index) {
if (typeof index === 'undefined') { index = 0; }
if (typeof ease === 'string' & & this.manager.easeMap[ease])
{
ease = this.manager.easeMap[ease];
}
if (index === -1)
{
for (var i = 0; i < this.timeline.length; i++)
{
this.timeline[i].easingFunction = ease;
}
}
else
{
this.timeline[index].easingFunction = ease;
}
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-11-25 00:23:44 +00:00
* Sets the interpolation function the tween will use. By default it uses Phaser.Math.linearInterpolation.
2014-02-05 06:29:17 +00:00
* Also available: Phaser.Math.bezierInterpolation and Phaser.Math.catmullRomInterpolation.
2014-11-25 00:23:44 +00:00
* The interpolation function is only used if the target properties is an array.
* If you have child tweens and pass -1 as the index value it sets the interpolation function across all of them.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#interpolation
* @param {function} interpolation - The interpolation function to use (Phaser.Math.linearInterpolation by default)
2014-11-25 00:23:44 +00:00
* @param {number} [index=0] - If this tween has more than one child this allows you to target a specific child. If set to -1 it will set the easing function on all children.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-11-25 00:23:44 +00:00
interpolation: function (interpolation, index) {
if (typeof index === 'undefined') { index = 0; }
if (index === -1)
{
for (var i = 0; i < this.timeline.length; i++)
{
this.timeline[i].interpolationFunction = interpolation;
}
}
else
{
this.timeline[index].interpolationFunction = interpolation;
}
return this;
},
/**
* Set how many times this tween and all of its children will repeat.
* A tween (A) with 3 children (B,C,D) with a `repeatAll` value of 2 would play as: ABCDABCD before completing.
* When all child tweens have completed Tween.onLoop will be dispatched.
*
* @method Phaser.Tween#repeat
* @param {number} total - How many times this tween and all children should repeat before completing. Set to zero to remove an active repeat. Set to -1 to repeat forever.
* @return {Phaser.Tween} This tween. Useful for method chaining.
*/
repeatAll: function (total) {
if (typeof total === 'undefined') { total = 0; }
this.repeatCounter = total;
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-11-25 00:23:44 +00:00
* This method allows you to chain tweens together. Any tween chained to this tween will have its `Tween.start` method called
* as soon as this tween completes. If this tween never completes (i.e. repeatAll or loop is set) then the chain will never progress.
* Note that `Tween.onComplete` will fire when *this* tween completes, not when the whole chain completes.
* For that you should listen to `onComplete` on the final tween in your chain.
*
* If you pass multiple tweens to this method they will be joined into a single long chain.
* For example if this is Tween A and you pass in B, C and D then B will be chained to A, C will be chained to B and D will be chained to C.
* Any previously chained tweens that may have been set will be overwritten.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#chain
2014-11-25 00:23:44 +00:00
* @param {...Phaser.Tween} tweens - One or more tweens that will be chained to this one.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
chain: function () {
2014-11-25 00:23:44 +00:00
var i = arguments.length;
while (i--)
{
if (i > 0)
{
arguments[i - 1].chainedTween = arguments[i];
}
else
{
this.chainedTween = arguments[i];
}
}
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-11-25 00:23:44 +00:00
* Enables the looping of this tween and all child tweens. If this tween has no children this setting has no effect.
* If `value` is `true` then this is the same as setting `Tween.repeatAll(-1)`.
* If `value` is `false` it is the same as setting `Tween.repeatAll(0)` and will reset the `repeatCounter` to zero.
2014-03-28 01:42:49 +00:00
*
2013-11-28 15:57:09 +00:00
* Usage:
* game.add.tween(p).to({ x: 700 }, 1000, Phaser.Easing.Linear.None, true)
* .to({ y: 300 }, 1000, Phaser.Easing.Linear.None)
* .to({ x: 0 }, 1000, Phaser.Easing.Linear.None)
* .to({ y: 0 }, 1000, Phaser.Easing.Linear.None)
* .loop();
* @method Phaser.Tween#loop
2014-11-25 00:23:44 +00:00
* @param {boolean} [value=true] - If `true` this tween and any child tweens will loop once they reach the end. Set to `false` to remove an active loop.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-11-25 00:23:44 +00:00
loop: function (value) {
if (typeof value === 'undefined') { value = true; }
if (value)
{
this.repeatAll(-1);
}
else
{
this.repeatCounter = 0;
}
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-07-10 19:31:11 +00:00
* Sets a callback to be fired each time this tween updates.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#onUpdateCallback
2014-11-25 00:23:44 +00:00
* @param {function} callback - The callback to invoke each time this tween is updated. Set to `null` to remove an already active callback.
2014-07-10 19:31:11 +00:00
* @param {object} callbackContext - The context in which to call the onUpdate callback.
2014-11-15 20:01:46 +00:00
* @return {Phaser.Tween} This tween. Useful for method chaining.
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
onUpdateCallback: function (callback, callbackContext) {
2013-11-28 15:57:09 +00:00
this._onUpdateCallback = callback;
2014-02-05 06:29:17 +00:00
this._onUpdateCallbackContext = callbackContext;
2013-11-28 15:57:09 +00:00
return this;
},
/**
2014-11-25 00:23:44 +00:00
* Pauses the tween. Resume playback with Tween.resume.
2013-11-28 15:57:09 +00:00
*
* @method Phaser.Tween#pause
*/
2013-10-03 01:38:35 +00:00
pause: function () {
2014-02-05 06:29:17 +00:00
2014-11-25 00:23:44 +00:00
this.isPaused = true;
2014-03-14 06:36:05 +00:00
this._codePaused = true;
2014-11-25 00:23:44 +00:00
this._pausedTime = this.game.time.time;
2014-02-05 06:29:17 +00:00
2013-10-03 01:38:35 +00:00
},
2014-03-14 06:36:05 +00:00
/**
* This is called by the core Game loop. Do not call it directly, instead use Tween.pause.
2014-11-25 00:23:44 +00:00
*
2014-03-14 06:36:05 +00:00
* @private
2014-11-25 00:23:44 +00:00
* @method Phaser.Tween#_pause
2014-03-14 06:36:05 +00:00
*/
_pause: function () {
2014-03-28 01:42:49 +00:00
2014-03-14 06:36:05 +00:00
if (!this._codePaused)
{
2014-11-25 00:23:44 +00:00
this.isPaused = true;
this._pausedTime = this.game.time.time;
2014-03-14 06:36:05 +00:00
}
},
2013-11-28 15:57:09 +00:00
/**
* Resumes a paused tween.
*
* @method Phaser.Tween#resume
*/
2013-10-03 01:38:35 +00:00
resume: function () {
2014-02-05 06:29:17 +00:00
2014-11-25 00:23:44 +00:00
if (this.isPaused)
2014-03-14 06:36:05 +00:00
{
2014-11-25 00:23:44 +00:00
this.isPaused = false;
2014-03-14 06:36:05 +00:00
this._codePaused = false;
2014-11-25 00:23:44 +00:00
for (var i = 0; i < this.timeline.length; i++)
{
if (!this.timeline[i].isRunning)
{
this.timeline[i].startTime += (this.game.time.time - this._pausedTime);
}
}
2014-03-14 06:36:05 +00:00
}
},
/**
* This is called by the core Game loop. Do not call it directly, instead use Tween.pause.
* @method Phaser.Tween#_resume
* @private
*/
_resume: function () {
if (this._codePaused)
{
return;
}
else
{
2014-11-25 00:23:44 +00:00
this.resume();
2014-03-14 06:36:05 +00:00
}
2014-02-05 06:29:17 +00:00
2013-10-03 01:38:35 +00:00
},
2013-11-28 15:57:09 +00:00
/**
* Core tween update function called by the TweenManager. Does not need to be invoked directly.
*
* @method Phaser.Tween#update
* @param {number} time - A timestamp passed in by the TweenManager.
2014-11-25 00:23:44 +00:00
* @return {boolean} false if the tween and all child tweens have completed and should be deleted from the manager, otherwise true (still active).
2013-11-28 15:57:09 +00:00
*/
2014-02-05 06:29:17 +00:00
update: function (time) {
2013-10-03 01:38:35 +00:00
2013-11-28 15:57:09 +00:00
if (this.pendingDelete)
{
return false;
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (this.isPaused)
2014-02-05 06:29:17 +00:00
{
2013-10-03 01:38:35 +00:00
return true;
}
2014-11-25 00:23:44 +00:00
var status = this.timeline[this.current].update(time);
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (status === Phaser.TweenData.PENDING)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
return true;
2013-11-28 15:57:09 +00:00
}
2014-11-25 00:23:44 +00:00
else if (status === Phaser.TweenData.RUNNING)
{
if (this._onUpdateCallback !== null)
{
this._onUpdateCallback.call(this._onUpdateCallbackContext, this, this.timeline[this.current].value, this.timeline[this.current]);
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
// In case the update callback modifies this tween
return this.isRunning;
}
else if (status === Phaser.TweenData.LOOPED)
{
this.onLoop.dispatch(this.target, this);
return true;
}
else if (status === Phaser.TweenData.COMPLETE)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
var complete = false;
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
// What now?
if (this.reverse)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
this.current--;
if (this.current < 0)
{
this.current = this.timeline.length - 1;
complete = true;
}
2014-02-05 06:29:17 +00:00
}
else
{
2014-11-25 00:23:44 +00:00
this.current++;
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (this.current === this.timeline.length)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
this.current = 0;
complete = true;
2013-11-28 15:57:09 +00:00
}
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (complete)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
// We've reached the start or end of the child tweens (depending on Tween.reverse), should we repeat it?
if (this.repeatCounter === -1)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
this.timeline[this.current].start();
this.onRepeat.dispatch(this.target, this);
return true;
2013-11-28 15:57:09 +00:00
}
2014-11-25 00:23:44 +00:00
else if (this.repeatCounter > 0)
{
this.repeatCounter--;
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
this.timeline[this.current].start();
this.onRepeat.dispatch(this.target, this);
return true;
}
else
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
// No more repeats and no more children, so we're done
this.isRunning = false;
this.onComplete.dispatch(this.target, this);
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (this.chainedTween)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
this.chainedTween.start();
2013-11-28 15:57:09 +00:00
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
return false;
2013-11-28 15:57:09 +00:00
}
2014-11-25 00:23:44 +00:00
}
else
{
// We've still got some children to go
this.onChildComplete.dispatch(this.target, this);
this.timeline[this.current].start();
return true;
}
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
},
/**
* This will generate an array populated with the tweened object values from start to end.
* It works by running the tween simulation at the given frame rate based on the values set-up in Tween.to and Tween.from.
* It ignores delay and repeat counts and any chained tweens, but does include child tweens.
* Just one play through of the tween data is returned, including yoyo if set.
*
* @method Phaser.Tween#generateData
* @param {number} [frameRate=60] - The speed in frames per second that the data should be generated at. The higher the value, the larger the array it creates.
* @param {array} [data] - If given the generated data will be appended to this array, otherwise a new array will be returned.
* @return {array} An array of tweened values.
*/
generateData: function (frameRate, data) {
2014-05-20 09:12:48 +00:00
2014-11-25 00:23:44 +00:00
if (this.game === null || this.target === null)
{
return null;
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (typeof data === 'undefined') { data = []; }
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
// Populate the tween data
for (var i = 0; i < this.timeline.length; i++)
{
// Build our master property list with the starting values
for (var property in this.timeline[i].vEnd)
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
this.properties[property] = this.target[property] || 0;
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
if (!Array.isArray(this.properties[property]))
2014-02-05 06:29:17 +00:00
{
2014-11-25 00:23:44 +00:00
// Ensures we're using numbers, not strings
this.properties[property] *= 1.0;
2013-11-28 15:57:09 +00:00
}
}
2014-11-25 00:23:44 +00:00
}
for (var i = 0; i < this.timeline.length; i++)
{
this.timeline[i].loadValues();
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
for (var i = 0; i < this.timeline.length; i++)
{
data = data.concat(this.timeline[i].generateData(frameRate));
2013-11-28 15:57:09 +00:00
}
2013-10-03 01:38:35 +00:00
2014-11-25 00:23:44 +00:00
return data;
2013-10-03 01:38:35 +00:00
2013-11-28 15:57:09 +00:00
}
2014-03-28 01:42:49 +00:00
2013-10-03 01:38:35 +00:00
};
2014-02-05 06:29:17 +00:00
2014-11-25 00:23:44 +00:00
/**
* @name Phaser.Tween#totalDuration
* @property {Phaser.TweenData} totalDuration - Gets the total duration of this Tween, including all child tweens, in milliseconds.
*/
Object.defineProperty(Phaser.Tween.prototype, 'totalDuration', {
get: function () {
var total = 0;
for (var i = 0; i < this.timeline.length; i++)
{
total += this.timeline[i].duration;
}
return total;
}
});
2014-02-05 06:29:17 +00:00
Phaser.Tween.prototype.constructor = Phaser.Tween;
2013-10-03 01:38:35 +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-03 01:38:35 +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 >
2015-01-06 06:57:25 +00:00
on Tue Jan 06 2015 06:31:49 GMT-0000 (GMT) using the < a href = "https://github.com/terryweiss/docstrap" > DocStrap template< / a > .
2013-10-03 01:38:35 +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-03 01:38:35 +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 >