phaser-jsx
    Preparing search index...

    Variable SpriteGPULayerConst

    SpriteGPULayer: FC<
        ObjectProps<SpriteGPULayer> & RecursivePartial<SpriteGPULayer> & {
            frame?: string | number;
            texture: string | Texture;
        },
    > = ...

    A SpriteGPULayer GameObject. This is a WebGL only GameObject. It is optimized for rendering very large numbers of quads following simple tween animations. It is suited to complex backgrounds with animation.

    A SpriteGPULayer is a composite object that contains a collection of Member objects. It stores the rendering data for these objects in a GPU buffer, and renders them in a single draw call. Because it only updates the GPU buffer when necessary, it is up to 100 times faster than rendering the objects individually. Avoid changing the contents of the SpriteGPULayer frequently, as this requires the whole buffer to be updated.

    The layer can generally perform well with a million small quads. The exact performance will depend on the device and the size of the quads. If the quads are large, the layer will be fill-rate limited. Avoid drawing more than a few million pixels per frame.

    Notes on textures:

    This layer gains much of its speed from inflexibility. It can only use one texture, and that texture must be a single image. It cannot use multi-atlas textures.

    Further, if the texture is not a power of two in size, some texture seaming may occur if you line up sprites exactly. This is because the GPU precision is limited by binary logic, and texture coordinates will only be perfectly accurate for power of two textures. This can be avoided by adding/extruding a pixel of padding around each frame in the texture, or by using a power of two texture.