Class: Mover

Mover

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.
Source:

Extends

  • Item

Methods

<static> draw()

Updates the corresponding DOM element's style property.
Source:

<static> getCSSText(props) → {string}

Concatenates a new cssText string.
Parameters:
Name Type Description
props Object A map of object properties.
Source:
Returns:
A string representing cssText.
Type
string

<static> mousedown()

Handles mousedown events.
Source:

<static> mousemove(e)

Handles mousemove events.
Parameters:
Name Type Description
e Object An event object.
Source:

<static> mouseout()

Handles mouse out events.
Source:

<static> mouseover()

Handles mouseup events.
Source:

<static> mouseup()

Handles mouseup events.
Source:

init(world, opt_options)

Initializes an instance of Mover.
Parameters:
Name Type Description
world Object An instance of World.
opt_options Object A map of initial properties.
Properties
Name Type Argument Default Description
color string | Array <optional>
255, 255, 255 Color.
borderRadius number <optional>
100 Border radius.
borderWidth number <optional>
2 Border width.
borderStyle string <optional>
'solid' Border style.
borderColor Array <optional>
60, 60, 60 Border color.
pointToDirection boolean <optional>
true If true, object will point in the direction it's moving.
draggable boolean <optional>
false If true, object can move via drag and drop.
parent Object <optional>
null A parent object. If set, object will be fixed to the parent relative to an offset distance.
pointToParentDirection boolean <optional>
true If true, object points in the direction of the parent's velocity.
offsetDistance number <optional>
30 The distance from the center of the object's parent.
offsetAngle number <optional>
0 The rotation around the center of the object's parent.
afterStep function <optional>
null A function to run after the step() function.
isStatic function <optional>
false Set to true to prevent object from moving.
parent Object <optional>
null Attach to another Flora object.
Source: