Phaser API Documentation

  Version: 
repeat(key, [frame], [x], [y], [width], [height], [alpha], [tint], [skipBatch])

Description:

Takes the given Texture Frame and draws it to this Dynamic Texture as a fill pattern, i.e. in a grid-layout based on the frame dimensions.

Textures are referenced by their string-based keys, as stored in the Texture Manager.

You can optionally provide a position, width, height, alpha and tint value to apply to the frames before they are drawn. The position controls the top-left where the repeating fill will start from. The width and height control the size of the filled area.

The position can be negative if required, but the dimensions cannot.

Calling this method will cause a batch flush by default. Use the skipBatch argument to disable this if this call is part of a larger batch draw.

If you are not planning on using this Dynamic Texture as a base texture for Sprite Game Objects, then you should set DynamicTexture.isSpriteTexture = false before calling this method, otherwise you will get vertically inverted frames in WebGL.

Parameters:

name type arguments Default description
key string

The key of the texture to be used, as stored in the Texture Manager.

frame string | number <optional>

The name or index of the frame within the Texture. Set to null to skip this argument if not required.

x number <optional> 0

The x position to start drawing the frames from (can be negative to offset).

y number <optional> 0

The y position to start drawing the frames from (can be negative to offset).

width number <optional> this.width

The width of the area to repeat the frame within. Defaults to the width of this Dynamic Texture.

height number <optional> this.height

The height of the area to repeat the frame within. Defaults to the height of this Dynamic Texture.

alpha number <optional> 1

The alpha to use. Defaults to 1, no alpha.

tint number <optional> 0xffffff

WebGL only. The tint color to use. Leave as undefined, or 0xffffff to have no tint.

skipBatch boolean <optional> false

Skip beginning and ending a batch with this call. Use if this is part of a bigger batched draw.

Returns:
Description:

This Dynamic Texture instance.

Since: 3.60.0