Options object for a FigureElementPrimitive of a generic shape
points will define either triangles or lines which combine
to make the shape.
drawType defines what sort of triangles or lines the points make.
The most useful, common and generic drawType is 'TRIANGLES'
which can be used to create any shape.
The shape's points can be duplicated using the copy property
to conveniently create multiple copies (like grids) of shapes.
The shape is colored with either color or texture.
When shapes move, or are touched, borders are needed to bound their
movement, and figure out if a touch happened within the shape. Shapes
that do not move, or are not interactive, do not need borders.
A shape can have several kinds of borders. "Draw borders" (drawBorder and
drawBorderBuffer) are sets of points that define reference
borders for a shape. The shapes higher level borders border and
touchBorder may then use these draw borders to define how a shape will
interact with a figure's bounds, or where a shape can be touched.
drawBorder and drawBorderBuffer are each point arrays
that define the outer limits of the shape. For non-contigous shapes
(like islands of shapes), an array of point arrays can be used.
Both borders can be anything, but typically a drawBorder would define the
border of the visible shape, and a drawBorderBuffer would define some
extra space, or buffer, around the visible shape (particulaly useful for
defining the touchBorder later).
border is used for checking if the shape is within some bounds. When
shapes are moved, if their bounds are limited, this border will define when
the shape is at a limit. The border property can be:
draw: use drawBorder points
buffer: use drawBorderBuffer points
rect: use a rectangle bounding drawBorder
number: use a rectangle that is number larger than the rectangle
bounding drawBorder
Array<TypeParsablePoint>: a custom contiguous border
Array<Array<TypeParsablePoint>>: a custom border of several contiguous
portions
touchBorder is used for checking if a shape is touched. The touchBorder
property can be:
draw: use drawBorder points
buffer: use drawBorderBuffer points
border: use same as border
rect: use a rectangle bounding border
number: use a rectangle that is number larger than the rectangle
bounding border
Array<TypeParsablePoint>: a custom contiguous border
Array<Array<TypeParsablePoint>>: a custom border of several contiguous
portions
Options object for a FigureElementPrimitive of a generic shape
pointswill define either triangles or lines which combine to make the shape.drawTypedefines what sort of triangles or lines thepointsmake. The most useful, common and genericdrawTypeis'TRIANGLES'which can be used to create any shape.The shape's points can be duplicated using the
copyproperty to conveniently create multiple copies (like grids) of shapes.The shape is colored with either
colorortexture.When shapes move, or are touched, borders are needed to bound their movement, and figure out if a touch happened within the shape. Shapes that do not move, or are not interactive, do not need borders.
A shape can have several kinds of borders. "Draw borders" (
drawBorderanddrawBorderBuffer) are sets of points that define reference borders for a shape. The shapes higher level bordersborderandtouchBordermay then use these draw borders to define how a shape will interact with a figure's bounds, or where a shape can be touched.drawBorderanddrawBorderBufferare each point arrays that define the outer limits of the shape. For non-contigous shapes (like islands of shapes), an array of point arrays can be used. Both borders can be anything, but typically adrawBorderwould define the border of the visible shape, and adrawBorderBufferwould define some extra space, or buffer, around the visible shape (particulaly useful for defining thetouchBorderlater).borderis used for checking if the shape is within some bounds. When shapes are moved, if their bounds are limited, this border will define when the shape is at a limit. Theborderproperty can be:draw: usedrawBorderpointsbuffer: usedrawBorderBufferpointsrect: use a rectangle boundingdrawBordernumber: use a rectangle that isnumberlarger than the rectangle boundingdrawBorderArray<TypeParsablePoint>: a custom contiguous borderArray<Array<TypeParsablePoint>>: a custom border of several contiguous portionstouchBorderis used for checking if a shape is touched. ThetouchBorderproperty can be:draw: usedrawBorderpointsbuffer: usedrawBorderBufferpointsborder: use same asborderrect: use a rectangle boundingbordernumber: use a rectangle that isnumberlarger than the rectangle boundingborderArray<TypeParsablePoint>: a custom contiguous borderArray<Array<TypeParsablePoint>>: a custom border of several contiguous portionsSee
To test examples, append them to the boilerplate
Example
Example
Example