@batpb/genart - v2.0.0-rc.3-alpha.2
    Preparing search index...

    Class ContextAbstract

    Abstract base class for managing rendering contexts in generative art sketches. Provides configuration for RenderType, AspectRatio, resolution, and CoordinateRatioMapper, supporting both 2D and WebGL modes with responsive resizing and aspect ratio control.

    2.0.0

    Hierarchy (View Summary)

    Index

    Constructors

    • Protected

      The constructor for the Context class.

      Parameters

      • config: ContextConfig

        {ContextConfig} - The configuration for the context.

      Returns Context

    Accessors

    • get MIN_RESOLUTION(): number

      Returns number

      The minimum resolution for a context.

      2.0.0

    • get center(): Vector

      Returns Vector

      The center of the context.

      2.0.0

    • get defaultStrokeWeight(): number

      The default stroke weight for the context. Equivalent to a stroke of 1 in a 500x500 sketch.

      Returns number

      The default stroke weight for the context.

      2.0.0

    • get height(): number

      Returns number

      The height of the context.

      2.0.0

    • get IS_WEBGL(): boolean

      Is the context in WebGL mode?

      Returns boolean

      true if the context is in WebGL mode, false otherwise.

      2.0.0

    • get matchContainerRatio(): boolean

      Should the aspect ratio of the context match the aspect ratio of its container?

      Returns boolean

      Whether the aspect ratio should match the container aspect ratio.

      2.0.0

    • set matchContainerRatio(matchContainerRatio: boolean): void

      Should the aspect ratio of the context match the aspect ratio of its container?

      Parameters

      • matchContainerRatio: boolean

        {boolean} - The new value for the matchContainerRatio property.

      Returns void

      2.0.0

    • get NAME(): string

      Returns string

      The name of the context.

      2.0.0

    • get resolution(): number

      Returns number

      The resolution of the context.

      2.0.0

    • set resolution(resolution: number): void
      Protected

      Set the resolution of the context.

      Parameters

      • resolution: number

        {number} - The new resolution of the context.

      Returns void

    • get width(): number

      Returns number

      The width of the context.

      2.0.0

    Methods

    • Resize the context.

      Returns void

      2.0.0

    • Update the AspectRatio of the context.

      Parameters

      Returns void

      2.0.0

    • Update the resolution of the context.

      Parameters

      • resolution: number

        {number} - The new resolution of the context.

      Returns void

      2.0.0