Class Ellipse

Represents an Ellipse shape.

Hierarchy (view full)

Constructors

  • Creates an instance of Ellipse.

    Parameters

    • center: Point = ...

      The position of the center of the ellipse. Defaults to (0, 0).

    • width: number = 200

      The width of the ellipse. Defaults to 200.

    • height: number = 100

      The height of the ellipse. Defaults to 100.

    • style: {} = {}

      The style information for displaying the ellipse. Defaults to no styling or {}.

      Returns Ellipse

    Properties

    attrs: any
    center: Point
    children: Shape[]
    height: number
    kwargs: any
    tag: string
    transform: Transformation[]
    width: number

    Methods

    • Adds a child shape to the current Shape instance.

      Parameters

      • shape: Shape

        A child shape.

      Returns Ellipse

      The current instance of Shape for chaining.

    • Returns a clone of the current Shape instance with new styling information if available.

      Parameters

      • newKwargs: {} = {}

        Key value pairs to provide styling information for a shape. eg { fill: 'red', stroke: 'blue' }.

        Returns Shape

        A new instance of Shape.

      • Repeats the current shape n times by applying transform iteratively.

        Parameters

        • n: number

          A positive integer representing the number of times a shape is to be repeated.

        • transform: Transformation | ((index: number) => TransformationWithStyle) | ((index: number) => Transformation)

          An instance of Transformation that is applied every time the shape is repeated.

        Returns Ellipse

        The current instance of Shape for chaining.

      • Applies a Rotate transformation to the current Shape instance.

        Parameters

        • angle: number = 0

          Amount to rotate clockwise in degrees. Defaults to 0.

        Returns Ellipse

        The current instance of Shape for chaining.

      • Applies a Scale transformation to the current Shape instance.

        Parameters

        • x: number = 1

          Amount to scale along the positive x-axis. Defaults to 1.

        • y: number = 1

          Amount to scale along the positive y-axis. Defaults to 1.

        Returns Ellipse

        The current instance of Shape for chaining.

      • Displays a shape. Steps performed for display are as follows.

        • Apply the transforms that exist on a shape.
        • Apply the styling that exists on a shape.
        • Draw the shape.
        • Draw children shapes.

        Parameters

        • Optionalr: Drawable

          An instance of Drawable.

        Returns void

      • Returns a string representation of Shape.

        Returns string

        • A string with the name of the shape and its' attributes.
      • Applies a Translate transformation to the current Shape instance.

        Parameters

        • x: number = 0

          Amount to translate along the positive x-axis. Defaults to 0.

        • y: number = 0

          Amount to translate along the positive y-axis. Defaults to 0.

        Returns Ellipse

        The current instance of Shape for chaining.