phaser/docs/Phaser.Math.html
2014-12-04 11:33:42 +00:00

14047 lines
No EOL
212 KiB
HTML

<!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-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.ArrayList.html">ArrayList</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.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.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Color.html">Color</a>
</li>
<li class="class-depth-1">
<a href="Phaser.Device.html">Device</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-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.GamepadButton.html">GamepadButton</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.Image.html">Image</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.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.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.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-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-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.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.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.World.html">World</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AbstractFilter.html">AbstractFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AjaxRequest.html">AjaxRequest</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AlphaMaskFilter.html">AlphaMaskFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AsciiFilter.html">AsciiFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AssetLoader.html">AssetLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.AtlasLoader.html">AtlasLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BaseTexture.html">BaseTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BitmapFontLoader.html">BitmapFontLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BitmapText.html">BitmapText</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BlurFilter.html">BlurFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BlurXFilter.html">BlurXFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.BlurYFilter.html">BlurYFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasBuffer.html">CanvasBuffer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasGraphics.html">CanvasGraphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasMaskManager.html">CanvasMaskManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasRenderer.html">CanvasRenderer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CanvasTinter.html">CanvasTinter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Circle.html">Circle</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ColorMatrixFilter.html">ColorMatrixFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ColorStepFilter.html">ColorStepFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ComplexPrimitiveShader.html">ComplexPrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ConvolutionFilter.html">ConvolutionFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.CrossHatchFilter.html">CrossHatchFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplacementFilter.html">DisplacementFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObject.html">DisplayObject</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DisplayObjectContainer.html">DisplayObjectContainer</a>
</li>
<li class="class-depth-1">
<a href="PIXI.DotScreenFilter.html">DotScreenFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Ellipse.html">Ellipse</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Event.html">Event</a>
</li>
<li class="class-depth-1">
<a href="PIXI.EventTarget.html">EventTarget</a>
</li>
<li class="class-depth-1">
<a href="PIXI.FilterBlock.html">FilterBlock</a>
</li>
<li class="class-depth-1">
<a href="PIXI.FilterTexture.html">FilterTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Graphics.html">Graphics</a>
</li>
<li class="class-depth-1">
<a href="PIXI.GraphicsData.html">GraphicsData</a>
</li>
<li class="class-depth-1">
<a href="PIXI.GrayFilter.html">GrayFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.ImageLoader.html">ImageLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.InteractionData.html">InteractionData</a>
</li>
<li class="class-depth-1">
<a href="PIXI.InteractionManager.html">InteractionManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.InvertFilter.html">InvertFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.JsonLoader.html">JsonLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Matrix.html">Matrix</a>
</li>
<li class="class-depth-1">
<a href="PIXI.MovieClip.html">MovieClip</a>
</li>
<li class="class-depth-1">
<a href="PIXI.NoiseFilter.html">NoiseFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.NormalMapFilter.html">NormalMapFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixelateFilter.html">PixelateFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PIXI.html">PIXI</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiFastShader.html">PixiFastShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PixiShader.html">PixiShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Point.html">Point</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Polygon.html">Polygon</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PolyK.html">PolyK</a>
</li>
<li class="class-depth-1">
<a href="PIXI.PrimitiveShader.html">PrimitiveShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Rectangle.html">Rectangle</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RenderTexture.html">RenderTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RGBSplitFilter.html">RGBSplitFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Rope.html">Rope</a>
</li>
<li class="class-depth-1">
<a href="PIXI.RoundedRectangle.html">RoundedRectangle</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SepiaFilter.html">SepiaFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SmartBlurFilter.html">SmartBlurFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Spine.html">Spine</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpineLoader.html">SpineLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpineTextureLoader.html">SpineTextureLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Sprite.html">Sprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpriteBatch.html">SpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.SpriteSheetLoader.html">SpriteSheetLoader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Stage.html">Stage</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Strip.html">Strip</a>
</li>
<li class="class-depth-1">
<a href="PIXI.StripShader.html">StripShader</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Text.html">Text</a>
</li>
<li class="class-depth-1">
<a href="PIXI.Texture.html">Texture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TilingSprite.html">TilingSprite</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TiltShiftFilter.html">TiltShiftFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TiltShiftXFilter.html">TiltShiftXFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TiltShiftYFilter.html">TiltShiftYFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.TwistFilter.html">TwistFilter</a>
</li>
<li class="class-depth-1">
<a href="PIXI.VideoTexture.html">VideoTexture</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLBlendModeManager.html">WebGLBlendModeManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFastSpriteBatch.html">WebGLFastSpriteBatch</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLFilterManager.html">WebGLFilterManager</a>
</li>
<li class="class-depth-1">
<a href="PIXI.WebGLRenderer.html">WebGLRenderer</a>
</li>
</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.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.InputManager.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.Emitter.html">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.Rectangle.html">Rectangle</a></li>
<li class="class-depth-1"><a href="Phaser.Point.html">Point</a></li>
<li class="class-depth-1"><a href="Phaser.Line.html">Line</a></li>
<li class="class-depth-1"><a href="Phaser.Ellipse.html">Ellipse</a></li>
<li class="class-depth-1"><a href="Phaser.Polygon.html">Polygon</a></li>
</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-1"><a href="Phaser.Physics.P2.html">P2 Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Body.html">Body</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.Spring.html">Spring</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.CollisionGroup.html">CollisionGroup</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.P2.ContactMaterial.html">ContactMaterial</a></li>
<li class="class-depth-1"><a href="Phaser.Physics.Ninja.html">Ninja Physics</a></li>
<li class="class-depth-2"><a href="Phaser.Physics.Body.html">Body</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Input<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="Phaser.InputHandler.html">Input Handler</a></li>
<li class="class-depth-1"><a href="Phaser.Pointer.html">Pointer</a></li>
<li class="class-depth-1"><a href="Phaser.Mouse.html">Mouse</a></li>
<li class="class-depth-1"><a href="Phaser.Keyboard.html">Keyboard</a></li>
<li class="class-depth-1"><a href="Phaser.Key.html">Key</a></li>
<li class="class-depth-1"><a href="Phaser.Gamepad.html">Gamepad</a></li>
</ul>
</li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Community<b class="caret"></b></a>
<ul class="dropdown-menu ">
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser">Phaser Github</a></li>
<li class="class-depth-1"><a href="http://examples.phaser.io">Phaser Examples</a></li>
<li class="class-depth-1"><a href="https://github.com/photonstorm/phaser-plugins">Phaser Plugins</a></li>
<li class="class-depth-1"><a href="http://www.html5gamedevs.com/forum/14-phaser/">Forum</a></li>
<li class="class-depth-1"><a href="http://stackoverflow.com/questions/tagged/phaser-framework">Stack Overflow</a></li>
<li class="class-depth-1"><a href="https://confirmsubscription.com/h/r/369DE48E3E86AF1E">Newsletter</a></li>
<li class="class-depth-1"><a href="https://twitter.com/photonstorm">Twitter</a></li>
<li class="class-depth-1"><a href="http://www.html5gamedevs.com/topic/4470-official-phaserio-irc-channel-phaserio-on-freenode/">IRC</a></li>
<li class="class-depth-1"><a href="https://leanpub.com/u/photonstorm">Phaser Books</a></li>
<li class="class-depth-1"><a href="https://www.gittip.com/photonstorm/">GitTip</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="Math.js.html">math/Math.js</a>, <a href="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 toc-deprecated"
id="PI2"><span class="type-signature">&lt;static> </span>PI2<span class="type-signature"></span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<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="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Not used internally. Use `2 * Math.PI` instead.</li>
</ul></dd>
<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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-25">line 25</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the angle of a segment from (x1, y1) -&gt; (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"></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 angle, in radians.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-326">line 326</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the angle of a segment from (point1.x, point1.y) -&gt; (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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-355">line 355</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the angle of a segment from (point1.x, point1.y) -&gt; (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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-366">line 366</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Find the angle of a segment from (x1, y1) -&gt; (x2, y2).
Note that the difference between this method and Math.angleBetween is that this assumes the y coordinate travels
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"></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 angle, in radians.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-339">line 339</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="angleLimit"><span class="type-signature"></span>angleLimit<span class="signature">(angle, min, max)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Keeps an angle value between the given min and max 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>angle</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The angle value to check. Must be between -180 and +180.</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 angle that is allowed (must be -180 or greater).</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 angle that is allowed (must be 180 or less).</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, returns the same as the input angle if it was within bounds</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.Math.html#clamp">Phaser.Math#clamp</a> instead</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-737">line 737</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="average"><span class="type-signature"></span>average<span class="signature">()</span><span class="type-signature"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-93">line 93</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="bernstein"><span class="type-signature">&lt;internal> </span>bernstein<span class="signature">(n, i)</span><span class="type-signature"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-865">line 865</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"> &rarr; {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"></td>
</tr>
<tr>
<td class="name"><code>k</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-791">line 791</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="catmullRom"><span class="type-signature">&lt;internal> </span>catmullRom<span class="signature">(p0, p1, p2, p3, t)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Calculates a callmum 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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-899">line 899</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"> &rarr; {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"></td>
</tr>
<tr>
<td class="name"><code>k</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-812">line 812</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="ceil"><span class="type-signature"></span>ceil<span class="signature">(value)</span><span class="type-signature"> &rarr; {integer}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p><em>Do not use this function.</em></p>
<p>Round to the next whole number <em>away</em> from zero.</p>
<p>E.g. <code>ceil(1.3) == 2</code>, and <code>ceil(-2.3) == -3</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>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="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.Math.html#roundAwayFromZero">Phaser.Math#roundAwayFromZero</a> instead.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-981">line 981</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="ceilTo"><span class="type-signature"></span>ceilTo<span class="signature">(value, place, base)</span><span class="type-signature"> &rarr; {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 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="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="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">
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-295">line 295</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="chanceRoll"><span class="type-signature"></span>chanceRoll<span class="signature">(chance)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Generate a random bool result based on the chance value.</p>
<p>Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.</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>chance</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%).</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 roll passed, or false otherwise.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use Phaser.Utils.chanceRoll</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-422">line 422</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="chanceRoll"><span class="type-signature"></span>chanceRoll<span class="signature">(chance)</span><span class="type-signature"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<div class="description">
<p>Generate a random bool result based on the chance value.</p>
<p>Returns true or false based on the chance value (default 50%). For example if you wanted a player to have a 30% chance
of getting a bonus, call chanceRoll(30) - true means the chance passed, false means it failed.</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>chance</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The chance of receiving the value. A number between 0 and 100 (effectively 0% to 100%).</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 roll passed, or false otherwise.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Utils.js_.html">utils/Utils.js</a>, <a href="Utils.js_.html#sunlight-1-line-77">line 77</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="clamp"><span class="type-signature"></span>clamp<span class="signature">(x, a, b)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Force a value within the boundaries by clamping <code>x</code> to the range <code>[a, b]</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>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>
<tr>
<td class="name"><code>b</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1130">line 1130</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Clamp <code>x</code> to the range <code>[a, Infinity)</code>.
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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1143">line 1143</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1259">line 1259</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"> &rarr; {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"></td>
</tr>
<tr>
<td class="name"><code>b</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-919">line 919</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Returns the 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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1077">line 1077</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"> &rarr; {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">
&lt;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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1096">line 1096</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="distanceRounded"><span class="type-signature"></span>distanceRounded<span class="signature">(x1, y1, x2, y2)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Returns the rounded 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 this Point object and the destination Point object.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Do the rounding locally.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1115">line 1115</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-876">line 876</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="floor"><span class="type-signature"></span>floor<span class="signature">(value)</span><span class="type-signature"> &rarr; {integer}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p><em>Do not use this function.</em></p>
<p>Round to the next whole number <em>towards</em> zero.</p>
<p>E.g. <code>floor(1.7) == 1</code>, and <code>floor(-2.7) == -2</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>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="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.Math.html#truncate">Phaser.Math#truncate</a> or `Math.trunc` instead.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-965">line 965</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="floorTo"><span class="type-signature"></span>floorTo<span class="signature">(value, place, base)</span><span class="type-signature"> &rarr; {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 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="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="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">
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-277">line 277</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"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<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"></td>
</tr>
<tr>
<td class="name"><code>epsilon</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
(small value)
</td>
<td class="description last"></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>ceiling(val-epsilon)</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-69">line 69</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"> &rarr; {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"></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"></td>
</tr>
<tr>
<td class="name"><code>epsilon</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
(small value)
</td>
<td class="description last"></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|&lt;epsilon</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-27">line 27</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"> &rarr; {boolean}</span></h4>
</dt>
<dd>
<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"></td>
</tr>
<tr>
<td class="name"><code>epsilon</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
(small value)
</td>
<td class="description last"></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>floor(val-epsilon)</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-81">line 81</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"> &rarr; {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"></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"></td>
</tr>
<tr>
<td class="name"><code>epsilon</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
(small value)
</td>
<td class="description last"></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&gt;b+epsilon</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-55">line 55</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"> &rarr; {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"></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"></td>
</tr>
<tr>
<td class="name"><code>epsilon</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
(small value)
</td>
<td class="description last"></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&lt;b+epsilon</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-41">line 41</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="getRandom"><span class="type-signature"></span>getRandom<span class="signature">(objects, startIndex, length)</span><span class="type-signature"> &rarr; {object}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Fetch a random entry from the given array.</p>
<p>Will return null if there are no array items that fall within the specified range
or if there is no item for the randomly choosen index.</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>objects</code></td>
<td class="type">
<span class="param-type">any[]</span>
</td>
<td class="description last"><p>An array of objects.</p></td>
</tr>
<tr>
<td class="name"><code>startIndex</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last"><p>Optional offset off the front of the array. Default value is 0, or the beginning of the array.</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last"><p>Optional restriction on the number of values you want to randomly select from.</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>The random object that was selected.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.ArrayUtils.html#getRandomItem">Phaser.ArrayUtils.getRandomItem</a></li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-931">line 931</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="interpolateFloat"><span class="type-signature"></span>interpolateFloat<span class="signature">(a, b, weight)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>A one dimensional linear interpolation of a 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>a</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>b</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>weight</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">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - See <a href="Phaser.Math.html#linear">Phaser.Math#linear</a></li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-313">line 313</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-587">line 587</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-575">line 575</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="limitValue"><span class="type-signature"></span>limitValue<span class="signature">(value, min, max)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Ensures the given value is between min and max inclusive.</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 limit.</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 can 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 can 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 limited value.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.Math.html#clamp">Phaser.Math#clamp</a></li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-550">line 550</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"> &rarr; {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"></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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-852">line 852</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"> &rarr; {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"></td>
</tr>
<tr>
<td class="name"><code>k</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-764">line 764</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Linear mapping from range &lt;a1, a2&gt; to range &lt;b1, b2&gt;</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 &lt;a1, a2&gt;</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 &lt;a1, a2&gt;</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 &lt;b1, b2&gt;</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 &lt;b1, b2&gt;</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1170">line 1170</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="max"><span class="type-signature"></span>max<span class="signature">()</span><span class="type-signature"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-631">line 631</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"> &rarr; {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">
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-470">line 470</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="maxProperty"><span class="type-signature"></span>maxProperty<span class="signature">()</span><span class="type-signature"> &rarr; {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.
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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-693">line 693</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="min"><span class="type-signature"></span>min<span class="signature">()</span><span class="type-signature"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-599">line 599</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"> &rarr; {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.
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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-663">line 663</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-483">line 483</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"> &rarr; {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>Returns the angle, fit within the [0,2pi] range, in radians.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-387">line 387</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="normalizeLatitude"><span class="type-signature"></span>normalizeLatitude<span class="signature">(lat)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Normalizes a latitude to the [-90,90] range. Latitudes above 90 or below -90 are capped, not wrapped.</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>lat</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The latitude to normalize, 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>Returns the latitude, fit within the [-90,90] range.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.Math.html#clamp">Phaser.Math#clamp</a>.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-400">line 400</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="normalizeLongitude"><span class="type-signature"></span>normalizeLongitude<span class="signature">(lng)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Normalizes a longitude to the [-180,180] range. Longitudes above 180 or below -180 are wrapped.</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>lng</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The longitude to normalize, 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>Returns the longitude, fit within the [-180,180] range.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.Math.html#wrap">Phaser.Math#wrap</a>.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-411">line 411</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="numberArray"><span class="type-signature"></span>numberArray<span class="signature">(start, end)</span><span class="type-signature"> &rarr; {number[]}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Create an array representing the inclusive range of numbers (usually integers) in <code>[start, end]</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>start</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The minimum value the array starts with.</p></td>
</tr>
<tr>
<td class="name"><code>end</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The maximum value the array contains.</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 array of number values.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - See Phaser.ArrayUtils.numberArray</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-437">line 437</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="numberArray"><span class="type-signature"></span>numberArray<span class="signature">(start, end)</span><span class="type-signature"> &rarr; {number[]}</span></h4>
</dt>
<dd>
<div class="description">
<p>Create an array representing the inclusive range of numbers (usually integers) in <code>[start, end]</code>.
This is equivalent to <code>numberArrayStep(start, end, 1)</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>start</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The minimum value the array starts with.</p></td>
</tr>
<tr>
<td class="name"><code>end</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"><p>The maximum value the array contains.</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 array of number values.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="ArrayUtils.js.html">utils/ArrayUtils.js</a>, <a href="ArrayUtils.js.html#sunlight-1-line-214">line 214</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="numberArrayStep"><span class="type-signature"></span>numberArrayStep<span class="signature">(start, end, <span class="optional">step</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Create an array of numbers (positive and/or negative) progressing from <code>start</code>
up to but not including <code>end</code> by advancing by <code>step</code>.</p>
<p>If <code>start</code> is less than <code>stop</code> a zero-length range is created unless a negative <code>step</code> is specified.</p>
<p>Certain values for <code>start</code> and <code>end</code> (eg. NaN/undefined/null) are coerced to 0;
for forward compatibility make sure to pass in actual numbers.</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>start</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 start of the range.</p></td>
</tr>
<tr>
<td class="name"><code>end</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The end of the range.</p></td>
</tr>
<tr>
<td class="name"><code>step</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>The value to increment or decrement by.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">Array</span>
-
</div>
<div class="returns-desc param-desc">
<p>Returns the new array of numbers.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - See Phaser.ArrayUtils.numberArrayStep</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-450">line 450</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="numberArrayStep"><span class="type-signature"></span>numberArrayStep<span class="signature">(start, end, <span class="optional">step</span>)</span><span class="type-signature"> &rarr; {Array}</span></h4>
</dt>
<dd>
<div class="description">
<p>Create an array of numbers (positive and/or negative) progressing from <code>start</code>
up to but not including <code>end</code> by advancing by <code>step</code>.</p>
<p>If <code>start</code> is less than <code>stop</code> a zero-length range is created unless a negative <code>step</code> is specified.</p>
<p>Certain values for <code>start</code> and <code>end</code> (eg. NaN/undefined/null) are currently coerced to 0;
for forward compatibility make sure to pass in actual numbers.</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>start</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 start of the range.</p></td>
</tr>
<tr>
<td class="name"><code>end</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
</td>
<td class="default">
</td>
<td class="description last"><p>The end of the range.</p></td>
</tr>
<tr>
<td class="name"><code>step</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="attributes">
&lt;optional><br>
</td>
<td class="default">
1
</td>
<td class="description last"><p>The value to increment or decrement by.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">Array</span>
-
</div>
<div class="returns-desc param-desc">
<p>Returns the new array of numbers.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="ArrayUtils.js.html">utils/ArrayUtils.js</a>, <a href="ArrayUtils.js.html#sunlight-1-line-236">line 236</a>
</dt>
</dl>
<h5>Example</h5>
<pre class="sunlight-highlight-javascript">Phaser.Math.numberArrayStep(4);
// => [0, 1, 2, 3]
Phaser.Math.numberArrayStep(1, 5);
// => [1, 2, 3, 4]
Phaser.Math.numberArrayStep(0, 20, 5);
// => [0, 5, 10, 15]
Phaser.Math.numberArrayStep(0, -4, -1);
// => [0, -1, -2, -3]
Phaser.Math.numberArrayStep(1, 4, 0);
// => [1, 1, 1]
Phaser.Math.numberArrayStep(0);
// => []</pre>
</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"> &rarr; {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">
&lt;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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1226">line 1226</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"> &rarr; {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>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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1270">line 1270</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="randomSign"><span class="type-signature"></span>randomSign<span class="signature">()</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Randomly returns either a 1 or -1.</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>Either 1 or -1</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use Phaser.Utils.randomChoice or other</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-564">line 564</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="removeRandom"><span class="type-signature"></span>removeRandom<span class="signature">(objects, startIndex, length)</span><span class="type-signature"> &rarr; {object}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Removes a random object from the given array and returns it.</p>
<p>Will return null if there are no array items that fall within the specified range
or if there is no item for the randomly choosen index.</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>objects</code></td>
<td class="type">
<span class="param-type">any[]</span>
</td>
<td class="description last"><p>An array of objects.</p></td>
</tr>
<tr>
<td class="name"><code>startIndex</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last"><p>Optional offset off the front of the array. Default value is 0, or the beginning of the array.</p></td>
</tr>
<tr>
<td class="name"><code>length</code></td>
<td class="type">
<span class="param-type">integer</span>
</td>
<td class="description last"><p>Optional restriction on the number of values you want to randomly select from.</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>The random object that was removed.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.ArrayUtils.html#removeRandomItem">Phaser.ArrayUtils.removeRandomItem</a></li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-948">line 948</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"> &rarr; {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>Returns the reverse angle, in radians.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-377">line 377</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-997">line 997</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name "
id="roundTo"><span class="type-signature"></span>roundTo<span class="signature">(value, place, base)</span><span class="type-signature"> &rarr; {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.
The <code>place</code> is represented by the power applied to <code>base</code> to get that place.</p>
<pre><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
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 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 round.</p></td>
</tr>
<tr>
<td class="name"><code>place</code></td>
<td class="type">
<span class="param-type">number</span>
</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="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">
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-231">line 231</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-122">line 122</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="shift"><span class="type-signature"></span>shift<span class="signature">(array)</span><span class="type-signature"> &rarr; {any}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Moves the element from the start of the array to the end, shifting all items in the process.</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>array</code></td>
<td class="type">
<span class="param-type">any[]</span>
</td>
<td class="description last"><p>The array to shift/rotate. The array is modified.</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">any</span>
-
</div>
<div class="returns-desc param-desc">
<p>The shifted value.</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.ArrayUtils.html#rotate">Phaser.ArrayUtils.rotate</a> instead</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1049">line 1049</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="shuffleArray"><span class="type-signature"></span>shuffleArray<span class="signature">(array)</span><span class="type-signature"> &rarr; {any[]}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Shuffles the data in the given array into a new order.</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>array</code></td>
<td class="type">
<span class="param-type">any[]</span>
</td>
<td class="description last"><p>The array to shuffle</p></td>
</tr>
</tbody>
</table>
<h5>Returns:</h5>
<div class="returns">
<div class="returns-type">
<span class="param-type">any[]</span>
-
</div>
<div class="returns-desc param-desc">
<p>The array</p>
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use <a href="Phaser.ArrayUtils.html#shuffle">Phaser.ArrayUtils.shuffle</a></li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1066">line 1066</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1213">line 1213</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"> &rarr; {Object}</span></h4>
</dt>
<dd>
<div class="description">
<p>Generate a sine and cosine table simultaneously and extremely quickly. Based on research by Franky of scene.at</p>
<p>The parameters allow you to specify the length, amplitude and frequency of the wave. Once you have called this function
you should get the results via getSinTable() and getCosTable(). This generator is fast enough to be used in real-time.</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1009">line 1009</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Smootherstep function as detailed at <a href="http://en.wikipedia.org/wiki/Smoothstep">http://en.wikipedia.org/wiki/Smoothstep</a></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>min</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>max</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1199">line 1199</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"> &rarr; {number}</span></h4>
</dt>
<dd>
<div class="description">
<p>Smoothstep function as detailed at <a href="http://en.wikipedia.org/wiki/Smoothstep">http://en.wikipedia.org/wiki/Smoothstep</a></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>min</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>max</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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1185">line 1185</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"> &rarr; {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 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="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="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">
&lt;optional><br>
</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">
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-131">line 131</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"> &rarr; {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. 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 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="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="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">
&lt;optional><br>
</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">
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-183">line 183</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"> &rarr; {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. 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 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="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="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">
&lt;optional><br>
</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">
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-157">line 157</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="snapToInArray"><span class="type-signature"></span>snapToInArray<span class="signature">(input, arr, sort)</span><span class="type-signature"> &rarr; {number}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<div class="description">
<p>Snaps a value to the nearest value in an array.</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>input</code></td>
<td class="type">
<span class="param-type">number</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>arr</code></td>
<td class="type">
<span class="param-type">number[]</span>
</td>
<td class="description last"></td>
</tr>
<tr>
<td class="name"><code>sort</code></td>
<td class="type">
<span class="param-type">boolean</span>
</td>
<td class="description last"><p>True if the array needs to be sorted.</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="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - See <a href="Phaser.ArrayUtils.html#findClosest">Phaser.ArrayUtils.findClosest</a> for an alternative.</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-209">line 209</a>
</dt>
</dl>
</dd>
<dt>
<h4 class="name toc-deprecated"
id="truncate"><span class="type-signature"></span>truncate<span class="signature">(n)</span><span class="type-signature"> &rarr; {integer}</span></h4>
</dt>
<dd>
<dt class="important deprecated-notice">
This method is <em>deprecated</em> and should not be used. It may be removed in the future.
</dt>
<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">integer</span>
-
</div>
<div class="returns-desc param-desc">
</div>
</div>
<dl class="details">
<dt class="important tag-deprecated">Deprecated:</dt>
<dd class="tag-deprecated"><ul>
<li>2.2.0 - Use `Math.trunc` (now with polyfill)</li>
</ul></dd>
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-112">line 112</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"> &rarr; {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 &lt;= tolerance of b.</p>
</div>
</div>
<dl class="details">
<dt class="tag-source">Source -
<a href="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-1156">line 1156</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-496">line 496</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"> &rarr; {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">
&lt;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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-723">line 723</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"> &rarr; {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="Math.js.html">math/Math.js</a>, <a href="Math.js.html#sunlight-1-line-527">line 527</a>
</dt>
</dl>
</dd>
</dl>
</article>
</section>
</div>
<div class="clearfix"></div>
<footer>
<span class="copyright">
Phaser Copyright © 2012-2014 Photon Storm Ltd.
</span>
<br />
<span class="jsdoc-message">
Documentation generated by <a href="https://github.com/jsdoc3/jsdoc">JSDoc 3.3.0-dev</a>
on Thu Dec 04 2014 11:32:39 GMT-0000 (GMT) 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>