JSignage:Polygon

From SpinetiX Support Wiki

Jump to: navigation, search

This page is related to JSignage:Shapes.

jSignage.polygon()

jSignage.polygon( attributesObject );

Returns: jSignage Object

Description

Draws a closed shape consisting of a set of connected straight line segments (for open shapes, $.polyline() should be used instead). See the polygon element in the SVG specification for reference.

Parameters

  • attributesObject
    Type: Plain Object.
    An object containing any of the following attributes:
    • fill, fillOpacity, stroke, strokeOpacity, strokeWidth, ...
      Fill and stroke attributes (common to all shapes).
    • points
      Type: Array.<String>.
      Array of x, y coordinates pairs defining the points that make up the polygon.

Examples

Polygon1.png
// draw a blue-stroked red star and add it to the document
$.polygon({
    fill:'red', stroke: 'blue', strokeWidth: 5,
    points: [ '350,  75', '379, 161', '469, 161', '397, 215', '423, 301', 
              '350, 250', '277, 301', '303, 215', '231, 161', '321, 161' ]
}).addTo('svg');
Polygon2.png
// draw a red-stroked lime hexagon and add it to the document
$.polygon({
    fill:'lime', stroke: 'red', strokeWidth: 5,
    points: [ '850, 75', '958, 137.5', '958, 262.5', 
              '850, 325', '742, 262.6', '742, 137.5' ]
}).addTo('svg');
This page was last modified on 26 March 2019, at 15:41.