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

    Class CoordinateRatioMapper

    Utility class for mapping coordinates between a ratio and a coordinate system.

    2.0.0

    Index

    Constructors

    • Constructor for the CoordinateRatioMapper class. The default coordinate system will have a width and height of Context.MIN_RESOLUTION, and the coordinate system will not be in WebGL mode.

      Returns CoordinateRatioMapper

      2.0.0

    • Constructor for the CoordinateRatioMapper class.

      Parameters

      • width: number

        {number} - The width of the coordinate system. Minimum value is Context.MIN_RESOLUTION.

      • height: number

        {number} - The height of the coordinate system. Minimum value is Context.MIN_RESOLUTION.

      • isWebGL: boolean

        {boolean} - Is the coordinate system in WebGL mode?

      Returns CoordinateRatioMapper

      2.0.0

    Accessors

    • get center(): Vector

      Returns Vector

      The center of the coordinate system.

      2.0.0

    • get centerX(): number

      Returns number

      The center x-axis value of the coordinate system.

      2.0.0

    • get centerY(): number

      Returns number

      The center y-axis value of the coordinate system.

      2.0.0

    • get height(): number

      Returns number

      The height of the coordinate system.

      2.0.0

    • set height(height: number): void

      Set the height of the coordinate system.

      Parameters

      Returns void

      2.0.0

    • get isWebGL(): boolean

      Is the coordinate system in WebGL mode?

      Returns boolean

      true if the coordinate system is in WebGL mode, false otherwise.

      2.0.0

    • get maxX(): number

      Returns number

      The maximum visible x-axis value.

      2.0.0

    • get maxY(): number

      Returns number

      The maximum visible y-axis value.

      2.0.0

    • get minX(): number

      Returns number

      The minimum visible x-axis value.

      2.0.0

    • get minY(): number

      Returns number

      The minimum visible y-axis value.

      2.0.0

    • get width(): number

      Returns number

      The width of the coordinate system.

      2.0.0

    • set width(width: number): void

      Set the width of the coordinate system.

      Parameters

      Returns void

      2.0.0

    Methods

    • Map a coordinate vector to percentage values relative to the minimum and maximum x-axis and y-axis values.

      Parameters

      • coordinateVector: Vector

        {p5.Vector} - The coordinate vector.

      Returns Vector

      The percentage vector.

      2.0.0

    • Map a coordinate value on the x-axis to a percentage value relative to the minimum and maximum x-axis values.

      Parameters

      • coordinateX: number

        {number} - The coordinate value on the x-axis.

      Returns number

      The percentage value on the x-axis.

      2.0.0

    • Map a coordinate value on the y-axis to a percentage value relative to the minimum and maximum y-axis values.

      Parameters

      • coordinateY: number

        {number} - The coordinate value on the y-axis.

      Returns number

      The percentage value on the y-axis.

      2.0.0

    • Map a percentage vector to values on the x-axis and y-axis. A percentage value of 0.5 will be exactly in the middle of the respective axis, regardless of context resolution or aspect ratio.

      Parameters

      • ratioVector: Vector

        {p5.Vector} - The percentage vector expressed as decimal numbers (e.g. 50% = 0.5)

      Returns Vector

      The coordinate vector.

      2.0.0

    • Map a percentage value to a value on the x-axis. A percentage value of 0.5 will be exactly in the middle of the x-axis, regardless of context resolution or aspect ratio.

      Parameters

      • ratioX: number

        {number} - The percentage expressed as a decimal number (e.g. 50% = 0.5)

      Returns number

      The coordinate value on the x-axis.

      2.0.0

    • Map a percentage value to a value on the y-axis. A percentage value of 0.5 will be exactly in the middle of the y-axis, regardless of context resolution or aspect ratio.

      Parameters

      • ratioY: number

        {number} - The percentage expressed as a decimal number (e.g. 50% = 0.5)

      Returns number

      The coordinate value on the y-axis.

      2.0.0