Dynamic Icons Scripting Reference - v1.3.0
    Preparing search index...

    Class StrokeStyle

    Stores stroke (line) canvas context property definitions, which includes stroke ("pen") style, line width, cap, join, miter, and dash array properties. Line width can be defined as a relative % and scaled automatically in the render method.

    Index

    Accessors

    • get isEmpty(): boolean

      Returns true if stroke style is invalid (eg. no color) or scaledWidth is <= zero.

      Returns boolean

    • get scaledWidth(): number

      If the width unit type is relative (%) then returns the defined width multiplied by widthScale. Otherwise just returns the actual defined width.

      Returns number

    • get scaledLineDash(): number[]

      If the width unit type is relative (%) then returns a copy of the lineDash array with each member multiplied by widthScale. Otherwise just returns lineDash unmodified.

      Returns number[]

    • get scaledDashOffset(): number

      If the width unit type is relative (%) then returns the dashOffset value multiplied by widthScale. Otherwise just returns dashOffset unmodified.

      Returns number

    Constructors

    Methods

    Properties

    width: UnitValue = ...

    Size of the stroke in pixels or % of final drawing size.

    widthScale: number = 1

    Scaling factor for the stroke size when a relative (%) unit is used. This affects return values from scaledWidth, scaledLineDash and scaledDashOffset properties. The value is always re-computed inside the render method if a rect argument is passed to it.

    Style (color/gradient/pattern/texture) for the stroke.

    cap: CanvasLineCap = 'butt'

    Context lineCap property to apply. Default is 'butt'.

    join: CanvasLineJoin = 'miter'

    Context lineJoin property to apply. Default is 'miter'.

    miterLimit: number = 10

    Context miterLimit property to apply. Default is 10.

    lineDash: number[] = []

    Optional array to pass to context's setLineDash() method. Default is an empty array (solid line).

    dashOffset: number = 0

    Context lineDashOffset property to apply when specifying a dash pattern. Default is 0.