new Mover()
Creates a new Mover.
Movers are the root object for any item that moves. They are not
aware of other Movers or stimuli. They have no means of locomotion
and change only due to external forces. You will never directly
implement Mover.
Extends
- Item
Methods
-
<static> draw()
-
Updates the corresponding DOM element's style property.
-
<static> getCSSText(props) → {string}
-
Concatenates a new cssText string.
Parameters:
Name Type Description propsObject A map of object properties. Returns:
A string representing cssText.- Type
- string
-
<static> mousedown()
-
Handles mousedown events.
-
<static> mousemove(e)
-
Handles mousemove events.
Parameters:
Name Type Description eObject An event object. -
<static> mouseout()
-
Handles mouse out events.
-
<static> mouseover()
-
Handles mouseup events.
-
<static> mouseup()
-
Handles mouseup events.
-
init(world, opt_options)
-
Initializes an instance of Mover.
Parameters:
Name Type Description worldObject An instance of World. opt_optionsObject A map of initial properties. Properties
Name Type Argument Default Description colorstring | Array <optional>
255, 255, 255 Color. borderRadiusnumber <optional>
100 Border radius. borderWidthnumber <optional>
2 Border width. borderStylestring <optional>
'solid' Border style. borderColorArray <optional>
60, 60, 60 Border color. pointToDirectionboolean <optional>
true If true, object will point in the direction it's moving. draggableboolean <optional>
false If true, object can move via drag and drop. parentObject <optional>
null A parent object. If set, object will be fixed to the parent relative to an offset distance. pointToParentDirectionboolean <optional>
true If true, object points in the direction of the parent's velocity. offsetDistancenumber <optional>
30 The distance from the center of the object's parent. offsetAnglenumber <optional>
0 The rotation around the center of the object's parent. afterStepfunction <optional>
null A function to run after the step() function. isStaticfunction <optional>
false Set to true to prevent object from moving. parentObject <optional>
null Attach to another Flora object.