Primitive figure element.
This type of element is responsible for drawing something to the screen, or managing a HTML element in the DOM
an object that handles drawing to the screen or manages a HTML element
initial transform to set
color to set
parent element
Conveniently set the first translation of the element's transform.
x coordinate or full point definition
y coordinate if pointOrX is just the x coordinate (0)
Conveniently set the first rotation of the element's transform.
Conveniently set the first scale of the element's transform.
horizontal scale - either
define as full x-y point, or as a number. If scaleOrX is a number and
y is null, then both x and y will be equally scaled
y coordinate if scaleOrX is a number (null)
Set transform of element. Setting through this method will ensure
setTransfrom subscription will publish, and transform will be
appropriately clipped.
Set element color to dimColor
Set element color to defaultColor
Set transform, color and/or visibility to a predefined scenario.
Save the current transform, color and/or visibility to a scenario.
Return figure path of element
path of element relative to figure
Pulse element.
An element can be pulsed in scale, a rotation or a translation.
The scale pulse can either be a single pulse, or a number of copies with a range of scales - which has the effect of making regular polygons thick.
Either pass in a callback, or an options object defining the pulse and callback.
Transform a point between 'draw', 'local', 'figure', 'gl' and 'pixel' spaces.
plane is only needed when converting from pixel space (a 2D space) to
'figure', 'local' or 'draw' spaces (a 3D space). A ray from the pixel is
drawn into the screen
and the intersection with the defined plane is returned.
'pixel' to 'gl' is also a 2D to 3D transformation, but in this case the XY plane at z = 0 is used in gl space.
space to convert point from
space to convert point to
Return a matrix that can transform from one coordinate space to another.
Get the border or touchBorder of a FigureElementPrimitive in a defined coordinate space.
('local)
('border')
Return the first scale in the element's transform. Will return
[1, 1] if element's transform doesn't have a scale.
scale
Return the first rotation in the element's transform.
how to normalize the
returned angle where '' returns the raw angle
scale
Get position of element
By default the first translation of the element's transform is returned. This is effectively the element's location in 'local' coordinates.
The position of the element relative to its horizontal and vertical bounds
can also be returned. Use xAlign to find the x coordinate of the left,
center, right or percentage width from left of the element. Use yAlign
to find the bottom, middle, top or percentage height from bottom of the
element.
the space to return the position in
horizontal alignment of position. Use a number to define the horizontal
position in percentage width from the left.
vertical alignment of position. Use a number to define the vertical
position in percentage height from the bottom.
Set the element's position in local space such that it lines up with a figure space target.
Align element position in local space such that it is in the same position as the target element (even if that element is in a different local space)
true set this element as touchable and configures all parent elements
to accept touches for their children
false makes this element not touchable.
Configure all parents to make this element touchable, and make this element touchable and movable
true to make movable, false to not
Toggle hide/show of element
Get current transform of element.
true if element is moving
true if element is animating
Set angle to draw.
Some primitive elements can be partially drawn to some angle.
An angle of -1 represents the maximum angle allowed by the primitive.
Angle to draw
Set element color.
RGBA color from 0 to 1
also set the default color to this color
Show element.
Hide element
Primitive figure element
A primitive figure element is one that handles an object (
drawingObject) that draws to the screen. This object may be a GLObject, a TextObject or a HTMLObject.