<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Phaser Class: Math</title> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/default.css"> <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 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> <div class="navbar-inner"> <a class="brand" href="index.html">Phaser API</a> <ul class="nav"> <li class="dropdown"> <a href="namespaces.list.html" class="dropdown-toggle" data-toggle="dropdown">Namespaces<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-0"> <a href="Phaser.html">Phaser</a> </li> <li class="class-depth-0"> <a href="PIXI.html">PIXI</a> </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 "> <li class="class-depth-0"> <a href="EarCut.html">EarCut</a> </li> <li class="class-depth-0"> <a href="Event.html">Event</a> </li> <li class="class-depth-0"> <a href="EventTarget.html">EventTarget</a> </li> <li class="class-depth-1"> <a href="Phaser.Animation.html">Animation</a> </li> <li class="class-depth-1"> <a href="Phaser.AnimationManager.html">AnimationManager</a> </li> <li class="class-depth-1"> <a href="Phaser.AnimationParser.html">AnimationParser</a> </li> <li class="class-depth-1"> <a href="Phaser.ArraySet.html">ArraySet</a> </li> <li class="class-depth-1"> <a href="Phaser.ArrayUtils.html">ArrayUtils</a> </li> <li class="class-depth-1"> <a href="Phaser.AudioSprite.html">AudioSprite</a> </li> <li class="class-depth-1"> <a href="Phaser.BitmapData.html">BitmapData</a> </li> <li class="class-depth-1"> <a href="Phaser.BitmapText.html">BitmapText</a> </li> <li class="class-depth-1"> <a href="Phaser.Bullet.html">Bullet</a> </li> <li class="class-depth-1"> <a href="Phaser.Button.html">Button</a> </li> <li class="class-depth-1"> <a href="Phaser.Cache.html">Cache</a> </li> <li class="class-depth-1"> <a href="Phaser.Camera.html">Camera</a> </li> <li class="class-depth-1"> <a href="Phaser.Canvas.html">Canvas</a> </li> <li class="class-depth-1"> <a href="Phaser.CanvasPool.html">CanvasPool</a> </li> <li class="class-depth-1"> <a href="Phaser.Circle.html">Circle</a> </li> <li class="class-depth-1"> <a href="Phaser.Color.html">Color</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Angle.html">Angle</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Animation.html">Animation</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.AutoCull.html">AutoCull</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Bounds.html">Bounds</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.BringToTop.html">BringToTop</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Core.html">Core</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Crop.html">Crop</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Delta.html">Delta</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Destroy.html">Destroy</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.FixedToCamera.html">FixedToCamera</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Health.html">Health</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.InCamera.html">InCamera</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.InputEnabled.html">InputEnabled</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.InWorld.html">InWorld</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.LifeSpan.html">LifeSpan</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.LoadTexture.html">LoadTexture</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Overlap.html">Overlap</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.PhysicsBody.html">PhysicsBody</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Reset.html">Reset</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.ScaleMinMax.html">ScaleMinMax</a> </li> <li class="class-depth-2"> <a href="Phaser.Component.Smoothed.html">Smoothed</a> </li> <li class="class-depth-1"> <a href="Phaser.Create.html">Create</a> </li> <li class="class-depth-1"> <a href="Phaser.Creature.html">Creature</a> </li> <li class="class-depth-1"> <a href="Phaser.Device.html">Device</a> </li> <li class="class-depth-1"> <a href="Phaser.DeviceButton.html">DeviceButton</a> </li> <li class="class-depth-1"> <a href="Phaser.DOM.html">DOM</a> </li> <li class="class-depth-1"> <a href="Phaser.Easing.html">Easing</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Back.html">Back</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Bounce.html">Bounce</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Circular.html">Circular</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Cubic.html">Cubic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Elastic.html">Elastic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Exponential.html">Exponential</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Linear.html">Linear</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Quadratic.html">Quadratic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Quartic.html">Quartic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Quintic.html">Quintic</a> </li> <li class="class-depth-2"> <a href="Phaser.Easing.Sinusoidal.html">Sinusoidal</a> </li> <li class="class-depth-1"> <a href="Phaser.Ellipse.html">Ellipse</a> </li> <li class="class-depth-1"> <a href="Phaser.Events.html">Events</a> </li> <li class="class-depth-1"> <a href="Phaser.Filter.html">Filter</a> </li> <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> <li class="class-depth-1"> <a href="Phaser.Frame.html">Frame</a> </li> <li class="class-depth-1"> <a href="Phaser.FrameData.html">FrameData</a> </li> <li class="class-depth-1"> <a href="Phaser.Game.html">Game</a> </li> <li class="class-depth-1"> <a href="Phaser.GameObjectCreator.html">GameObjectCreator</a> </li> <li class="class-depth-1"> <a href="Phaser.GameObjectFactory.html">GameObjectFactory</a> </li> <li class="class-depth-1"> <a href="Phaser.Gamepad.html">Gamepad</a> </li> <li class="class-depth-1"> <a href="Phaser.Graphics.html">Graphics</a> </li> <li class="class-depth-1"> <a href="Phaser.Group.html">Group</a> </li> <li class="class-depth-1"> <a href="Phaser.Hermite.html">Hermite</a> </li> <li class="class-depth-1"> <a href="Phaser.Image.html">Image</a> </li> <li class="class-depth-1"> <a href="Phaser.ImageCollection.html">ImageCollection</a> </li> <li class="class-depth-1"> <a href="Phaser.Input.html">Input</a> </li> <li class="class-depth-1"> <a href="Phaser.InputHandler.html">InputHandler</a> </li> <li class="class-depth-1"> <a href="Phaser.Key.html">Key</a> </li> <li class="class-depth-1"> <a href="Phaser.Keyboard.html">Keyboard</a> </li> <li class="class-depth-1"> <a href="Phaser.KeyCode.html">KeyCode</a> </li> <li class="class-depth-1"> <a href="Phaser.Line.html">Line</a> </li> <li class="class-depth-1"> <a href="Phaser.LinkedList.html">LinkedList</a> </li> <li class="class-depth-1"> <a href="Phaser.Loader.html">Loader</a> </li> <li class="class-depth-1"> <a href="Phaser.LoaderParser.html">LoaderParser</a> </li> <li class="class-depth-1"> <a href="Phaser.Math.html">Math</a> </li> <li class="class-depth-1"> <a href="Phaser.Matrix.html">Matrix</a> </li> <li class="class-depth-1"> <a href="Phaser.Mouse.html">Mouse</a> </li> <li class="class-depth-1"> <a href="Phaser.MSPointer.html">MSPointer</a> </li> <li class="class-depth-1"> <a href="Phaser.Net.html">Net</a> </li> <li class="class-depth-1"> <a href="Phaser.Particle.html">Particle</a> </li> <li class="class-depth-1"> <a href="Phaser.Particles.html">Particles</a> </li> <li class="class-depth-2"> <a href="Phaser.Particles.Arcade.html">Arcade</a> </li> <li class="class-depth-3"> <a href="Phaser.Particles.Arcade.Emitter.html">Emitter</a> </li> <li class="class-depth-1"> <a href="Phaser.Path.html">Path</a> </li> <li class="class-depth-1"> <a href="Phaser.PathFollower.html">PathFollower</a> </li> <li class="class-depth-1"> <a href="Phaser.PathPoint.html">PathPoint</a> </li> <li class="class-depth-1"> <a href="Phaser.Physics.html">Physics</a> </li> <li class="class-depth-2"> <a href="Phaser.Physics.Arcade.html">Arcade</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Arcade.Body.html">Body</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Arcade.TilemapCollision.html">TilemapCollision</a> </li> <li class="class-depth-2"> <a href="Phaser.Physics.Ninja.html">Ninja</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.AABB.html">AABB</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.Body.html">Body</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.Circle.html">Circle</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.Ninja.Tile.html">Tile</a> </li> <li class="class-depth-2"> <a href="Phaser.Physics.P2.html">P2</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.Body.html">Body</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.BodyDebug.html">BodyDebug</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.DistanceConstraint.html">DistanceConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.FixtureList.html">FixtureList</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.GearConstraint.html">GearConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.InversePointProxy.html">InversePointProxy</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.LockConstraint.html">LockConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.Material.html">Material</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.PointProxy.html">PointProxy</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.PrismaticConstraint.html">PrismaticConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.RevoluteConstraint.html">RevoluteConstraint</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.RotationalSpring.html">RotationalSpring</a> </li> <li class="class-depth-3"> <a href="Phaser.Physics.P2.Spring.html">Spring</a> </li> <li class="class-depth-1"> <a href="Phaser.Plugin.html">Plugin</a> </li> <li class="class-depth-2"> <a href="Phaser.Plugin.PathManager.html">PathManager</a> </li> <li class="class-depth-1"> <a href="Phaser.PluginManager.html">PluginManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Point.html">Point</a> </li> <li class="class-depth-1"> <a href="Phaser.Pointer.html">Pointer</a> </li> <li class="class-depth-1"> <a href="Phaser.PointerMode.html">PointerMode</a> </li> <li class="class-depth-1"> <a href="Phaser.Polygon.html">Polygon</a> </li> <li class="class-depth-1"> <a href="Phaser.QuadTree.html">QuadTree</a> </li> <li class="class-depth-1"> <a href="Phaser.RandomDataGenerator.html">RandomDataGenerator</a> </li> <li class="class-depth-1"> <a href="Phaser.Rectangle.html">Rectangle</a> </li> <li class="class-depth-1"> <a href="Phaser.RenderTexture.html">RenderTexture</a> </li> <li class="class-depth-1"> <a href="Phaser.RequestAnimationFrame.html">RequestAnimationFrame</a> </li> <li class="class-depth-1"> <a href="Phaser.RetroFont.html">RetroFont</a> </li> <li class="class-depth-1"> <a href="Phaser.Rope.html">Rope</a> </li> <li class="class-depth-1"> <a href="Phaser.RoundedRectangle.html">RoundedRectangle</a> </li> <li class="class-depth-1"> <a href="Phaser.ScaleManager.html">ScaleManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Signal.html">Signal</a> </li> <li class="class-depth-1"> <a href="Phaser.SignalBinding.html">SignalBinding</a> </li> <li class="class-depth-1"> <a href="Phaser.SinglePad.html">SinglePad</a> </li> <li class="class-depth-1"> <a href="Phaser.Sound.html">Sound</a> </li> <li class="class-depth-1"> <a href="Phaser.SoundManager.html">SoundManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Sprite.html">Sprite</a> </li> <li class="class-depth-1"> <a href="Phaser.SpriteBatch.html">SpriteBatch</a> </li> <li class="class-depth-1"> <a href="Phaser.Stage.html">Stage</a> </li> <li class="class-depth-1"> <a href="Phaser.State.html">State</a> </li> <li class="class-depth-1"> <a href="Phaser.StateManager.html">StateManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Text.html">Text</a> </li> <li class="class-depth-1"> <a href="Phaser.Tile.html">Tile</a> </li> <li class="class-depth-1"> <a href="Phaser.Tilemap.html">Tilemap</a> </li> <li class="class-depth-1"> <a href="Phaser.TilemapLayer.html">TilemapLayer</a> </li> <li class="class-depth-1"> <a href="Phaser.TilemapParser.html">TilemapParser</a> </li> <li class="class-depth-1"> <a href="Phaser.Tileset.html">Tileset</a> </li> <li class="class-depth-1"> <a href="Phaser.TileSprite.html">TileSprite</a> </li> <li class="class-depth-1"> <a href="Phaser.Time.html">Time</a> </li> <li class="class-depth-1"> <a href="Phaser.Timer.html">Timer</a> </li> <li class="class-depth-1"> <a href="Phaser.TimerEvent.html">TimerEvent</a> </li> <li class="class-depth-1"> <a href="Phaser.Touch.html">Touch</a> </li> <li class="class-depth-1"> <a href="Phaser.Tween.html">Tween</a> </li> <li class="class-depth-1"> <a href="Phaser.TweenData.html">TweenData</a> </li> <li class="class-depth-1"> <a href="Phaser.TweenManager.html">TweenManager</a> </li> <li class="class-depth-1"> <a href="Phaser.Utils.html">Utils</a> </li> <li class="class-depth-2"> <a href="Phaser.Utils.Debug.html">Debug</a> </li> <li class="class-depth-1"> <a href="Phaser.Video.html">Video</a> </li> <li class="class-depth-1"> <a href="Phaser.Weapon.html">Weapon</a> </li> <li class="class-depth-1"> <a href="Phaser.World.html">World</a> </li> <li class="class-depth-1"> <a href="PIXI.BaseTexture.html">BaseTexture</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.ComplexPrimitiveShader.html">ComplexPrimitiveShader</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.FilterTexture.html">FilterTexture</a> </li> <li class="class-depth-2"> <a href="PIXI.Phaser.GraphicsData.html">Phaser.GraphicsData</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.PrimitiveShader.html">PrimitiveShader</a> </li> <li class="class-depth-1"> <a href="PIXI.Sprite.html">Sprite</a> </li> <li class="class-depth-1"> <a href="PIXI.StripShader.html">StripShader</a> </li> <li class="class-depth-1"> <a href="PIXI.Texture.html">Texture</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> </ul> </li> <li class="dropdown"> <a href="global.html" class="dropdown-toggle" data-toggle="dropdown">Global<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-0"> <a href="global.html#ANGLE_DOWN">ANGLE_DOWN</a> </li> <li class="class-depth-0"> <a href="global.html#ANGLE_LEFT">ANGLE_LEFT</a> </li> <li class="class-depth-0"> <a href="global.html#ANGLE_NORTH_EAST">ANGLE_NORTH_EAST</a> </li> <li class="class-depth-0"> <a href="global.html#ANGLE_NORTH_WEST">ANGLE_NORTH_WEST</a> </li> <li class="class-depth-0"> <a href="global.html#ANGLE_RIGHT">ANGLE_RIGHT</a> </li> <li class="class-depth-0"> <a href="global.html#ANGLE_SOUTH_EAST">ANGLE_SOUTH_EAST</a> </li> <li class="class-depth-0"> <a href="global.html#ANGLE_SOUTH_WEST">ANGLE_SOUTH_WEST</a> </li> <li class="class-depth-0"> <a href="global.html#ANGLE_UP">ANGLE_UP</a> </li> <li class="class-depth-0"> <a href="global.html#arc">arc</a> </li> <li class="class-depth-0"> <a href="global.html#AUTO">AUTO</a> </li> <li class="class-depth-0"> <a href="global.html#beginFill">beginFill</a> </li> <li class="class-depth-0"> <a href="global.html#bezierCurveTo">bezierCurveTo</a> </li> <li class="class-depth-0"> <a href="global.html#BITMAPDATA">BITMAPDATA</a> </li> <li class="class-depth-0"> <a href="global.html#BITMAPTEXT">BITMAPTEXT</a> </li> <li class="class-depth-0"> <a href="global.html#blendModes">blendModes</a> </li> <li class="class-depth-0"> <a href="global.html#BOTTOM_CENTER">BOTTOM_CENTER</a> </li> <li class="class-depth-0"> <a href="global.html#BOTTOM_LEFT">BOTTOM_LEFT</a> </li> <li class="class-depth-0"> <a href="global.html#BOTTOM_RIGHT">BOTTOM_RIGHT</a> </li> <li class="class-depth-0"> <a href="global.html#BUTTON">BUTTON</a> </li> <li class="class-depth-0"> <a href="global.html#CANVAS">CANVAS</a> </li> <li class="class-depth-0"> <a href="global.html#CANVAS_FILTER">CANVAS_FILTER</a> </li> <li class="class-depth-0"> <a href="global.html#CENTER">CENTER</a> </li> <li class="class-depth-0"> <a href="global.html#CIRCLE">CIRCLE</a> </li> <li class="class-depth-0"> <a href="global.html#clear">clear</a> </li> <li class="class-depth-0"> <a href="global.html#CREATURE">CREATURE</a> </li> <li class="class-depth-0"> <a href="global.html#destroyCachedSprite">destroyCachedSprite</a> </li> <li class="class-depth-0"> <a href="global.html#displayList">displayList</a> </li> <li class="class-depth-0"> <a href="global.html#DOWN">DOWN</a> </li> <li class="class-depth-0"> <a href="global.html#drawCircle">drawCircle</a> </li> <li class="class-depth-0"> <a href="global.html#drawEllipse">drawEllipse</a> </li> <li class="class-depth-0"> <a href="global.html#drawPolygon">drawPolygon</a> </li> <li class="class-depth-0"> <a href="global.html#drawRect">drawRect</a> </li> <li class="class-depth-0"> <a href="global.html#drawRoundedRect">drawRoundedRect</a> </li> <li class="class-depth-0"> <a href="global.html#drawShape">drawShape</a> </li> <li class="class-depth-0"> <a href="global.html#ELLIPSE">ELLIPSE</a> </li> <li class="class-depth-0"> <a href="global.html#emit">emit</a> </li> <li class="class-depth-0"> <a href="global.html#EMITTER">EMITTER</a> </li> <li class="class-depth-0"> <a href="global.html#endFill">endFill</a> </li> <li class="class-depth-0"> <a href="global.html#GAMES">GAMES</a> </li> <li class="class-depth-0"> <a href="global.html#generateTexture">generateTexture</a> </li> <li class="class-depth-0"> <a href="global.html#getBounds">getBounds</a> </li> <li class="class-depth-0"> <a href="global.html#getLocalBounds">getLocalBounds</a> </li> <li class="class-depth-0"> <a href="global.html#GRAPHICS">GRAPHICS</a> </li> <li class="class-depth-0"> <a href="global.html#GROUP">GROUP</a> </li> <li class="class-depth-0"> <a href="global.html#HEADLESS">HEADLESS</a> </li> <li class="class-depth-0"> <a href="global.html#HORIZONTAL">HORIZONTAL</a> </li> <li class="class-depth-0"> <a href="global.html#IMAGE">IMAGE</a> </li> <li class="class-depth-0"> <a href="global.html#LANDSCAPE">LANDSCAPE</a> </li> <li class="class-depth-0"> <a href="global.html#LEFT">LEFT</a> </li> <li class="class-depth-0"> <a href="global.html#LEFT_BOTTOM">LEFT_BOTTOM</a> </li> <li class="class-depth-0"> <a href="global.html#LEFT_CENTER">LEFT_CENTER</a> </li> <li class="class-depth-0"> <a href="global.html#LEFT_TOP">LEFT_TOP</a> </li> <li class="class-depth-0"> <a href="global.html#LINE">LINE</a> </li> <li class="class-depth-0"> <a href="global.html#lineStyle">lineStyle</a> </li> <li class="class-depth-0"> <a href="global.html#lineTo">lineTo</a> </li> <li class="class-depth-0"> <a href="global.html#listeners">listeners</a> </li> <li class="class-depth-0"> <a href="global.html#MATRIX">MATRIX</a> </li> <li class="class-depth-0"> <a href="global.html#mixin">mixin</a> </li> <li class="class-depth-0"> <a href="global.html#moveTo">moveTo</a> </li> <li class="class-depth-0"> <a href="global.html#NONE">NONE</a> </li> <li class="class-depth-0"> <a href="global.html#off">off</a> </li> <li class="class-depth-0"> <a href="global.html#on">on</a> </li> <li class="class-depth-0"> <a href="global.html#once">once</a> </li> <li class="class-depth-0"> <a href="global.html#PENDING_ATLAS">PENDING_ATLAS</a> </li> <li class="class-depth-2"> <a href="global.html#Phaser.Path#numPointsreturn%257Bnumber%257DThetotalnumberofPathPointsinthisPath.">Phaser.Path#numPoints return {number} The total number of PathPoints in this Path.</a> </li> <li class="class-depth-0"> <a href="global.html#POINT">POINT</a> </li> <li class="class-depth-0"> <a href="global.html#POINTER">POINTER</a> </li> <li class="class-depth-0"> <a href="global.html#POLYGON">POLYGON</a> </li> <li class="class-depth-0"> <a href="global.html#PORTRAIT">PORTRAIT</a> </li> <li class="class-depth-0"> <a href="global.html#quadraticCurveTo">quadraticCurveTo</a> </li> <li class="class-depth-0"> <a href="global.html#RECTANGLE">RECTANGLE</a> </li> <li class="class-depth-0"> <a href="global.html#removeAllListeners">removeAllListeners</a> </li> <li class="class-depth-0"> <a href="global.html#RENDERTEXTURE">RENDERTEXTURE</a> </li> <li class="class-depth-0"> <a href="global.html#RETROFONT">RETROFONT</a> </li> <li class="class-depth-0"> <a href="global.html#RIGHT">RIGHT</a> </li> <li class="class-depth-0"> <a href="global.html#RIGHT_BOTTOM">RIGHT_BOTTOM</a> </li> <li class="class-depth-0"> <a href="global.html#RIGHT_CENTER">RIGHT_CENTER</a> </li> <li class="class-depth-0"> <a href="global.html#RIGHT_TOP">RIGHT_TOP</a> </li> <li class="class-depth-0"> <a href="global.html#ROPE">ROPE</a> </li> <li class="class-depth-0"> <a href="global.html#ROUNDEDRECTANGLE">ROUNDEDRECTANGLE</a> </li> <li class="class-depth-0"> <a href="global.html#scaleModes">scaleModes</a> </li> <li class="class-depth-0"> <a href="global.html#SPRITE">SPRITE</a> </li> <li class="class-depth-0"> <a href="global.html#SPRITEBATCH">SPRITEBATCH</a> </li> <li class="class-depth-0"> <a href="global.html#stopImmediatePropagation">stopImmediatePropagation</a> </li> <li class="class-depth-0"> <a href="global.html#stopPropagation">stopPropagation</a> </li> <li class="class-depth-0"> <a href="global.html#TEXT">TEXT</a> </li> <li class="class-depth-0"> <a href="global.html#TILEMAP">TILEMAP</a> </li> <li class="class-depth-0"> <a href="global.html#TILEMAPLAYER">TILEMAPLAYER</a> </li> <li class="class-depth-0"> <a href="global.html#TILESPRITE">TILESPRITE</a> </li> <li class="class-depth-0"> <a href="global.html#TOP_CENTER">TOP_CENTER</a> </li> <li class="class-depth-0"> <a href="global.html#TOP_LEFT">TOP_LEFT</a> </li> <li class="class-depth-0"> <a href="global.html#TOP_RIGHT">TOP_RIGHT</a> </li> <li class="class-depth-0"> <a href="global.html#UP">UP</a> </li> <li class="class-depth-0"> <a href="global.html#updateLocalBounds">updateLocalBounds</a> </li> <li class="class-depth-0"> <a href="global.html#VERSION">VERSION</a> </li> <li class="class-depth-0"> <a href="global.html#VERTICAL">VERTICAL</a> </li> <li class="class-depth-0"> <a href="global.html#VIDEO">VIDEO</a> </li> <li class="class-depth-0"> <a href="global.html#WEBGL">WEBGL</a> </li> <li class="class-depth-0"> <a href="global.html#WEBGL_FILTER">WEBGL_FILTER</a> </li> <li class="class-depth-0"> <a href="global.html#WEBGL_MULTI">WEBGL_MULTI</a> </li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Core<b class="caret"></b></a> <ul class="dropdown-menu "> <li class="class-depth-1"><a href="Phaser.Game.html">Game</a></li> <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.Cache.html">Cache</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> <li class="class-depth-1"><a href="Phaser.Input.html">Input Manager</a></li> <li class="class-depth-1"><a href="Phaser.ScaleManager.html">Scale Manager</a></li> </ul> </li> <li class="dropdown"> <a href="#" class="dropdown-toggle" data-toggle="dropdown">Game Objects<b class="caret"></b></a> <ul class="dropdown-menu "> <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> <li class="class-depth-1"><a href="Phaser.Video.html">Video</a></li> <li class="class-depth-1"><a href="Phaser.Particles.Arcade.Emitter.html">Particle Emitter</a></li> <li class="class-depth-1"><a href="Phaser.Particle.html">Particle</a></li> <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> <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.Ellipse.html">Ellipse</a></li> <li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li> <li class="class-depth-1"><a href="Phaser.Matrix.html">Matrix</a></li> <li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li> <li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</a></li> <li class="class-depth-1"><a href="Phaser.Rectangle.html">Rectangle</a></li> <li class="class-depth-1"><a href="Phaser.RoundedRectangle.html">Rounded Rectangle</a></li> </ul> </li> <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-2"><a href="Phaser.Weapon.html">Weapon</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.DeviceButton.html">Device Button</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.KeyCode.html">Key Codes</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 "> <li class="class-depth-1"><a href="http://phaser.io">Phaser Web Site</a></li> <li class="class-depth-1"><a href="https://github.com/photonstorm/phaser">Phaser Github</a></li> <li class="class-depth-1"><a href="http://phaser.io/examples">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="http://phaser.io/learn">Tutorials</a></li> <li class="class-depth-1"><a href="http://phaser.io/community/newsletter">Newsletter</a></li> <li class="class-depth-1"><a href="http://phaser.io/community/twitter">Twitter</a></li> <li class="class-depth-1"><a href="http://phaser.io/community/slack">Slack</a></li> <li class="class-depth-1"><a href="http://phaser.io/community/donate">Donate</a></li> <li class="class-depth-1"><a href="https://www.codeandweb.com/texturepacker/phaser">Texture Packer</a></li> </ul> </li> </ul> </div> </div> <div class="row-fluid"> <div class="span8"> <div id="main"> <!--<h1 class="page-title">Class: Math</h1>--> <section> <header> <h2> <span class="ancestors"><a href="Phaser.html">Phaser</a>.</span> Math </h2> </header> <article> <div class="container-overview"> <dt> <h4 class="name " id="Math"><span class="type-signature"></span>new Math<span class="signature">()</span><span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>A collection of useful mathematical functions.</p> <p>These are normally accessed through <code>game.math</code>.</p> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-17">line 17</a> </dt> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="Phaser.Utils.html">Phaser.Utils</a></li> <li><a href="Phaser.ArrayUtils.html">Phaser.ArrayUtils</a></li> </ul> </dd> </dl> </dd> </div> <h3 class="subsection-title">Members</h3> <dl> <dt> <h4 class="name " id=".DEG_TO_RAD"><span class="type-signature"><static> </span>DEG_TO_RAD<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Degrees to Radians factor.</p> </div> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>Phaser.Math#DEG_TO_RAD</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> </dl> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-30">line 30</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".PI2"><span class="type-signature"><static> </span>PI2<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Twice PI.</p> </div> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>Phaser.Math#PI2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> </dl> <dt class="tag-default">Default Value:</dt> <dd class="tag-default"><ul class="dummy"><li>~6.283</li></ul></dd> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-24">line 24</a> </dt> </dl> </dd> <dt> <h4 class="name " id=".RAD_TO_DEG"><span class="type-signature"><static> </span>RAD_TO_DEG<span class="type-signature"></span></h4> </dt> <dd> <div class="description"> <p>Degrees to Radians factor.</p> </div> <dl class="details"> <h5 class="subsection-title">Properties:</h5> <dl> <table class="props table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>Phaser.Math#RAD_TO_DEG</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> </dl> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-36">line 36</a> </dt> </dl> </dd> </dl> <h3 class="subsection-title">Methods</h3> <dl> <dt> <h4 class="name " id="angleBetween"><span class="type-signature"></span>angleBetween<span class="signature">(x1, y1, x2, y2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Find the angle of a segment from (x1, y1) -> (x2, y2).</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The x coordinate of the first value.</p></td> </tr> <tr> <td class="name"><code>y1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The y coordinate of the first value.</p></td> </tr> <tr> <td class="name"><code>x2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The x coordinate of the second value.</p></td> </tr> <tr> <td class="name"><code>y2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The y coordinate of the second value.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The angle, in radians.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-534">line 534</a> </dt> </dl> </dd> <dt> <h4 class="name " id="angleBetweenPoints"><span class="type-signature"></span>angleBetweenPoints<span class="signature">(point1, point2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>point1</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span> </td> <td class="description last"><p>The first point.</p></td> </tr> <tr> <td class="name"><code>point2</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span> </td> <td class="description last"><p>The second point.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The angle between the two points, in radians.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-569">line 569</a> </dt> </dl> </dd> <dt> <h4 class="name " id="angleBetweenPointsY"><span class="type-signature"></span>angleBetweenPointsY<span class="signature">(point1, point2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Find the angle of a segment from (point1.x, point1.y) -> (point2.x, point2.y).</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>point1</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>point2</code></td> <td class="type"> <span class="param-type"><a href="Phaser.Point.html">Phaser.Point</a></span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The angle, in radians.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-583">line 583</a> </dt> </dl> </dd> <dt> <h4 class="name " id="angleBetweenY"><span class="type-signature"></span>angleBetweenY<span class="signature">(x1, y1, x2, y2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Find the angle of a segment from (x1, y1) -> (x2, y2).</p> <p>The difference between this method and Math.angleBetween is that this assumes the y coordinate travels<br>down the screen.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The x coordinate of the first value.</p></td> </tr> <tr> <td class="name"><code>y1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The y coordinate of the first value.</p></td> </tr> <tr> <td class="name"><code>x2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The x coordinate of the second value.</p></td> </tr> <tr> <td class="name"><code>y2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The y coordinate of the second value.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The angle, in radians.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-550">line 550</a> </dt> </dl> </dd> <dt> <h4 class="name " id="average"><span class="type-signature"></span>average<span class="signature">()</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Averages all values passed to the function and returns the result.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The average of all given values.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-253">line 253</a> </dt> </dl> </dd> <dt> <h4 class="name " id="bernstein"><span class="type-signature"><internal> </span>bernstein<span class="signature">(n, i)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>n</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>i</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> </div> </div> <dl class="details"> <dt class="important tag-deprecated">Internal:</dt> <dd class="tag-deprecated"><ul> <li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li> </ul></dd> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-976">line 976</a> </dt> </dl> </dd> <dt> <h4 class="name " id="between"><span class="type-signature"></span>between<span class="signature">(min, max)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Returns a random integer in the range <code>[min, max]</code>. If these parameters are not in order than they will be put in order.<br>Default is 0 for <code>min</code> and 1 for <code>max</code>.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The minimum value. Must be a Number.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The maximum value. Must be a Number.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>An integer between min (inclusive) and max (inclusive).</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-137">line 137</a> </dt> </dl> </dd> <dt> <h4 class="name " id="bezierInterpolation"><span class="type-signature"></span>bezierInterpolation<span class="signature">(v, k)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>A Bezier Interpolation Method, mostly used by Phaser.Tween.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>The input array of values to interpolate between.</p></td> </tr> <tr> <td class="name"><code>k</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The percentage of interpolation, between 0 and 1.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The interpolated value</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-899">line 899</a> </dt> </dl> </dd> <dt> <h4 class="name " id="catmullRom"><span class="type-signature"><internal> </span>catmullRom<span class="signature">(p0, p1, p2, p3, t)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Calculates a catmum rom value.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>p0</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>p1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>p2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>p3</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>t</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> </div> </div> <dl class="details"> <dt class="important tag-deprecated">Internal:</dt> <dd class="tag-deprecated"><ul> <li>This member is <em>internal (protected)</em> and may be modified or removed in the future.</li> </ul></dd> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1012">line 1012</a> </dt> </dl> </dd> <dt> <h4 class="name " id="catmullRomInterpolation"><span class="type-signature"></span>catmullRomInterpolation<span class="signature">(v, k)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>A Catmull Rom Interpolation Method, mostly used by Phaser.Tween.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>The input array of values to interpolate between.</p></td> </tr> <tr> <td class="name"><code>k</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The percentage of interpolation, between 0 and 1.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The interpolated value</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-921">line 921</a> </dt> </dl> </dd> <dt> <h4 class="name " id="ceilTo"><span class="type-signature"></span>ceilTo<span class="signature">(value, <span class="optional">place</span>, <span class="optional">base</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Ceils to some place comparative to a <code>base</code>, default is 10 for decimal place.<br>The <code>place</code> is represented by the power applied to <code>base</code> to get that place.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to round.</p></td> </tr> <tr> <td class="name"><code>place</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>The place to round to.</p></td> </tr> <tr> <td class="name"><code>base</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 10 </td> <td class="description last"><p>The base to round in. Default is 10 for decimal.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The rounded value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-432">line 432</a> </dt> </dl> </dd> <dt> <h4 class="name " id="clamp"><span class="type-signature"></span>clamp<span class="signature">(v, min, max)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Force a value within the boundaries by clamping it to the range <code>min</code>, <code>max</code>.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The value to be clamped.</p></td> </tr> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The minimum bounds.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The maximum bounds.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The clamped value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1158">line 1158</a> </dt> </dl> </dd> <dt> <h4 class="name " id="clampBottom"><span class="type-signature"></span>clampBottom<span class="signature">(x, a)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Clamp <code>x</code> to the range <code>[a, Infinity)</code>.<br>Roughly the same as <code>Math.max(x, a)</code>, except for NaN handling.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1184">line 1184</a> </dt> </dl> </dd> <dt> <h4 class="name " id="degToRad"><span class="type-signature"></span>degToRad<span class="signature">(degrees)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Convert degrees to radians.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>degrees</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>Angle in degrees.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>Angle in radians.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-38">line 38</a> </dt> </dl> </dd> <dt> <h4 class="name " id="difference"><span class="type-signature"></span>difference<span class="signature">(a, b)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>The absolute difference between two values.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The first value to check.</p></td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The second value to check.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The absolute difference between the two values.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1032">line 1032</a> </dt> </dl> </dd> <dt> <h4 class="name " id="distance"><span class="type-signature"></span>distance<span class="signature">(x1, y1, x2, y2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Returns the euclidian distance between the two given set of coordinates.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>y1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>x2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>y2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The distance between the two sets of coordinates.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1100">line 1100</a> </dt> </dl> </dd> <dt> <h4 class="name " id="distancePow"><span class="type-signature"></span>distancePow<span class="signature">(x1, y1, x2, y2, <span class="optional">pow</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Returns the distance between the two given set of coordinates at the power given.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>y1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>x2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>y2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>pow</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 2 </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The distance between the two sets of coordinates.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1139">line 1139</a> </dt> </dl> </dd> <dt> <h4 class="name " id="distanceSq"><span class="type-signature"></span>distanceSq<span class="signature">(x1, y1, x2, y2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Returns the euclidean distance squared between the two given set of<br>coordinates (cuts out a square root operation before returning).</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>y1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>x2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>y2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The distance squared between the two sets of coordinates.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1119">line 1119</a> </dt> </dl> </dd> <dt> <h4 class="name " id="factorial"><span class="type-signature"></span>factorial<span class="signature">(value)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>the number you want to evaluate</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-989">line 989</a> </dt> </dl> </dd> <dt> <h4 class="name " id="floorTo"><span class="type-signature"></span>floorTo<span class="signature">(value, <span class="optional">place</span>, <span class="optional">base</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Floors to some place comparative to a <code>base</code>, default is 10 for decimal place.<br>The <code>place</code> is represented by the power applied to <code>base</code> to get that place.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to round.</p></td> </tr> <tr> <td class="name"><code>place</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>The place to round to.</p></td> </tr> <tr> <td class="name"><code>base</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 10 </td> <td class="description last"><p>The base to round in. Default is 10 for decimal.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The rounded value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-411">line 411</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fuzzyCeil"><span class="type-signature"></span>fuzzyCeil<span class="signature">(val, <span class="optional">epsilon</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Applies a fuzzy ceil to the given value.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to ceil.</p></td> </tr> <tr> <td class="name"><code>epsilon</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0.0001 </td> <td class="description last"><p>The epsilon (a small value used in the calculation)</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>ceiling(val-epsilon)</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-221">line 221</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fuzzyEqual"><span class="type-signature"></span>fuzzyEqual<span class="signature">(a, b, <span class="optional">epsilon</span>)</span><span class="type-signature"> → {boolean}</span></h4> </dt> <dd> <div class="description"> <p>Two number are fuzzyEqual if their difference is less than epsilon.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The first number to compare.</p></td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The second number to compare.</p></td> </tr> <tr> <td class="name"><code>epsilon</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0.0001 </td> <td class="description last"><p>The epsilon (a small value used in the calculation)</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if |a-b|<epsilon</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-170">line 170</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fuzzyFloor"><span class="type-signature"></span>fuzzyFloor<span class="signature">(val, <span class="optional">epsilon</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Applies a fuzzy floor to the given value.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>val</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to floor.</p></td> </tr> <tr> <td class="name"><code>epsilon</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0.0001 </td> <td class="description last"><p>The epsilon (a small value used in the calculation)</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>floor(val+epsilon)</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-237">line 237</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fuzzyGreaterThan"><span class="type-signature"></span>fuzzyGreaterThan<span class="signature">(a, b, <span class="optional">epsilon</span>)</span><span class="type-signature"> → {boolean}</span></h4> </dt> <dd> <div class="description"> <p><code>a</code> is fuzzyGreaterThan <code>b</code> if it is more than b - epsilon.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The first number to compare.</p></td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The second number to compare.</p></td> </tr> <tr> <td class="name"><code>epsilon</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0.0001 </td> <td class="description last"><p>The epsilon (a small value used in the calculation)</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if a>b+epsilon</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-204">line 204</a> </dt> </dl> </dd> <dt> <h4 class="name " id="fuzzyLessThan"><span class="type-signature"></span>fuzzyLessThan<span class="signature">(a, b, <span class="optional">epsilon</span>)</span><span class="type-signature"> → {boolean}</span></h4> </dt> <dd> <div class="description"> <p><code>a</code> is fuzzyLessThan <code>b</code> if it is less than b + epsilon.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The first number to compare.</p></td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The second number to compare.</p></td> </tr> <tr> <td class="name"><code>epsilon</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0.0001 </td> <td class="description last"><p>The epsilon (a small value used in the calculation)</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if a<b+epsilon</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-187">line 187</a> </dt> </dl> </dd> <dt> <h4 class="name " id="getNextPowerOfTwo"><span class="type-signature"></span>getNextPowerOfTwo<span class="signature">(value)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Given a number, this function returns the closest number that is a power of two.<br>This function is from the Starling Framework.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The value to get the closest power of two from.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The closest number that is a power of two.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-64">line 64</a> </dt> </dl> </dd> <dt> <h4 class="name " id="getShortestAngle"><span class="type-signature"></span>getShortestAngle<span class="signature">(angle1, angle2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Gets the shortest angle between <code>angle1</code> and <code>angle2</code>.<br>Both angles must be in the range -180 to 180, which is the same clamped<br>range that <code>sprite.angle</code> uses, so you can pass in two sprite angles to<br>this method, and get the shortest angle back between the two of them.</p> <p>The angle returned will be in the same range. If the returned angle is<br>greater than 0 then it's a counter-clockwise rotation, if < 0 then it's<br>a clockwise rotation.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>angle1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The first angle. In the range -180 to 180.</p></td> </tr> <tr> <td class="name"><code>angle2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The second angle. In the range -180 to 180.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The shortest angle, in degrees. If greater than zero it's a counter-clockwise rotation.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-504">line 504</a> </dt> </dl> </dd> <dt> <h4 class="name " id="isEven"><span class="type-signature"></span>isEven<span class="signature">(n)</span><span class="type-signature"> → {boolean}</span></h4> </dt> <dd> <div class="description"> <p>Returns true if the number given is even.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>n</code></td> <td class="type"> <span class="param-type">integer</span> </td> <td class="description last"><p>The number to check.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if the given number is even. False if the given number is odd.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-719">line 719</a> </dt> </dl> </dd> <dt> <h4 class="name " id="isOdd"><span class="type-signature"></span>isOdd<span class="signature">(n)</span><span class="type-signature"> → {boolean}</span></h4> </dt> <dd> <div class="description"> <p>Returns true if the number given is odd.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>n</code></td> <td class="type"> <span class="param-type">integer</span> </td> <td class="description last"><p>The number to check.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if the given number is odd. False if the given number is even.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-705">line 705</a> </dt> </dl> </dd> <dt> <h4 class="name " id="isPowerOfTwo"><span class="type-signature"></span>isPowerOfTwo<span class="signature">(width, height)</span><span class="type-signature"> → {boolean}</span></h4> </dt> <dd> <div class="description"> <p>Checks if the given dimensions make a power of two texture.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>width</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The width to check.</p></td> </tr> <tr> <td class="name"><code>height</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The height to check.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if the width and height are a power of two.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-93">line 93</a> </dt> </dl> </dd> <dt> <h4 class="name " id="linear"><span class="type-signature"></span>linear<span class="signature">(p0, p1, t)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Calculates a linear (interpolation) value over t.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>p0</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>p1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> <tr> <td class="name"><code>t</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>A value between 0 and 1.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-961">line 961</a> </dt> </dl> </dd> <dt> <h4 class="name " id="linearInterpolation"><span class="type-signature"></span>linearInterpolation<span class="signature">(v, k)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>A Linear Interpolation Method, mostly used by Phaser.Tween.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>v</code></td> <td class="type"> <span class="param-type">Array</span> </td> <td class="description last"><p>The input array of values to interpolate between.</p></td> </tr> <tr> <td class="name"><code>k</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The percentage of interpolation, between 0 and 1.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The interpolated value</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-871">line 871</a> </dt> </dl> </dd> <dt> <h4 class="name " id="mapLinear"><span class="type-signature"></span>mapLinear<span class="signature">(x, a1, a2, b1, b2)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Linear mapping from range <a1, a2> to range <b1, b2></p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The value to map</p></td> </tr> <tr> <td class="name"><code>a1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>First endpoint of the range <a1, a2></p></td> </tr> <tr> <td class="name"><code>a2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>Final endpoint of the range <a1, a2></p></td> </tr> <tr> <td class="name"><code>b1</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>First endpoint of the range <b1, b2></p></td> </tr> <tr> <td class="name"><code>b2</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>Final endpoint of the range <b1, b2></p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1215">line 1215</a> </dt> </dl> </dd> <dt> <h4 class="name " id="max"><span class="type-signature"></span>max<span class="signature">()</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Variation of Math.max that can be passed either an array of numbers or the numbers as parameters.</p> <p>Prefer the standard <code>Math.max</code> function when appropriate.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The largest value from those given.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-765">line 765</a> </dt> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="http://jsperf.com/math-s-min-max-vs-homemade">http://jsperf.com/math-s-min-max-vs-homemade</a></li> </ul> </dd> </dl> </dd> <dt> <h4 class="name " id="maxAdd"><span class="type-signature"></span>maxAdd<span class="signature">(value, amount, max)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Adds the given amount to the value, but never lets the value go over the specified maximum.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The value to add the amount to.</p></td> </tr> <tr> <td class="name"><code>amount</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The amount to add to the value.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The maximum the value is allowed to be.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The new value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-621">line 621</a> </dt> </dl> </dd> <dt> <h4 class="name " id="maxProperty"><span class="type-signature"></span>maxProperty<span class="signature">()</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Variation of Math.max that can be passed a property and either an array of objects or the objects as parameters.<br>It will find the largest matching property value from the given objects.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The largest value from those given.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-827">line 827</a> </dt> </dl> </dd> <dt> <h4 class="name " id="min"><span class="type-signature"></span>min<span class="signature">()</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Variation of Math.min that can be passed either an array of numbers or the numbers as parameters.</p> <p>Prefer the standard <code>Math.min</code> function when appropriate.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The lowest value from those given.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-733">line 733</a> </dt> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li><a href="http://jsperf.com/math-s-min-max-vs-homemade">http://jsperf.com/math-s-min-max-vs-homemade</a></li> </ul> </dd> </dl> </dd> <dt> <h4 class="name " id="minProperty"><span class="type-signature"></span>minProperty<span class="signature">()</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Variation of Math.min that can be passed a property and either an array of objects or the objects as parameters.<br>It will find the lowest matching property value from the given objects.</p> </div> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The lowest value from those given.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-797">line 797</a> </dt> </dl> </dd> <dt> <h4 class="name " id="minSub"><span class="type-signature"></span>minSub<span class="signature">(value, amount, min)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Subtracts the given amount from the value, but never lets the value go below the specified minimum.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The base value.</p></td> </tr> <tr> <td class="name"><code>amount</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The amount to subtract from the base value.</p></td> </tr> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The minimum the value is allowed to be.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The new value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-636">line 636</a> </dt> </dl> </dd> <dt> <h4 class="name " id="normalizeAngle"><span class="type-signature"></span>normalizeAngle<span class="signature">(angleRad)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Normalizes an angle to the [0,2pi) range.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>angleRad</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The angle to normalize, in radians.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The angle, fit within the [0,2pi] range, in radians.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-608">line 608</a> </dt> </dl> </dd> <dt> <h4 class="name " id="percent"><span class="type-signature"></span>percent<span class="signature">(a, b, <span class="optional">base</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Work out what percentage value <code>a</code> is of value <code>b</code> using the given base.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to work out the percentage for.</p></td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value you wish to get the percentage of.</p></td> </tr> <tr> <td class="name"><code>base</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>The base value.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The percentage a is of b, between 0 and 1.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1283">line 1283</a> </dt> </dl> </dd> <dt> <h4 class="name " id="radToDeg"><span class="type-signature"></span>radToDeg<span class="signature">(radians)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Convert radians to degrees.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>radians</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>Angle in radians.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>Angle in degrees</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-51">line 51</a> </dt> </dl> </dd> <dt> <h4 class="name " id="random"><span class="type-signature"></span>random<span class="signature">(min, max)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Returns a random float in the range <code>[min, max)</code>. If these parameters are not in order than they will be put in order.<br>Default is 0 for <code>min</code> and 1 for <code>max</code>.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The minimum value. Must be a Number.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The maximum value. Must be a Number.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>A floating point number between min (inclusive) and max (exclusive).</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-107">line 107</a> </dt> </dl> </dd> <dt> <h4 class="name " id="reverseAngle"><span class="type-signature"></span>reverseAngle<span class="signature">(angleRad)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Reverses an angle.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>angleRad</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The angle to reverse, in radians.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The reverse angle, in radians.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-596">line 596</a> </dt> </dl> </dd> <dt> <h4 class="name " id="rotateToAngle"><span class="type-signature"></span>rotateToAngle<span class="signature">(currentAngle, targetAngle, <span class="optional">lerp</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Rotates currentAngle towards targetAngle, taking the shortest rotation distance.<br>The lerp argument is the amount to rotate by in this call.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>currentAngle</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The current angle, in radians.</p></td> </tr> <tr> <td class="name"><code>targetAngle</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The target angle to rotate to, in radians.</p></td> </tr> <tr> <td class="name"><code>lerp</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0.05 </td> <td class="description last"><p>The lerp value to add to the current angle.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The adjusted angle.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-453">line 453</a> </dt> </dl> </dd> <dt> <h4 class="name " id="roundAwayFromZero"><span class="type-signature"></span>roundAwayFromZero<span class="signature">(value)</span><span class="type-signature"> → {integer}</span></h4> </dt> <dd> <div class="description"> <p>Round to the next whole number <em>away</em> from zero.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>Any number.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">integer</span> - </div> <div class="returns-desc param-desc"> <p>The rounded value of that number.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1046">line 1046</a> </dt> </dl> </dd> <dt> <h4 class="name " id="roundTo"><span class="type-signature"></span>roundTo<span class="signature">(value, <span class="optional">place</span>, <span class="optional">base</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Round to some place comparative to a <code>base</code>, default is 10 for decimal place.<br>The <code>place</code> is represented by the power applied to <code>base</code> to get that place.</p> <pre class="prettyprint source"><code>e.g. 2000/7 ~= 285.714285714285714285714 ~= (bin)100011101.1011011011011011 roundTo(2000/7,3) === 0 roundTo(2000/7,2) == 300 roundTo(2000/7,1) == 290 roundTo(2000/7,0) == 286 roundTo(2000/7,-1) == 285.7 roundTo(2000/7,-2) == 285.71 roundTo(2000/7,-3) == 285.714 roundTo(2000/7,-4) == 285.7143 roundTo(2000/7,-5) == 285.71429 roundTo(2000/7,3,2) == 288 -- 100100000 roundTo(2000/7,2,2) == 284 -- 100011100 roundTo(2000/7,1,2) == 286 -- 100011110 roundTo(2000/7,0,2) == 286 -- 100011110 roundTo(2000/7,-1,2) == 285.5 -- 100011101.1 roundTo(2000/7,-2,2) == 285.75 -- 100011101.11 roundTo(2000/7,-3,2) == 285.75 -- 100011101.11 roundTo(2000/7,-4,2) == 285.6875 -- 100011101.1011 roundTo(2000/7,-5,2) == 285.71875 -- 100011101.10111</code></pre><p>Note what occurs when we round to the 3rd space (8ths place), 100100000, this is to be assumed<br>because we are rounding 100011.1011011011011011 which rounds up.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to round.</p></td> </tr> <tr> <td class="name"><code>place</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>The place to round to.</p></td> </tr> <tr> <td class="name"><code>base</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 10 </td> <td class="description last"><p>The base to round in. Default is 10 for decimal.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The rounded value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-365">line 365</a> </dt> </dl> </dd> <dt> <h4 class="name " id="shear"><span class="type-signature"></span>shear<span class="signature">(n)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>n</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>n mod 1</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-274">line 274</a> </dt> </dl> </dd> <dt> <h4 class="name " id="sign"><span class="type-signature"></span>sign<span class="signature">(x)</span><span class="type-signature"> → {integer}</span></h4> </dt> <dd> <div class="description"> <p>A value representing the sign of the value: -1 for negative, +1 for positive, 0 if value is 0.</p> <p>This works differently from <code>Math.sign</code> for values of NaN and -0, etc.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">integer</span> - </div> <div class="returns-desc param-desc"> <p>An integer in {-1, 0, 1}</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1268">line 1268</a> </dt> </dl> </dd> <dt> <h4 class="name " id="sinCosGenerator"><span class="type-signature"></span>sinCosGenerator<span class="signature">(length, sinAmplitude, cosAmplitude, frequency)</span><span class="type-signature"> → {Object}</span></h4> </dt> <dd> <div class="description"> <p>Generate a sine and cosine table simultaneously and extremely quickly.<br>The parameters allow you to specify the length, amplitude and frequency of the wave.<br>This generator is fast enough to be used in real-time.<br>Code based on research by Franky of scene.at</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>length</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The length of the wave</p></td> </tr> <tr> <td class="name"><code>sinAmplitude</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The amplitude to apply to the sine table (default 1.0) if you need values between say -+ 125 then give 125 as the value</p></td> </tr> <tr> <td class="name"><code>cosAmplitude</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The amplitude to apply to the cosine table (default 1.0) if you need values between say -+ 125 then give 125 as the value</p></td> </tr> <tr> <td class="name"><code>frequency</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The frequency of the sine and cosine table data</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">Object</span> - </div> <div class="returns-desc param-desc"> <p>Returns the table data.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1060">line 1060</a> </dt> </dl> </dd> <dt> <h4 class="name " id="smootherstep"><span class="type-signature"></span>smootherstep<span class="signature">(x, min, max)</span><span class="type-signature"> → {float}</span></h4> </dt> <dd> <div class="description"> <p>Smootherstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The input value.</p></td> </tr> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The left edge. Should be smaller than the right edge.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The right edge.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">float</span> - </div> <div class="returns-desc param-desc"> <p>A value between 0 and 1.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1251">line 1251</a> </dt> </dl> </dd> <dt> <h4 class="name " id="smoothstep"><span class="type-signature"></span>smoothstep<span class="signature">(x, min, max)</span><span class="type-signature"> → {float}</span></h4> </dt> <dd> <div class="description"> <p>Smoothstep function as detailed at http://en.wikipedia.org/wiki/Smoothstep</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>x</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The input value.</p></td> </tr> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The left edge. Should be smaller than the right edge.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">float</span> </td> <td class="description last"><p>The right edge.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">float</span> - </div> <div class="returns-desc param-desc"> <p>A value between 0 and 1.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1232">line 1232</a> </dt> </dl> </dd> <dt> <h4 class="name " id="snapTo"><span class="type-signature"></span>snapTo<span class="signature">(input, gap, <span class="optional">start</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Snap a value to nearest grid slice, using rounding.</p> <p>Example: if you have an interval gap of 5 and a position of 12... you will snap to 10 whereas 14 will snap to 15.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to snap.</p></td> </tr> <tr> <td class="name"><code>gap</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The interval gap of the grid.</p></td> </tr> <tr> <td class="name"><code>start</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>Optional starting offset for gap.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The snapped value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-285">line 285</a> </dt> </dl> </dd> <dt> <h4 class="name " id="snapToCeil"><span class="type-signature"></span>snapToCeil<span class="signature">(input, gap, <span class="optional">start</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Snap a value to nearest grid slice, using ceil.</p> <p>Example: if you have an interval gap of 5 and a position of 12... you will snap to 15.<br>As will 14 will snap to 15... but 16 will snap to 20.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to snap.</p></td> </tr> <tr> <td class="name"><code>gap</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The interval gap of the grid.</p></td> </tr> <tr> <td class="name"><code>start</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>Optional starting offset for gap.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The snapped value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-338">line 338</a> </dt> </dl> </dd> <dt> <h4 class="name " id="snapToFloor"><span class="type-signature"></span>snapToFloor<span class="signature">(input, gap, <span class="optional">start</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Snap a value to nearest grid slice, using floor.</p> <p>Example: if you have an interval gap of 5 and a position of 12... you will snap to 10.<br>As will 14 snap to 10... but 16 will snap to 15.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The value to snap.</p></td> </tr> <tr> <td class="name"><code>gap</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The interval gap of the grid.</p></td> </tr> <tr> <td class="name"><code>start</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> 0 </td> <td class="description last"><p>Optional starting offset for gap.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The snapped value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-311">line 311</a> </dt> </dl> </dd> <dt> <h4 class="name " id="within"><span class="type-signature"></span>within<span class="signature">(a, b, tolerance)</span><span class="type-signature"> → {boolean}</span></h4> </dt> <dd> <div class="description"> <p>Checks if two values are within the given tolerance of each other.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>a</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The first number to check</p></td> </tr> <tr> <td class="name"><code>b</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The second number to check</p></td> </tr> <tr> <td class="name"><code>tolerance</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The tolerance. Anything equal to or less than this is considered within the range.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">boolean</span> - </div> <div class="returns-desc param-desc"> <p>True if a is <= tolerance of b.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-1199">line 1199</a> </dt> <dt class="tag-see">See:</dt> <dd class="tag-see"> <ul> <li>Phaser.Math.fuzzyEqual</li> </ul> </dd> </dl> </dd> <dt> <h4 class="name " id="wrap"><span class="type-signature"></span>wrap<span class="signature">(value, min, max)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Ensures that the value always stays between min and max, by wrapping the value around.</p> <p>If <code>max</code> is not larger than <code>min</code> the result is 0.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The value to wrap.</p></td> </tr> <tr> <td class="name"><code>min</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The minimum the value is allowed to be.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The maximum the value is allowed to be, should be larger than <code>min</code>.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The wrapped value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-651">line 651</a> </dt> </dl> </dd> <dt> <h4 class="name " id="wrapAngle"><span class="type-signature"></span>wrapAngle<span class="signature">(angle, <span class="optional">radians</span>)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Keeps an angle value between -180 and +180; or -PI and PI if radians.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Argument</th> <th>Default</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>angle</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="attributes"> </td> <td class="default"> </td> <td class="description last"><p>The angle value to wrap</p></td> </tr> <tr> <td class="name"><code>radians</code></td> <td class="type"> <span class="param-type">boolean</span> </td> <td class="attributes"> <optional><br> </td> <td class="default"> false </td> <td class="description last"><p>Set to <code>true</code> if the angle is given in radians, otherwise degrees is expected.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The new angle value; will be the same as the input angle if it was within bounds.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-857">line 857</a> </dt> </dl> </dd> <dt> <h4 class="name " id="wrapValue"><span class="type-signature"></span>wrapValue<span class="signature">(value, amount, max)</span><span class="type-signature"> → {number}</span></h4> </dt> <dd> <div class="description"> <p>Adds value to amount and ensures that the result always stays between 0 and max, by wrapping the value around.</p> <p>Values <em>must</em> be positive integers, and are passed through Math.abs. See <a href="Phaser.Math.html#wrap">Phaser.Math#wrap</a> for an alternative.</p> </div> <h5>Parameters:</h5> <table class="params table table-striped"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>value</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The value to add the amount to.</p></td> </tr> <tr> <td class="name"><code>amount</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The amount to add to the value.</p></td> </tr> <tr> <td class="name"><code>max</code></td> <td class="type"> <span class="param-type">number</span> </td> <td class="description last"><p>The maximum the value is allowed to be.</p></td> </tr> </tbody> </table> <h5>Returns:</h5> <div class="returns"> <div class="returns-type"> <span class="param-type">number</span> - </div> <div class="returns-desc param-desc"> <p>The wrapped value.</p> </div> </div> <dl class="details"> <dt class="tag-source">Source - <a href="src_math_Math.js.html">math/Math.js</a>, <a href="src_math_Math.js.html#sunlight-1-line-682">line 682</a> </dt> </dl> </dd> </dl> </article> </section> </div> <div class="clearfix"></div> <footer> <span class="copyright"> Phaser Copyright © 2012-2016 Photon Storm Ltd. </span> <br /> <span class="jsdoc-message"> Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.4.3</a> on Mon Dec 05 2016 10:04:35 GMT+0000 (GMT Standard Time) using the <a href="https://github.com/terryweiss/docstrap">DocStrap template</a>. </span> </footer> </div> <div class="span3"> <div id="toc"></div> </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( { anchorName : function(i, heading, prefix) { return $(heading).attr("id") || ( prefix + i ); }, 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>