Shapes
The shape functions create new objects and add them to the stage, centered at the specified coordinates. The shape's various properties (fill, stroke, etc.) are initially set to the global values, but can be changed at anytime.
Functions
circle(x, y, size)
Creates a circle centered at the specified x and y coordinates, of the specified size.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Diameter of circle in pixels.
Returns
Circleheptagon(x, y, size)
Creates a regular heptagon (7 sided polygon) centered at the specified x and y coordinates, of the specified size.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Diameter of the bounding circle in pixels.
Returns
RegularPolygonhexagon(x, y, size)
Creates a regular hexagon (6 sided polygon) centered at the specified x and y coordinates, of the specified size.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Diameter of the bounding circle in pixels.
Returns
RegularPolygonoctagon(x, y, size)
Creates a regular octagon (8 sided polygon) centered at the specified x and y coordinates, of the specified size.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Diameter of the bounding circle in pixels.
Returns
RegularPolygonoval(x, y, width, height)
Creates a oval width centered at the specified x and y coordinates, with the specified width and height.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- width Number Width of oval in pixels.
- height Number Height of oval in pixels.
Returns
Ovalpentagon(x, y, size)
Creates a regular pentagon (5 sided polygon) centered at the specified x and y coordinates, of the specified size.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Diameter of the bounding circle in pixels.
Returns
RegularPolygonrect(x, y, width, height)
Creates a rectangle centered at the specified x and y coordinates, with the specified width and height.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- width Number Width of rectangle in pixels.
- height Number Height of rectangle in pixels.
Returns
Rectanglesemicircle(x, y, size)
Creates a semicircle centered at the specified x and y coordinates, of the specified size.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Diameter of the semicircle in pixels.
Returns
Semicirclesquare(x, y, size)
Creates a square centered at the specified x and y coordinates, of the specified size.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Width and height of the square in pixels.
Returns
Rectanglestar(x, y, outerSize, innerSize = null, points = 5)
Creates a stars centered at the specified x and y coordinates, of the specified size. You may optionally specify an inner radius as well as the number of points.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- outerSize Number Outer diameter in pixels.
- innerSize Number Inner diameter in pixels.
- points Number Number of points on the star.
Returns
Polygontriangle(x, y, width, height = null)
Creates a triange centered at the specified x and y coordinates, of the specified width and height. The height parameter is optional. If omitted a regular triangle will be created.
Parameters
- x Number x coordinate of center point.
- y Number y coordinate of center point.
- size Number Width of triangle.
- size Number Height of triangle.
Returns
Polygonline(x1, y1, x2, y2)
Creates a line between two points.
Parameters
- x1 Number x coordinate of the first point.
- y1 Number y coordinate of the first point.
- x2 Number x coordinate of the second point.
- y2 Number y coordinate of the second point.
Returns
Linecurve(x1, y1, x2, y2, x3, y3, ...)
Creates a curve using the specified control points. You may pass any number of sets of x and y coordinate. The curve will begin at the first point and end at the last point, guided by the points in between.
Parameters
- x1...xn Number x coordinate of control point.
- y1...yn Number y coordinate of control point.
Returns
CurveProperties
object.angle
A Number
defining the rotation of the object in
degrees.
object.lineWidth
A Number
defining the line width of the object's stroke
in pixels.
object.fill
A String
defining the object's fill color. This can be a known named
color such as "red", "blue", etc., a hexidecimal color code in the
format #rrbbgg or the individual rgb values in the format rgb(red, green,
blue).
object.stroke
A String
defining the object's stroke color. This can be a known named
color such as "red", "blue", etc., a hexidecimal color code in the
format #rrbbgg or the individual rgb values in the format rgb(red, green,
blue).
Grouping Shapes
Several shapes can be grouped together using the group()
function. The group then has it's own set of position and size
properties.
group(shape1, shape2, shape3, ...)
Groups together the specified shapes.
Parameters
- shape1...shapen Shape Shape to include in group.