Members
(constant) BodyType :number
- Source:
Type:
- number
(constant) DEVICE
- Description:
- Contains values showing which features are supported,general model of the device and browser used.
- Source:
Contains values showing which features are supported,general model of the device and browser used.
(constant) Events :string
- Source:
Type:
- string
(constant) Logger
- Source:
- Deprecated:
- Yes
(constant) ObjType :number
- Source:
Type:
- number
(constant) RayCastModes :number
- Source:
Type:
- number
(constant) ShapeType :number
- Source:
Type:
- number
(constant) Storage
- Description:
- This provides permanent storage
- Source:
This provides permanent storage
Methods
AABBColliding(a, b)
- Description:
- Checks if two AABB overlap
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
BoundingBox | |
b |
BoundingBox |
AABBvsSphere(a, b)
- Description:
- Checks if An AABB and a CircleBound overlap
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
BoundingBox | |
b |
BoundingCircle |
AngleUpdate()
- Source:
ColorUpdate()
- Source:
NOOP(…_args) → {void}
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
_args |
* |
<repeatable> |
Returns:
- Type
- void
NoUpdateThrow()
- Source:
Vector2Update()
- Source:
Vector3Update()
- Source:
applyGravity(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
arc(ctx, x, y, r, start, end)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | Path2D | |
x |
number | |
y |
number | |
r |
number | |
start |
number | |
end |
number |
assert(test, message, errfunc)
- Description:
- Logs out a message,warning or error to the console according to the supplied log function.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
test |
boolean | |
message |
string | |
errfunc |
bodyDebugger(manager, optionsopt)
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
manager |
Manager | ||
options |
BodyDebbuggerOptions |
<optional> |
boundSpheresColliding(a, b)
- Description:
- Checks if two BoundingCircles overlap
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
BoundingCircle | |
b |
BoundingCircle |
boundsColliding(bound1, bound2)
- Description:
- Checks if any AABB or/and a BoundingCircle overlap
- Source:
Parameters:
Name | Type | Description |
---|---|---|
bound1 |
BoundingBox | BoundingCircle | |
bound2 |
BoundingCircle | BoundingBox |
checkifEquals(axis, axes)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
axis |
Vector2 | |
axes |
Array.<Vector2> |
circle(ctx, x, y, r)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | Path2D | |
x |
number | |
y |
number | |
r |
number |
clamp(value, min, max) → {number}
- Description:
- Clamps a value between two numbers.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
number | The number to clamp. |
min |
number | The minimal bound of the clamped number. |
max |
number | The maximum bound of the clamped number. |
Returns:
- Type
- number
collisionResponse(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
dampenVelocity(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
defaultCollisionHandler(clmds)
- Description:
- This provides a way to fire off an entity's collision event handler registered to it.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
clmds |
Array.<Manifold> | an array of collision manifolds |
defaultPrecollisionHandler(clmds)
- Description:
- This provides a way to fire off an entity's precollision event handler registered to it
- Source:
Parameters:
Name | Type | Description |
---|---|---|
clmds |
Array.<CollisionPair> | an array of collision manifolds |
degToRad(deg) → {number}
- Description:
- Converts a degree to a radian.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
deg |
number | number to convert. |
Returns:
- Type
- number
deprecate(original, replacementopt)
- Description:
- Logs out a warning to the console.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
original |
string | ||
replacement |
string |
<optional> |
drawArm(ctx, position, arm)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | |
position |
Vector2 | |
arm |
Vector2 |
drawArmRaw(ctx, position, arm)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | |
position |
Vector2 | |
arm |
Vector2 |
drawImage(ctx, img, x, y, wopt, hopt, ixopt, iyopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ctx |
CanvasRenderingContext2D | |||
img |
HTMLImageElement | |||
x |
number | |||
y |
number | |||
w |
number |
<optional> |
img.width
|
|
h |
number |
<optional> |
img.height
|
|
ix |
number |
<optional> |
0
|
|
iy |
number |
<optional> |
0
|
drawShapes(shape, ctx)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
shape |
Shape | |
ctx |
CanvasRenderingContext2D |
error(message)
- Description:
- Logs out a non fatal error to the console.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
string |
euler()
- Source:
exp(x, eopt) → {number}
- Description:
- Returns the power of a number by a given exponent.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
x |
number | the number to power. | ||
e |
number |
<optional> |
2
|
The number to power by. |
Returns:
- Type
- number
fill(ctx, coloropt, fillRuleopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ctx |
CanvasRenderingContext2D | |||
color |
string |
<optional> |
"black"
|
|
fillRule |
CanvasFillRule |
<optional> |
fillText(ctx, text, x, y)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | |
text |
string | |
x |
number | |
y |
number |
fpsDebugger(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
getDimensions(raw) → {Promise.<Vector_like>}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
raw |
BlobPart |
Returns:
- Type
- Promise.<Vector_like>
getNearVertex(position, vertices)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
position |
Vector2 | |
vertices |
Array.<Vector2> |
getURLExtension(url)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
url |
string |
getURLName(url)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
url |
string |
lerp(a, b, t) → {number}
- Description:
- Interpolates between two numbers by a constant t.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
number | The minimal bound of the interpolation. |
b |
number | The maximum bound of the interpolation. |
t |
number | A number between 0 and 1 to interpopate by.Any other number greater than 1 or less than 0 will extapolate beyond b or a respectively. |
Returns:
- Type
- number
line(ctx, x1, y1, x2, y2)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | Path2D | |
x1 |
number | |
y1 |
number | |
x2 |
number | |
y2 |
number |
log(message)
- Description:
- Logs out a message to the console.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
string |
map(v, x1, y1, x2, y2) → {number}
- Description:
- Maps a value from one range to another.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
v |
number | |
x1 |
number | |
y1 |
number | |
x2 |
number | |
y2 |
number |
Returns:
- Type
- number
mixin(from, to, propsopt)
- Description:
- Todo - Fix this function to add all props if no props param is given Mixes the properties and methods required by an object from another object.
- Source:
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
from |
* | the object constructor function to add methods from. | |
to |
* | the object constructor function to add methods to. | |
props |
Array.<string> |
<optional> |
naivebroadphaseUpdate(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
naturalizePair(a, b) → {number}
- Description:
- Returns a unique number given from a pair of numbers
- Source:
Parameters:
Name | Type | Description |
---|---|---|
a |
number | |
b |
number |
Returns:
- Type
- number
radToDeg(rad) → {number}
- Description:
- Converts a radian to a degree.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
rad |
number | number to convert. |
Returns:
- Type
- number
rand(minopt, maxopt) → {number}
- Description:
- Creates a random number between the parameters
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
min |
number |
<optional> |
0
|
The minimal bound of the random number |
max |
number |
<optional> |
1
|
The maximum bound of the random number |
Returns:
- Type
- number
raycastDebugger(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
rect(ctx, x, y, w, h)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | Path2D | |
x |
number | |
y |
number | |
w |
number | |
h |
number |
renderObj(ctx, bounds)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
ctx |
CanvasRenderingContext2D | |
bounds |
BoundingBox |
round(number, precisionopt) → {number}
- Description:
- Rounds a given value to a given precision.
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
number |
number | The number to round. | ||
precision |
number |
<optional> |
4
|
How many decimal places there should be. |
Returns:
- Type
- number
satNarrowphaseUpdate(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
sq(x) → {number}
- Description:
- Returns the square of a number
- Source:
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The number to square |
Returns:
- Type
- number
sqrt(x) → {number}
- Description:
- Returns the square root pf a number
- Source:
Parameters:
Name | Type | Description |
---|---|---|
x |
number | The number to root |
Returns:
- Type
- number
stroke(ctx, coloropt, widthopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ctx |
CanvasRenderingContext2D | |||
color |
string |
<optional> |
"black"
|
|
width |
number |
<optional> |
1
|
testSingleEdge(v1, v2, or, dir)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
v1 |
Vector2 | |
v2 |
Vector2 | |
or |
Vector2 | |
dir |
Vector2 |
throws(message)
- Description:
- Throws a fatal error.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
string |
updateBodies(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
updateTransformEuler(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
updateTransformVerlet(manager)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
verlet(transform, movable, dt)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
transform |
Transform | |
movable |
Movable | |
dt |
number |
vertices(ctx, vertices, closeopt)
- Source:
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
ctx |
CanvasRenderingContext2D | Path2D | |||
vertices |
Array.<Vector2> | |||
close |
boolean |
<optional> |
true
|
warn(message)
- Description:
- Logs out a warning to the console.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
string |
warnOnce(message)
- Description:
- Logs out a warning once to the console.
- Source:
Parameters:
Name | Type | Description |
---|---|---|
message |
string |
wrapAngle(x)
- Source:
Parameters:
Name | Type | Description |
---|---|---|
x |
number |
Type Definitions
BodyDebbuggerOptions
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
drawBounds |
boolean |
<optional> |
false
|
|
drawPosition |
boolean |
<optional> |
false
|
|
drawVelocity |
boolean |
<optional> |
false
|
|
clearRenderer |
boolean |
<optional> |
false
|
|
drawCollisionArm |
boolean |
<optional> |
false
|
|
drawContacts |
boolean |
<optional> |
||
clear |
boolean |
<optional> |
Bounds
- Source:
Properties:
Name | Type | Description |
---|---|---|
max |
Vector_like | |
min |
Vector_like |
CollisionPair
- Source:
Properties:
Name | Type | Description |
---|---|---|
a |
Body2D | |
b |
Body2D |
ContactManifold
- Source:
Properties:
Name | Type | Default | Description |
---|---|---|---|
lastOverlap |
number | ||
overlap |
number |
-Infinity
|
|
done |
boolean |
false
|
|
axis |
Vector2 | ||
verticesA |
Array.<Vector2> | ||
verticesB |
Array.<Vector2> | ||
vertShapeA |
Shape | ||
vertShapeB |
Shape | ||
contactNo |
number | ||
indexA |
number | ||
indexB |
number |
EasingFunc(t) → {number}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
t |
number |
Returns:
- Type
- number
Entity
- Source:
Type:
- number
EventHandlerFunc(data) → {void}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
data |
any |
Returns:
- Type
- void
IntergratorFunc(transform, movable, dt) → {void}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
transform |
Transform | |
movable |
Movable | |
dt |
number |
Returns:
- Type
- void
IntergratorPluginOptions
- Source:
Properties:
Name | Type | Attributes | Description |
---|---|---|---|
enableDamping |
boolean |
<optional> |
|
linearDamping |
number |
<optional> |
|
angularDamping |
number |
<optional> |
|
intergrator |
"euler" | "verlet" |
<optional> |
LerpFunc(p0, p1, t) → {number}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
p0 |
number | |
p1 |
number | |
t |
number |
Returns:
- Type
- number
ManagerOptions
- Source:
Properties:
Name | Type | Description |
---|---|---|
autoplay |
boolean |
Manifold
- Source:
Properties:
Name | Type | Description |
---|---|---|
bodyA |
Body2D | |
bodyB |
Body2D | |
contactData |
ContactManifold | |
stmp |
number | |
impulse |
number | |
persistent |
boolean | |
ca1 |
Vector2 | |
ca2 |
Vector2 | |
restitution |
number | |
staticFriction |
number | |
kineticFriction |
number | |
velA |
Vector2 | |
velB |
Vector2 | |
rotA |
number | |
rotB |
number |
Physics2DPluginOptions
- Source:
Properties:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
enableGravity |
boolean |
<optional> |
true
|
|
gravity |
Vector2 |
<optional> |
||
broadphase |
Broadphase |
<optional> |
||
narrowphase |
NarrowPhase |
<optional> |
||
|
Plugin
- Source:
Properties:
Name | Type | Description |
---|---|---|
register |
SystemFunc |
SystemFunc(manager) → {void}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
manager |
Manager |
Returns:
- Type
- void
TweenPluginOptions
- Source:
Properties:
Name | Type | Description |
---|---|---|
name |
string |
TweenUpdate(lerpFunc, to, from, t, into) → {void}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
lerpFunc |
LerpFunc | |
to |
T | |
from |
T | |
t |
number | |
into |
T |
Returns:
- Type
- void
Vector_like
- Source:
Properties:
Name | Type | Description |
---|---|---|
x |
number | |
y |
number |
signalListener(value) → {void}
- Source:
Parameters:
Name | Type | Description |
---|---|---|
value |
T |
Returns:
- Type
- void