photonstorm
93b1f3eba1
Math.between will return a value between the given min
and max
values.
2016-06-03 16:18:35 +01:00
Richard Davey
358cc6b8d0
Merge pull request #2428 from EJanuszewski/radToDeg-typo
...
Fix typo in Math radToDeg description
2016-04-13 14:18:18 +01:00
photonstorm
b9fab96471
Improved docs.
2016-04-09 00:25:56 +01:00
photonstorm
b162ca4d51
Improved Math.clamp and docs.
2016-04-07 16:14:44 +01:00
photonstorm
f40cfbe2ae
2015 - 2016.
2016-04-04 22:16:16 +01:00
Edward Januszewski
a9e4d956b3
Fix typo in Math radToDeg description
2016-03-29 21:14:55 +01:00
Taylan Kasap
1310daa9af
Added RandomDataGenerator.sign (returns -1 or +1)
2016-02-07 14:25:19 +02:00
Richard Davey
4143b3f3ae
rnd check fix.
2015-09-19 11:58:25 +01:00
Richard Davey
96de58cc5f
Added lots more info to the jsdocs and tidied up the code for #2056
2015-09-19 11:50:26 +01:00
luckylooke
63f5df9c65
Feature: Allow random generator to get/set state
2015-09-07 21:47:36 +02:00
photonstorm
f0d7da1c56
Removed RND.float as it's a reserved word :(
...
Fixed jshint errors.
2015-08-27 19:28:01 +01:00
photonstorm
ddcc46124c
RandomDataGenerator.float is a new alias for the method 'realInRange' and takes the same arguments.
2015-08-27 14:57:23 +01:00
Richard Davey
a1bd35fc35
Tidied up formatting and improved jsdocs.
2015-08-26 19:13:46 +01:00
Rusty Rountree
f017db806a
Phaser.Math.fuzzyCeil and Phaser.Math.fuzzyFloor should not return boolean values as stated in @return section of the comments
2015-08-25 04:06:06 -05:00
Rusty Rountree
92bac852c8
Optimize the average function in math.js
2015-08-25 02:16:31 -05:00
photonstorm
f15fe6706c
All undefined argument checks were changed from if (typeof x === 'undefined')
to if (x === undefined)
removing the typeof check and saving some bytes across the codebase in the process.
2015-07-22 10:37:15 +01:00
photonstorm
1b5da312d0
RandomDataGenerator.weightedPick has been tweaked slightly to allow for a more even distribution of weights. It still favors the earlier array elements, but will accurately include 'distance' elements as well (thanks @gingerbeardman #1751 )
2015-07-08 17:20:36 +01:00
Richard Davey
ae08b9ac02
Text tab support working. Now to add varying tab sizing.
2015-07-07 23:31:44 +01:00
photonstorm
102c74e121
Deprecated the following:
...
* Camera.screenView
* ScaleManager.maxIterations
* ScaleManager.enterPortrait (see onOrientationChange)
* ScaleManager.enterLandscape (see onOrientationChange)
* ScaleManager.enterFullScreen (see onFullScreenChange)
* ScaleManager.leaveFullScreen (see onFullScreenChange)
* ScaleManager.fullScreenFailed (see onFullScreenError)
* ScaleManager.checkResize
* ScaleManager.checkOrientation
* ScaleManager.setScreenSize (see updateLayout)
* ScaleManager.setSize (see reflowCanvas)
* ScaleManager.checkOrientationState (see reflowCanvas)
* ScaleManager.orientation (see screenOrientation)
* Gamepad.disabled (see enabled)
* Input.currentPointers (see totalActivePointers)
* Input.disabled (see enabled)
* Keyboard.disabled (see enabled)
* Mouse.disabled (see enabled)
* Mouse.mouseMoveCallback (see Input.addMoveCallback)
* MSPointer.disabled (see enabled)
* Touch.disabled (see enabled)
* Cache.getUrl (see getURL)
* Math.truncate (see Math.trunc)
* Math.snapToInArray (see Phaser.ArrayUtils.findClosest)
* Math.interpolateFloat (see Math.linear)
* Math.normalizeLatitude (use Phaser.Math.clamp(lat, -90, 90))
* Math.normalizeLongitude (use Phaser.Math.wrap(lng, -180, 180))
* Math.chanceRoll (use Phaser.Utils.chanceRoll)
* Math.numberArray (use Phaser.ArrayUtils.numberArray)
* Math.numberArrayStep (use Phaser.ArrayUtils.numberArrayStep)
* Math.limitValue (use Phaser.Math.clamp)
* Math.randomSign (use Phaser.Utils.randomChoice(-1, 1))
* Math.angleLimit (use Phaser.Math.clamp)
* Math.getRandom (use Phaser.ArrayUtils.getRandomItem)
* Math.removeRandom (use Phaser.ArrayUtils.removeRandomItem)
* Math.floor (use Math.trunc)
* Math.ceil (use Phaser.Math.roundAwayFromZero)
* Math.shift (use Phaser.ArrayUtils.rotate)
* Math.shuffleArray (use Phaser.ArrayUtils.shuffle)
* Math.distanceRounded (do the rounding locally)
* Canvas.getOffset (see Phaser.DOM.getOffset)
* Canvas.getAspectRatio (see Phaser.DOM.getAspectRatio)
* TilemapLayer.tileColor (use TilemapLayer.debugSettings.missingImageFill)
* Phaser.ArrayList alias removed, now use Phaser.ArraySet
* Utils.transposeArray (see Phaser.ArrayUtils.transposeMatrix)
* Utils.rotateArray (see Phaser.ArrayUtils.rotateMatrix)
* Utils.shuffle (see Phaser.ArrayUtils.shuffle)
2015-06-17 03:14:31 +01:00
photonstorm
04a25c5d9b
Small fix + jsdoc update.
2015-06-17 01:04:55 +01:00
photonstorm
5a91f85b1f
Typo.
2015-05-19 16:57:36 +01:00
Richard Davey
4431e72711
Merge pull request #1770 from jeremyosborne/distsq
...
Fix for #1761 : [Feature Request] Add Math.distanceSq().
2015-05-19 16:14:57 +01:00
Rodrigo Silveira
ce7bcb2243
Return actual boolean value instead of 1
...
This is particularly helpful when doing === comparisons. Now isOdd is
consistent with isEven, which returns actual boolean values as well.
2015-05-13 05:59:34 -03:00
Jeremy Osborne
61f24f1719
Fix for #1761 : [Feature Request] Add Math.distanceSq(). Also, first attempt at a pull request for Phaser.
2015-04-28 10:03:35 -07:00
photonstorm
3f30a3d0d2
jsdocs updates.
2015-03-23 10:11:39 +00:00
photonstorm
a69e53f901
Copyright date change.
2015-02-25 03:36:23 +00:00
photonstorm
01a23b7d91
Tween.to now correctly accepts arrays are destination values, which makes the Tween interpolate through each value specified in the array using the defined Tween.interpolation method (see new example, thanks @FridayMarch26th #1619 )
...
Tween.interpolationFunction was using the incorrect context to invoke the function. This is now defined in `TweenData.interpolationFunctionContext` and defaults to `Phaser.Math`. If you provide your own interpolation function then please adjust the context accordingly (thanks @FridayMarch26th #1618 )
2015-02-16 12:23:54 +00:00
photonstorm
689501c15c
Phaser.Point.angleSq removed. It didn't work so any code relying on it would be broken, and it's unclear what it was meant for (thanks @nextht #1396 )
2015-01-05 13:00:07 +00:00
Paul
b3808890b2
RandomDataGenerator seeding fix
...
Per https://github.com/photonstorm/phaser/issues/1457 the `sow` function
terminates too early on certain false-y values including 0 (and possibly
"").
This changes that, so that 1) only `undefined` and `null` will terminate
the seed sequence processing (this is to maximize backwards compatibility)
and 2) the `length` of the array is honored.
The documentation also reflects the old (and new/altered) behavior.
This is very minor breaking change; hopefully such is mitigated with
leaving in the null/undefined termination.
2014-12-15 00:18:23 -08:00
Paul
fb9eab76e7
Utils - cleanup
...
- Updated linked documentation
- Also updated `removeRandomItem` per the contract and for consistency with
`getRandomItem`.
2014-12-01 23:19:32 -08:00
Paul
dab8772de0
Documentation - consistency updates
...
- Updated `readOnly` doclet to `readonly`
- `array` refined to `type[]`, where such information was immediately
determinable.
- Updated {Any}/{*} to {any}; {...*} is standard exception
- Udated {Object} to {object}
2014-11-30 04:03:35 -08:00
Paul
ae6cba5928
Math/Utils - various cleanup and deprecations/moves
...
- FIX/CHANGE - Math.wrapAngle over radians; it would convert radians to degrees
- No internal code relies on unexpected the radians-to-degrees behavior
- Moved additional methods over to ArrayUtils, only marked deprecated in Math
- Removed some private annotations; e.g. linear / factorial public, but bernstein / catmullRom still protected
- Marked additional duplicates deprecated; e.g linearValue, angleLimit
- Documentation updates
- Fixed some accidental "Utils.Arrays" usage (oops!)
- Bumped deprecations from 2.1.4 to 2.2.0
2014-11-11 21:28:25 -08:00
Paul
d941e285a3
Math/Utils - various cleanup and deprecations/moves
...
- And one last before..
2014-11-09 17:40:54 -08:00
Paul
a35d032238
Math/Utils - various cleanup and deprecations/moves
...
- Put in the missing changes..
2014-11-09 17:26:07 -08:00
Paul
a6d2da2a8a
Math/Utils - various cleanup and deprecations/moves
...
There are no known breaking changes.
- Timer
- Uses standard Math.min/Math.max (it's better 2, 3 items).
- Math
- Updated documentation
- Marked various Math functions as deprecated, proxying as appropriate
- Array-based functions -> ArrayUtils
- RNG-based functions -> Utils
- Updated core-usage
- floor/ceil should not be used (alternatives provided)
- Altered for some equivalencies
- Also fixes some assorted issues
- Marked a few internal functions as private
- Utils
- Moved polyfills to their own file for better visibility
- Moved array functions to ArrayUtils and marked proxies as deprecated
- Created Phaser.ArrayUtils for array-related functions
- polyfills moved to their own file
- Functions given function names
- Added Math.trunc
2014-11-09 16:17:18 -08:00
photonstorm
96fd0ade74
JSDoc fixes.
2014-10-21 22:43:42 +01:00
photonstorm
f2aa263d0a
jsdoc fix
2014-10-06 07:00:00 +01:00
photonstorm
20551f9129
Lots of jsdocs fixes ready for the new doc generator.
2014-09-16 17:35:08 +01:00
photonstorm
3fc527ba53
Added Math.numberArray back in and renamed the replacement to Math.numberArrayStep to avoid breaking the API.
2014-09-09 12:49:17 +01:00
photonstorm
79d873f47b
If you are using CocoonJS, please set your game render type to CANVAS and not WEBGL or AUTO. You should also disable any of the ScaleManager screen resizing or margin setting code. By default in this mode CocoonJS will now set 'screencanvas=true' which helps with performance significantly.
2014-09-08 22:34:53 +01:00
Jeremy Dowell
06c6b23454
moved: Utils.range to Math.numberArray
2014-09-05 09:36:36 -05:00
devinb83
2be45e93ae
QuadTree leveling Bug
...
Rather than level++ which changes the current node's level, the subnodes should get the current node's level + 1
2014-07-14 12:55:26 -07:00
Alvin
6f0a9115c4
Made the code jshint-friendly
2014-06-24 11:26:05 +02:00
Alvin
9e2ca08722
Added factorial and changed interpolation docs
2014-06-24 11:23:20 +02:00
photonstorm
7836f3acd9
Added RandomDataGenerator.between (an alias for integerInRange)
2014-06-06 04:12:35 +01:00
photonstorm
78ec29facc
RandomDataGenerator.integerInRange would return a non-integer value if you passed in a float.
2014-05-09 16:39:45 +01:00
photonstorm
e06f249d9b
Commented out 2 functions that don't currently work.
2014-05-09 16:39:45 +01:00
Richard Davey
570e8acabb
Joystick updates.
2014-05-07 18:10:13 +01:00
photonstorm
2b40c8a7c7
Pointer.type and Pointer.exists properties added.
...
QuadTree.retrieve can now accept either a Sprite with a physics body or a Phaser.Rectangle as its parameter.
ArcadePhysics.getObjectsUnderPointer will return all children from a Group that overlap with the given Pointer.
2014-05-06 02:45:10 +01:00
Gaëtan Renaudeau
1f948d8994
Fix #771 : make smoothstep(x,a,b) work if a > b
2014-04-28 15:16:51 +02:00