new Item(options)
Creates a new Item.
Parameters:
Name | Type | Description |
---|---|---|
options |
Object | A map of initial properties. |
Methods
-
_checkCameraEdges()
-
Moves the world in the opposite direction of the Camera's controlObj.
-
<private> _checkWorldEdges()
-
Determines if this object is outside the world bounds.
-
applyForce(force) → {Object}
-
Adds a force to this object's acceleration.
Parameters:
Name Type Description force
Object A Vector representing a force to apply. Returns:
A Vector representing a new acceleration.- Type
- Object
-
draw()
-
Updates the corresponding DOM element's style property.
-
reset(opt_options=)
-
Resets all properties.
Parameters:
Name Type Argument Default Description opt_options=
Object <optional>
A map of initial properties. opt_options.width
number <optional>
10 Width. opt_options.height
number <optional>
10 Height. opt_options.color
Array <optional>
0, 0, 0 Color. opt_options.colorMode
string <optional>
'rgb' Color mode. Accepted values: 'rgb', 'hsl'. opt_options.visibility
string <optional>
'visible' Visibility. Accepted values: 'visible', 'hidden'. opt_options.opacity
number <optional>
1 Opacity. opt_options.zIndex
number <optional>
1 zIndex. opt_options.borderWidth
number <optional>
0 borderWidth. opt_options.borderStyle
string <optional>
'none' borderStyle. opt_options.borderColor
string | Array <optional>
'transparent' borderColor. opt_options.borderRadius
number <optional>
0 borderRadius. opt_options.boxShadowOffset
Object <optional>
new Vector() boxShadowOffset. opt_options.boxShadowBlur
number <optional>
0 boxShadowBlur. opt_options.boxShadowSpread
number <optional>
0 boxShadowSpread. opt_options.boxShadowColor
string | Array <optional>
'transparent' boxShadowColor. opt_options.bounciness
number <optional>
0.8 bounciness. opt_options.mass
number <optional>
10 mass. opt_options.acceleration
Function | Object <optional>
new Vector() acceleration. opt_options.velocity
Function | Object <optional>
new Vector() velocity. opt_options.location
Function | Object <optional>
new Vector() location. opt_options.maxSpeed
number <optional>
10 maxSpeed. opt_options.minSpeed
number <optional>
10 minSpeed. opt_options.angle
number <optional>
0 Angle. opt_options.position
string <optional>
'absolute' A css position. Possible values: 'absoulte', 'fixed', 'static', 'relative'. opt_options.paddingTop
number <optional>
0 Padding top. opt_options.paddingRight
number <optional>
0 Padding right. opt_options.paddingBottom
number <optional>
0 Padding bottom. opt_options.paddingLeft
number <optional>
0 Padding left. opt_options.lifespan
number <optional>
-1 Lifespan. opt_options.life
number <optional>
0 Life. opt_options.isStatic
boolean <optional>
false If set to true, object will not move. opt_options.controlCamera
boolean <optional>
false If set to true, object controls the camera. opt_options.worldBounds
Array <optional>
true, true, true, true Defines the boundaries checked checkWorldEdges is true. opt_options.checkWorldEdges
boolean <optional>
false If set to true, system restricts object movement to world boundaries. opt_options.wrapWorldEdges
boolean <optional>
false If set to true, system checks if object intersects world boundaries and resets location to the opposite boundary. opt_options.avoidWorldEdges
boolean <optional>
false If set to true, object steers away from world boundaries. opt_options.avoidWorldEdgesStrength
number <optional>
0 The distance threshold for object start steering away from world boundaries. -
step()
-
Updates properties.