Class Transformation

Represents a transformation that can be applied to a Shape.

Hierarchy (view full)

Constructors

Properties

Methods

Constructors

  • Creates an instance of Transformation.

    Parameters

    • tag: string

      The name of the transformation.

    • attrs: {} = {}

      The attributes required to apply the transformation.

      • children: Transformation[] = []

        Other transformations that are applied relative to the parent transformation.

      Returns Transformation

    Properties

    attrs: any
    children: Transformation[]
    tag: string

    Methods

    • Adds a Rotate transformation to the current transformation.

      Parameters

      • angle: number = 0

        The amount to rotate clockwise in degrees. Defaults to 0.

      Returns Transformation

      The current instance of Transformation for chaining.

    • Adds a Scale transformation to the current transformation.

      Parameters

      • x: number = 1

        The amount to scale in the positive x-axis. Defaults to 1.

      • y: number = 1

        The amount to scale in the positive y-axis. Defaults to 1.

      Returns Transformation

      The current instance of Transformation for chaining.

    • Adds a Translate transformation to the current transformation.

      Parameters

      • x: number = 0

        The amount to translate along the positive x-axis. Defaults to 0.

      • y: number = 0

        The amount to translate along the positive y-axis. Defaults to 0.

      Returns Transformation

      The current instance of Transformation for chaining.