Class Rectangle
Extends
SceneContent.
Draws a rectangle into the Scene. To create a Rectangle, you need only supply
it's location and size, along with at least 1 of 3 rendering instructions.
The 3 rendering instructions are "fill", "stroke", and "clear".
The fill rendering instruction tells this rectangle to fill the rectangle
with the given color.
The stroke rendering instruction tells this rectangle to stroke (outline) the
rectangle with the given color. You can also specify a stroke_width, which
is used to define the line thickness used while outlining the rectangle.
The clear rendering instruction actually is set to "true" or "false", and it
tells the rectangle to clear/remove the area behind it.
Defined in: Rectangle.js.
To draw a red rectangle with a blue outline, you might define it as such: Rectangle({ x: 25, y: 25, w: 50, h: 50, fill: "red", stroke: "blue" }) This creates a red square at (0,0) with width and height of 50, and a blue outline.
Constructor Attributes | Constructor Name and Description |
---|---|
Rectangle(_details)
|
- Fields borrowed from class SceneContent:
- details
- Methods borrowed from class SceneContent:
- draw, extend, getBounds, getName, getParent, getScene, getStage, isActive, isVisible, load, loadBase, moveBy, moveTo, setActive, setSize, setVisible, update, updateBase
- Parameters:
- {Object} _details
- A JSON Object with the following properties:
Property Required Default clear no false fill no transparent stroke no #000000 stroke_width no 1