0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-26 13:49:01 -05:00

improved docs

This commit is contained in:
liabru 2015-12-27 21:14:24 +00:00
parent 110aea84e7
commit 2e6afd477a
28 changed files with 149 additions and 152 deletions

View file

@ -3,8 +3,7 @@
* A `Matter.Body` is a rigid body that can be simulated by a `Matter.Engine`.
* Factories for commonly used body configurations (such as rectangles, circles and other polygons) can be found in the module `Matter.Bodies`.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
* @class Body
*/

View file

@ -4,8 +4,7 @@
* It is important to use the functions in this module to modify composites, rather than directly modifying their properties.
* Note that the `Matter.World` object is also a type of `Matter.Composite` and as such all composite methods here can also operate on a `Matter.World`.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Composite
*/
@ -152,7 +151,7 @@ var Body = require('./Body');
};
/**
* Adds a composite to the given composite
* Adds a composite to the given composite.
* @private
* @method addComposite
* @param {composite} compositeA
@ -167,7 +166,7 @@ var Body = require('./Body');
};
/**
* Removes a composite from the given composite, and optionally searching its children recursively
* Removes a composite from the given composite, and optionally searching its children recursively.
* @private
* @method removeComposite
* @param {composite} compositeA
@ -192,7 +191,7 @@ var Body = require('./Body');
};
/**
* Removes a composite from the given composite
* Removes a composite from the given composite.
* @private
* @method removeCompositeAt
* @param {composite} composite
@ -206,7 +205,7 @@ var Body = require('./Body');
};
/**
* Adds a body to the given composite
* Adds a body to the given composite.
* @private
* @method addBody
* @param {composite} composite
@ -220,7 +219,7 @@ var Body = require('./Body');
};
/**
* Removes a body from the given composite, and optionally searching its children recursively
* Removes a body from the given composite, and optionally searching its children recursively.
* @private
* @method removeBody
* @param {composite} composite
@ -245,7 +244,7 @@ var Body = require('./Body');
};
/**
* Removes a body from the given composite
* Removes a body from the given composite.
* @private
* @method removeBodyAt
* @param {composite} composite
@ -259,7 +258,7 @@ var Body = require('./Body');
};
/**
* Adds a constraint to the given composite
* Adds a constraint to the given composite.
* @private
* @method addConstraint
* @param {composite} composite
@ -273,7 +272,7 @@ var Body = require('./Body');
};
/**
* Removes a constraint from the given composite, and optionally searching its children recursively
* Removes a constraint from the given composite, and optionally searching its children recursively.
* @private
* @method removeConstraint
* @param {composite} composite
@ -297,7 +296,7 @@ var Body = require('./Body');
};
/**
* Removes a body from the given composite
* Removes a body from the given composite.
* @private
* @method removeConstraintAt
* @param {composite} composite
@ -311,8 +310,8 @@ var Body = require('./Body');
};
/**
* Removes all bodies, constraints and composites from the given composite
* Optionally clearing its children recursively
* Removes all bodies, constraints and composites from the given composite.
* Optionally clearing its children recursively.
* @method clear
* @param {composite} composite
* @param {boolean} keepStatic
@ -339,7 +338,7 @@ var Body = require('./Body');
};
/**
* Returns all bodies in the given composite, including all bodies in its children, recursively
* Returns all bodies in the given composite, including all bodies in its children, recursively.
* @method allBodies
* @param {composite} composite
* @return {body[]} All the bodies
@ -354,7 +353,7 @@ var Body = require('./Body');
};
/**
* Returns all constraints in the given composite, including all constraints in its children, recursively
* Returns all constraints in the given composite, including all constraints in its children, recursively.
* @method allConstraints
* @param {composite} composite
* @return {constraint[]} All the constraints
@ -369,7 +368,7 @@ var Body = require('./Body');
};
/**
* Returns all composites in the given composite, including all composites in its children, recursively
* Returns all composites in the given composite, including all composites in its children, recursively.
* @method allComposites
* @param {composite} composite
* @return {composite[]} All the composites
@ -384,7 +383,7 @@ var Body = require('./Body');
};
/**
* Searches the composite recursively for an object matching the type and id supplied, null if not found
* Searches the composite recursively for an object matching the type and id supplied, null if not found.
* @method get
* @param {composite} composite
* @param {number} id
@ -418,7 +417,7 @@ var Body = require('./Body');
};
/**
* Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add)
* Moves the given object(s) from compositeA to compositeB (equal to a remove followed by an add).
* @method move
* @param {compositeA} compositeA
* @param {object[]} objects
@ -432,7 +431,7 @@ var Body = require('./Body');
};
/**
* Assigns new ids for all objects in the composite, recursively
* Assigns new ids for all objects in the composite, recursively.
* @method rebase
* @param {composite} composite
* @return {composite} Returns composite

View file

@ -5,8 +5,7 @@
* It is important to use the functions in the `Matter.Composite` module to modify the world composite, rather than directly modifying its properties.
* There are also a few methods here that alias those in `Matter.Composite` for easier readability.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class World
* @extends Composite

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Contact` module contains methods for creating and manipulating collision contacts.
*
* @class Contact
*/
@ -11,7 +11,7 @@ module.exports = Contact;
(function() {
/**
* Description
* Creates a new contact.
* @method create
* @param {vertex} vertex
* @return {contact} A new contact
@ -26,7 +26,7 @@ module.exports = Contact;
};
/**
* Description
* Generates a contact id.
* @method id
* @param {vertex} vertex
* @return {string} Unique contactID

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Detector` module contains methods for detecting collisions given a set of pairs.
*
* @class Detector
*/
@ -17,7 +17,7 @@ var Bounds = require('../geometry/Bounds');
(function() {
/**
* Description
* Finds all collisions given a list of pairs.
* @method collisions
* @param {pair[]} broadphasePairs
* @param {engine} engine

View file

@ -1,6 +1,5 @@
/**
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* The `Matter.Grid` module contains methods for creating and manipulating collision broadphase grid structures.
*
* @class Grid
*/
@ -16,7 +15,7 @@ var Common = require('../core/Common');
(function() {
/**
* Description
* Creates a new grid.
* @method create
* @param {} options
* @return {grid} A new grid
@ -36,7 +35,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Updates the grid.
* @method update
* @param {grid} grid
* @param {body[]} bodies
@ -125,7 +124,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Clears the grid.
* @method clear
* @param {grid} grid
*/
@ -136,12 +135,12 @@ var Common = require('../core/Common');
};
/**
* Description
* Finds the union of two regions.
* @method _regionUnion
* @private
* @param {} regionA
* @param {} regionB
* @return CallExpression
* @return {} region
*/
var _regionUnion = function(regionA, regionB) {
var startCol = Math.min(regionA.startCol, regionB.startCol),
@ -153,12 +152,12 @@ var Common = require('../core/Common');
};
/**
* Description
* Gets the region a given body falls in for a given grid.
* @method _getRegion
* @private
* @param {} grid
* @param {} body
* @return CallExpression
* @return {} region
*/
var _getRegion = function(grid, body) {
var bounds = body.bounds,
@ -171,14 +170,14 @@ var Common = require('../core/Common');
};
/**
* Description
* Creates a region.
* @method _createRegion
* @private
* @param {} startCol
* @param {} endCol
* @param {} startRow
* @param {} endRow
* @return ObjectExpression
* @return {} region
*/
var _createRegion = function(startCol, endCol, startRow, endRow) {
return {
@ -191,24 +190,24 @@ var Common = require('../core/Common');
};
/**
* Description
* Gets the bucket id at the given position.
* @method _getBucketId
* @private
* @param {} column
* @param {} row
* @return BinaryExpression
* @return {string} bucket id
*/
var _getBucketId = function(column, row) {
return column + ',' + row;
};
/**
* Description
* Creates a bucket.
* @method _createBucket
* @private
* @param {} buckets
* @param {} bucketId
* @return bucket
* @return {} bucket
*/
var _createBucket = function(buckets, bucketId) {
var bucket = buckets[bucketId] = [];
@ -216,7 +215,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Adds a body to a bucket.
* @method _bucketAddBody
* @private
* @param {} grid
@ -248,7 +247,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Removes a body from a bucket.
* @method _bucketRemoveBody
* @private
* @param {} grid
@ -273,11 +272,11 @@ var Common = require('../core/Common');
};
/**
* Description
* Generates a list of the active pairs in the grid.
* @method _createActivePairsList
* @private
* @param {} grid
* @return pairs
* @return [] pairs
*/
var _createActivePairsList = function(grid) {
var pairKeys,
@ -303,4 +302,4 @@ var Common = require('../core/Common');
return pairs;
};
})();
})();

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Pair` module contains methods for creating and manipulating collision pairs.
*
* @class Pair
*/
@ -13,7 +13,7 @@ var Contact = require('./Contact');
(function() {
/**
* Description
* Creates a pair.
* @method create
* @param {collision} collision
* @param {number} timestamp
@ -48,7 +48,7 @@ var Contact = require('./Contact');
};
/**
* Description
* Updates a pair given a collision.
* @method update
* @param {pair} pair
* @param {collision} collision
@ -91,7 +91,7 @@ var Contact = require('./Contact');
};
/**
* Description
* Set a pair as active or inactive.
* @method setActive
* @param {pair} pair
* @param {bool} isActive
@ -108,7 +108,7 @@ var Contact = require('./Contact');
};
/**
* Description
* Get the id for the given pair.
* @method id
* @param {body} bodyA
* @param {body} bodyB

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Pairs` module contains methods for creating and manipulating collision pair sets.
*
* @class Pairs
*/
@ -16,7 +16,7 @@ var Common = require('../core/Common');
var _pairMaxIdleLife = 1000;
/**
* Creates a new pairs structure
* Creates a new pairs structure.
* @method create
* @param {object} options
* @return {pairs} A new pairs structure
@ -32,7 +32,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Updates pairs given a list of collisions.
* @method update
* @param {object} pairs
* @param {collision[]} collisions
@ -99,7 +99,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Finds and removes pairs that have been inactive for a set amount of time.
* @method removeOld
* @param {object} pairs
* @param {number} timestamp
@ -139,7 +139,7 @@ var Common = require('../core/Common');
};
/**
* Clears the given pairs structure
* Clears the given pairs structure.
* @method clear
* @param {pairs} pairs
* @return {pairs} pairs

View file

@ -1,6 +1,8 @@
/**
* The `Matter.Query` module contains methods for performing collision queries.
*
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Query
*/
@ -107,4 +109,4 @@ var Vertices = require('../geometry/Vertices');
return result;
};
})();
})();

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Resolver` module contains methods for resolving collision pairs.
*
* @class Resolver
*/
@ -22,7 +22,7 @@ var Bounds = require('../geometry/Bounds');
Resolver._frictionNormalMultiplier = 5;
/**
* Description
* Prepare pairs for position solving.
* @method preSolvePosition
* @param {pair[]} pairs
*/
@ -45,7 +45,7 @@ var Bounds = require('../geometry/Bounds');
};
/**
* Description
* Find a solution for pair positions.
* @method solvePosition
* @param {pair[]} pairs
* @param {number} timeScale
@ -116,7 +116,7 @@ var Bounds = require('../geometry/Bounds');
};
/**
* Description
* Apply position resolution.
* @method postSolvePosition
* @param {body[]} bodies
*/
@ -155,7 +155,7 @@ var Bounds = require('../geometry/Bounds');
};
/**
* Description
* Prepare pairs for velocity solving.
* @method preSolveVelocity
* @param {pair[]} pairs
*/
@ -222,7 +222,7 @@ var Bounds = require('../geometry/Bounds');
};
/**
* Description
* Find a solution for pair velocities.
* @method solveVelocity
* @param {pair[]} pairs
* @param {number} timeScale

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.SAT` module contains methods for detecting collisions using the Separating Axis Theorem.
*
* @class SAT
*/
@ -16,7 +16,7 @@ var Vector = require('../geometry/Vector');
(function() {
/**
* Description
* Detect collision between two bodies using the Separating Axis Theorem.
* @method collides
* @param {body} bodyA
* @param {body} bodyB
@ -146,7 +146,7 @@ var Vector = require('../geometry/Vector');
};
/**
* Description
* Find the overlap between two sets of vertices.
* @method _overlapAxes
* @private
* @param {} verticesA
@ -185,7 +185,7 @@ var Vector = require('../geometry/Vector');
};
/**
* Description
* Projects vertices on an axis and returns an interval.
* @method _projectToAxis
* @private
* @param {} projection
@ -211,13 +211,13 @@ var Vector = require('../geometry/Vector');
};
/**
* Description
* Finds supporting vertices given two bodies along a given direction using hill-climbing.
* @method _findSupports
* @private
* @param {} bodyA
* @param {} bodyB
* @param {} normal
* @return ArrayExpression
* @return [vector]
*/
var _findSupports = function(bodyA, bodyB, normal) {
var nearestDistance = Number.MAX_VALUE,

View file

@ -3,8 +3,7 @@
* Constraints are used for specifying that a fixed distance must be maintained between two bodies (or a body and a fixed world-space position).
* The stiffness of constraints can be modified to create springs or elastic.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Constraint
*/
@ -79,7 +78,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Solves all constraints in a list of collisions.
* @private
* @method solveAll
* @param {constraint[]} constraints
@ -92,7 +91,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Solves a distance constraint with Gauss-Siedel method.
* @private
* @method solve
* @param {constraint} constraint
@ -247,7 +246,7 @@ var Common = require('../core/Common');
};
/**
* Performs body updates required after solving constraints
* Performs body updates required after solving constraints.
* @private
* @method postSolveAll
* @param {body[]} bodies

View file

@ -2,8 +2,7 @@
* The `Matter.MouseConstraint` module contains methods for creating mouse constraints.
* Mouse constraints are used for allowing user interaction, providing the ability to move bodies via the mouse or touch.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class MouseConstraint
*/
@ -129,7 +128,7 @@ var Bounds = require('../geometry/Bounds');
};
/**
* Triggers mouse constraint events
* Triggers mouse constraint events.
* @method _triggerEvents
* @private
* @param {mouse} mouseConstraint

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Common` module contains utility functions that are common to all modules.
*
* @class Common
*/
@ -14,7 +14,7 @@ module.exports = Common;
Common._seed = 0;
/**
* Description
* Extends the object in the first argument using the object in the second argument.
* @method extend
* @param {} obj
* @param {boolean} deep
@ -58,7 +58,7 @@ module.exports = Common;
};
/**
* Creates a new clone of the object, if deep is true references will also be cloned
* Creates a new clone of the object, if deep is true references will also be cloned.
* @method clone
* @param {} obj
* @param {bool} deep
@ -69,7 +69,7 @@ module.exports = Common;
};
/**
* Description
* Returns the list of keys for the given object.
* @method keys
* @param {} obj
* @return {string[]} keys
@ -86,7 +86,7 @@ module.exports = Common;
};
/**
* Description
* Returns the list of values for the given object.
* @method values
* @param {} obj
* @return {array} Array of the objects property values
@ -109,11 +109,11 @@ module.exports = Common;
};
/**
* Description
* Returns a hex colour string made by lightening or darkening color by percent.
* @method shadeColor
* @param {string} color
* @param {number} percent
* @return {string} A hex colour string made by lightening or darkening color by percent
* @return {string} A hex colour
*/
Common.shadeColor = function(color, percent) {
// http://stackoverflow.com/questions/5560248/programmatically-lighten-or-darken-a-hex-color
@ -128,7 +128,8 @@ module.exports = Common;
};
/**
* Description
* Shuffles the given array in-place.
* The function uses a seeded random generator.
* @method shuffle
* @param {array} array
* @return {array} array shuffled randomly
@ -144,7 +145,8 @@ module.exports = Common;
};
/**
* Description
* Randomly chooses a value from a list with equal probability.
* The function uses a seeded random generator.
* @method choose
* @param {array} choices
* @return {object} A random choice object from the array
@ -154,7 +156,7 @@ module.exports = Common;
};
/**
* Description
* Returns true if the object is a HTMLElement, otherwise false.
* @method isElement
* @param {object} obj
* @return {boolean} True if the object is a HTMLElement, otherwise false
@ -172,7 +174,7 @@ module.exports = Common;
};
/**
* Description
* Returns true if the object is an array.
* @method isArray
* @param {object} obj
* @return {boolean} True if the object is an array, otherwise false
@ -182,7 +184,7 @@ module.exports = Common;
};
/**
* Description
* Returns the given value clamped between a minimum and maximum value.
* @method clamp
* @param {number} value
* @param {number} min
@ -198,7 +200,7 @@ module.exports = Common;
};
/**
* Description
* Returns the sign of the given value.
* @method sign
* @param {number} value
* @return {number} -1 if negative, +1 if 0 or positive
@ -208,7 +210,7 @@ module.exports = Common;
};
/**
* Description
* Returns the current timestamp (high-res if available).
* @method now
* @return {number} the current timestamp (high-res if available)
*/
@ -232,7 +234,8 @@ module.exports = Common;
/**
* Description
* Returns a random value between a minimum and a maximum value inclusive.
* The function uses a seeded random generator.
* @method random
* @param {number} min
* @param {number} max
@ -245,7 +248,7 @@ module.exports = Common;
};
/**
* Converts a CSS hex colour string into an integer
* Converts a CSS hex colour string into an integer.
* @method colorToNumber
* @param {string} colorString
* @return {number} An integer representing the CSS hex string
@ -263,7 +266,7 @@ module.exports = Common;
};
/**
* A wrapper for console.log, for providing errors and warnings
* A wrapper for console.log, for providing errors and warnings.
* @method log
* @param {string} message
* @param {string} type
@ -285,7 +288,7 @@ module.exports = Common;
};
/**
* Returns the next unique sequential ID
* Returns the next unique sequential ID.
* @method nextId
* @return {Number} Unique sequential ID
*/
@ -294,7 +297,7 @@ module.exports = Common;
};
/**
* A cross browser compatible indexOf implementation
* A cross browser compatible indexOf implementation.
* @method indexOf
* @param {array} haystack
* @param {object} needle

View file

@ -3,8 +3,7 @@
* An engine is a controller that manages updating the simulation of the world.
* See `Matter.Runner` for an optional game loop utility.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Engine
*/

View file

@ -1,6 +1,7 @@
/**
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* The `Matter.Events` module contains methods to fire and listen to events on other objects.
*
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Events
*/
@ -106,4 +107,4 @@ var Common = require('./Common');
}
};
})();
})();

View file

@ -14,7 +14,7 @@ var Common = require('./Common');
(function() {
/**
* Description
* Creates a new metrics.
* @method create
* @private
* @return {metrics} A new metrics
@ -41,7 +41,7 @@ var Common = require('./Common');
};
/**
* Description
* Resets metrics.
* @method reset
* @private
* @param {metrics} metrics
@ -65,7 +65,7 @@ var Common = require('./Common');
};
/**
* Description
* Updates metrics.
* @method update
* @private
* @param {metrics} metrics
@ -90,4 +90,4 @@ var Common = require('./Common');
};
})();
// @endif
// @endif

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Mouse` module contains methods for creating and manipulating mouse inputs.
*
* @class Mouse
*/
@ -13,7 +13,7 @@ var Common = require('../core/Common');
(function() {
/**
* Description
* Creates a mouse input.
* @method create
* @param {HTMLElement} element
* @return {mouse} A new mouse
@ -108,7 +108,7 @@ var Common = require('../core/Common');
};
/**
* Sets the element the mouse is bound to (and relative to)
* Sets the element the mouse is bound to (and relative to).
* @method setElement
* @param {mouse} mouse
* @param {HTMLElement} element
@ -120,8 +120,8 @@ var Common = require('../core/Common');
element.addEventListener('mousedown', mouse.mousedown);
element.addEventListener('mouseup', mouse.mouseup);
element.addEventListener("mousewheel", mouse.mousewheel);
element.addEventListener("DOMMouseScroll", mouse.mousewheel);
element.addEventListener('mousewheel', mouse.mousewheel);
element.addEventListener('DOMMouseScroll', mouse.mousewheel);
element.addEventListener('touchmove', mouse.mousemove);
element.addEventListener('touchstart', mouse.mousedown);
@ -129,7 +129,7 @@ var Common = require('../core/Common');
};
/**
* Clears all captured source events
* Clears all captured source events.
* @method clearSourceEvents
* @param {mouse} mouse
*/
@ -142,7 +142,7 @@ var Common = require('../core/Common');
};
/**
* Sets the offset
* Sets the mouse position offset.
* @method setOffset
* @param {mouse} mouse
* @param {vector} offset
@ -155,7 +155,7 @@ var Common = require('../core/Common');
};
/**
* Sets the scale
* Sets the mouse position scale.
* @method setScale
* @param {mouse} mouse
* @param {vector} scale
@ -168,7 +168,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Gets the mouse position relative to an element given a screen pixel ratio.
* @method _getRelativeMousePosition
* @private
* @param {} event

View file

@ -6,8 +6,7 @@
* Instead just call `Engine.update(engine, delta)` in your own loop.
* Note that the method `Engine.run` is an alias for `Runner.run`.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Runner
*/

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Sleeping` module contains methods to manage the sleeping state of bodies.
*
* @class Sleeping
*/
@ -90,7 +90,7 @@ var Events = require('./Events');
};
/**
* Description
* Set a body as sleeping or awake.
* @method set
* @param {body} body
* @param {boolean} isSleeping
@ -126,4 +126,4 @@ var Events = require('./Events');
}
};
})();
})();

View file

@ -2,8 +2,7 @@
* The `Matter.Bodies` module contains factory methods for creating rigid body models
* with commonly used body configurations (such as rectangles, circles and other polygons).
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Bodies
*/

View file

@ -1,6 +1,8 @@
/**
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* The `Matter.Composites` module contains factory methods for creating composite bodies
* with commonly used configurations (such as stacks and chains).
*
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Composites
*/
@ -18,7 +20,8 @@ var Bodies = require('./Bodies');
(function() {
/**
* Description
* Create a new composite containing bodies created in the callback in a grid arrangement.
* This function uses the body's bounds to prevent overlaps.
* @method stack
* @param {number} xx
* @param {number} yy
@ -70,7 +73,7 @@ var Bodies = require('./Bodies');
};
/**
* Description
* Chains all bodies in the given composite together using constraints.
* @method chain
* @param {composite} composite
* @param {number} xOffsetA
@ -109,7 +112,7 @@ var Bodies = require('./Bodies');
};
/**
* Connects bodies in the composite with constraints in a grid pattern, with optional cross braces
* Connects bodies in the composite with constraints in a grid pattern, with optional cross braces.
* @method mesh
* @param {composite} composite
* @param {number} columns
@ -158,7 +161,8 @@ var Bodies = require('./Bodies');
};
/**
* Description
* Create a new composite containing bodies created in the callback in a pyramid arrangement.
* This function uses the body's bounds to prevent overlaps.
* @method pyramid
* @param {number} xx
* @param {number} yy
@ -198,7 +202,7 @@ var Bodies = require('./Bodies');
};
/**
* Description
* Creates a composite with a Newton's Cradle setup of bodies and constraints.
* @method newtonsCradle
* @param {number} xx
* @param {number} yy
@ -224,7 +228,7 @@ var Bodies = require('./Bodies');
};
/**
* Description
* Creates a composite with simple car setup of bodies and constraints.
* @method car
* @param {number} xx
* @param {number} yy
@ -297,7 +301,7 @@ var Bodies = require('./Bodies');
};
/**
* Creates a simple soft body like object
* Creates a simple soft body like object.
* @method softBody
* @param {number} xx
* @param {number} yy

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Axes` module contains methods for creating and manipulating sets of axes.
*
* @class Axes
*/
@ -14,7 +14,7 @@ var Common = require('../core/Common');
(function() {
/**
* Description
* Creates a new set of axes from the given vertices.
* @method fromVertices
* @param {vertices} vertices
* @return {axes} A new axes from the given vertices
@ -40,7 +40,7 @@ var Common = require('../core/Common');
};
/**
* Description
* Rotates a set of axes by the given angle.
* @method rotate
* @param {axes} axes
* @param {number} angle
@ -61,4 +61,4 @@ var Common = require('../core/Common');
}
};
})();
})();

View file

@ -1,5 +1,5 @@
/**
* _Internal Class_, not generally used outside of the engine's internals.
* The `Matter.Bounds` module contains methods for creating and manipulating axis-aligned bounding boxes (AABB).
*
* @class Bounds
*/
@ -11,7 +11,7 @@ module.exports = Bounds;
(function() {
/**
* Description
* Creates a new axis-aligned bounding box (AABB) for the given vertices.
* @method create
* @param {vertices} vertices
* @return {bounds} A new bounds object
@ -29,7 +29,7 @@ module.exports = Bounds;
};
/**
* Description
* Updates bounds using the given vertices and extends the bounds given a velocity.
* @method update
* @param {bounds} bounds
* @param {vertices} vertices
@ -65,7 +65,7 @@ module.exports = Bounds;
};
/**
* Description
* Returns true if the bounds contains the given point.
* @method contains
* @param {bounds} bounds
* @param {vector} point
@ -77,7 +77,7 @@ module.exports = Bounds;
};
/**
* Description
* Returns true if the two bounds intersect.
* @method overlaps
* @param {bounds} boundsA
* @param {bounds} boundsB
@ -89,7 +89,7 @@ module.exports = Bounds;
};
/**
* Translates the bounds by the given vector
* Translates the bounds by the given vector.
* @method translate
* @param {bounds} bounds
* @param {vector} vector
@ -102,7 +102,7 @@ module.exports = Bounds;
};
/**
* Shifts the bounds to the given position
* Shifts the bounds to the given position.
* @method shift
* @param {bounds} bounds
* @param {vector} position
@ -117,4 +117,4 @@ module.exports = Bounds;
bounds.max.y = position.y + deltaY;
};
})();
})();

View file

@ -1,8 +1,7 @@
/**
* The `Matter.Svg` module contains methods for converting SVG images into an array of vector points.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Svg
*/

View file

@ -3,8 +3,7 @@
* Vectors are the basis of all the geometry related operations in the engine.
* A `Matter.Vector` object is of the form `{ x: 0, y: 0 }`.
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Vector
*/

View file

@ -3,8 +3,7 @@
* A set of vertices is an array of `Matter.Vector` with additional indexing properties inserted by `Vertices.create`.
* A `Matter.Body` maintains a set of vertices to represent the shape of the object (its convex hull).
*
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class Vertices
*/

View file

@ -1,6 +1,5 @@
/**
* See [Demo.js](https://github.com/liabru/matter-js/blob/master/demo/js/Demo.js)
* and [DemoMobile.js](https://github.com/liabru/matter-js/blob/master/demo/js/DemoMobile.js) for usage examples.
* See the included usage [examples](https://github.com/liabru/matter-js/tree/master/examples).
*
* @class RenderPixi
*/