The base class of all jStage world objects, a Polygon consists of a set of linked vertices (represented using jStage.Vector), as well as some very rudimentary rendering controls.

- member of jStage

- Polygon(points, base)constructor
- addLocation(x, y)
- addRotation(rotation)
- getAlpha()
- getLocation()
- getVisible()
- invalidate()
- isCurrentlyVisible()
- polyBase(poly)
- setLocation(x, y)
- setRotation(rotation)
- setRotationDeg(rotation)
- setTransform(x, y, rotation)
- setVisible(vis)
- toString()

points:Pass an array of local-space vectors (with >= 3 elements) to build a closed Poly upon creation, or null to explicitly build it using jStage.Polygon.polyAdd later.

base:Another polygon upon which to 'base' this one (in the scene graph), or null to leave this poly baseless.

Adds to the location of this Polygon in local space.

x:The amount to add to the X value of the local space location.

y:The amount to add to the Y value of the local space location.

`this`

(itself) - so you can chain operations.

Adds to the local rotation of this Polygon.

rotation:The amount to add to the local space rotation, in radians.

`this`

(itself) - so you can chain operations.

Gets the multiplied alpha value of this Polygon, based on it's own `_alpha`

property and that of it's parent nodes on the scene graph.

A floating point value between `0.0`

and `1.0`

(inclusive) representing the multiplied alpha value of this Polygon.

The return value is multiplicative; if this Polygon has *alpha == 0.5** and it's parent has *

`alpha == 0.5`

, the actual returned value will be `0.25`

.Gets the location of this Polygon in world space.

A reference to the jStage.Vector object containing this Polygon's location.

Do not modify the values directly, as they will not propagate to child vertices and polygons. Use setLocation(x, y) for this purpose instead.

Gets the visiblity of this Polygon, based on it's own `_visible`

property and that of it's parent nodes on the scene graph.

A boolean value representing the actual visibility state of this Polygon.

Even if this Polygon has `_visible == true`

, this function will return false if any parents have it set to false.

Explicitly invalidates the root of the scene graph containing this Polygon, forcing a repaint on the next animation frame.

`this`

(itself) - so you can chain operations.

If this Polygon is currently invisible (as per isCurrentlyVisible()), then this function has no effect.

Determines if this Polygon (and it's children) is currently visible on the scene graph based on the return values of getVisible() and getAlpha().

True if this Polygon is currently visible and has an alpha value greater than `0.0`

, false otherwise.

Sets the 'base' of this Polygon.

poly:The polygon to use as the new base. Pass `null`

for no base.

`this`

(itself) - so you can chain operations.

You cannot use an unenclosed (incomplete) poly as a base. Attempting to do so will have no effect.

Sets the location of this Polygon in local space.

x:The new X value of the local space location.

y:The new Y value of the local space location.

`this`

(itself) - so you can chain operations.

Sets the local rotation of this Polygon.

rotation:The new value for the local space rotation, in radians.

`this`

(itself) - so you can chain operations.

Sets the local rotation of this Polygon.

rotation:The new value for the local space rotation, in degrees.

`this`

(itself) - so you can chain operations.

Combines the actions of setLocation(x, y) and setRotation(rotation) for a more convenient (and faster) call.

x:The new X value of the local space location.

y:The new Y value of the local space location.

rotation:The new value for the local space rotation, in radians.

`this`

(itself) - so you can chain operations.

Sets the visibility of this Polygon.

vis:A boolean value representing the visibility of this Polygon.

`this`

(itself) - so you can chain operations.

you do not need to call invalidate(), it is done for you.

Gets a string summary of this Polygon's world vertices, presented in a human-readable format.

A string containing a list of all world vertices.