TilingSpriteOptions
graphics/tiling-sprite.types.ts:11 Extends TexturedGraphicsOptions
Construction-time configuration for a TilingSprite. Extends the
shared TexturedGraphicsOptions (anchor, tint, alpha,
visible) with the region and tiling controls. width and height are
required — they define the region the texture tiles across — and everything
else takes the documented default.
Properties
alpha?: number Opacity in the range 0 (fully transparent) to 1 (fully opaque).
Defaults to 1.
anchor?: number | PointPrimitive The anchor point — the spot on the graphic that sits on the host
WorldObject's position — as a fraction of the graphic's size in
each axis. 0 is the left/top edge, 1 the right/bottom, 0.5 the
centre. Pass a single number to use it for both axes, or a
PointPrimitive for independent values.
Defaults to 0.5 (centred), which differs from the renderer's own
top-left default. Centring matches arcade2d's convention that a
WorldObject's position is its visual origin.
height: number Height of the tiled region in world units (before the host's scale). The texture repeats vertically to fill it.
layer?: Layer The render layer this graphic draws in, as a Layer token from the
world's LayerSet (e.g. layers.get('characters')).
Layers are opt-in per world. If the world was created with layers, this
is required — omitting it throws ErrorCode.LAYER_UNSPECIFIED,
since a layered world has no implicit default band. If the world has no
layer set, this must be omitted — passing it throws
ErrorCode.LAYER_SET_ABSENT. Change it later with
AbstractGraphics.layer to move the graphic between bands.
tileOffset?: PointPrimitive Offset of the tiling pattern within the region, in (pre-tileScale)
texture pixels. Animating this is how you scroll a background. Defaults
to { x: 0, y: 0 }.
tileScale?: number | PointPrimitive Scale applied to each repeated tile, independent of the host transform.
The lever for drawing small pixel-art tiles at a larger on-screen size
without changing how many tiles fit the region. Pass a single number for
both axes or a PointPrimitive for independent values. Defaults to
1.
tint?: number Multiplicative tint as a 24-bit RGB integer (e.g. 0xff0000 for red).
0xffffff (white) leaves colours unchanged. For Text this
multiplies on top of the glyph TextOptions.fill. Defaults to
0xffffff.
visible?: boolean Whether the graphic is drawn at all. A hidden graphic still ticks and
keeps its transform in sync; it is simply skipped by the renderer.
Defaults to true.
width: number Width of the tiled region in world units (before the host's scale). The texture repeats horizontally to fill it.