phaser - v4.0.0-rc.4
    Preparing search index...

    Provides methods used for getting and setting the origin of a Game Object. Values are normalized, given in the range 0 to 1. Display values contain the calculated pixel values. Should be applied as a mixin and not used directly.

    interface Origin {
        displayOriginX: number;
        displayOriginY: number;
        originX: number;
        originY: number;
        setDisplayOrigin(x?: number, y?: number): this;
        setOrigin(x?: number, y?: number): this;
        setOriginFromFrame(): this;
        updateDisplayOrigin(): this;
    }

    Implemented by

    Index

    Properties

    displayOriginX: number

    The horizontal display origin of this Game Object. The origin is a normalized value between 0 and 1. The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.

    displayOriginY: number

    The vertical display origin of this Game Object. The origin is a normalized value between 0 and 1. The displayOrigin is a pixel value, based on the size of the Game Object combined with the origin.

    originX: number

    The horizontal origin of this Game Object. The origin maps the relationship between the size and position of the Game Object. The default value is 0.5, meaning all Game Objects are positioned based on their center. Setting the value to 0 means the position now relates to the left of the Game Object. Set this value with setOrigin().

    originY: number

    The vertical origin of this Game Object. The origin maps the relationship between the size and position of the Game Object. The default value is 0.5, meaning all Game Objects are positioned based on their center. Setting the value to 0 means the position now relates to the top of the Game Object. Set this value with setOrigin().

    Methods

    • Sets the display origin of this Game Object. The difference between this and setting the origin is that you can use pixel values for setting the display origin.

      Parameters

      • Optionalx: number

        The horizontal display origin value. Default 0.

      • Optionaly: number

        The vertical display origin value. If not defined it will be set to the value of x. Default x.

      Returns this

    • Sets the origin of this Game Object.

      The values are given in the range 0 to 1.

      Parameters

      • Optionalx: number

        The horizontal origin value. Default 0.5.

      • Optionaly: number

        The vertical origin value. If not defined it will be set to the value of x. Default x.

      Returns this

    • Sets the origin of this Game Object based on the Pivot values in its Frame.

      Returns this

    • Updates the Display Origin cached values internally stored on this Game Object. You don't usually call this directly, but it is exposed for edge-cases where you may.

      Returns this