Phaser AE

Render texture

Free packv3.0.0-52DLook

Draw verbs on one object. A render texture is a sprite whose picture is a canvas you paint with shapes, text and sprites; it sorts, moves and fades like any sprite, and your paint shows from the next frame.

This is a Free pack. Every phaser.io account can use it in their games.

Released October 14, 2026 · updated October 20, 2026

Render texture: a screenshot of its demo
A note about these graphics

Expansion packs don't come with graphics. This screenshot is one way of drawing what the pack does, made for its demo: none of the sprites, tiles or backgrounds in it are in the pack.

That's by design. A pack is a game's logic, mechanics and effects, and it works with whatever art you give it. Some packs draw effects, backdrops or 3D scenes of their own, but none carries a game's sprites.

So the look is yours. Make the art on phaser.io, bring your own, or let your agent draw it in code: the same pack can look like anything.

The pack

renderTexture

function renderTexture(): Pack<{ texture: RenderTextureApi }>

The render-texture pack: v2's draw verbs, each gated behind a roster object (Law 2). No options. Requires a 2D world.

Types

RenderTextureApi

interface RenderTextureApi

game.texture.

  • create(spec: TextureSpec): TextureHandle — Spawn a texture object and return its painter. Throws if OffscreenCanvas is unavailable (a headless runtime without it).

TextureDef

interface TextureDef extends RenderTextureApi

What render-texture registers under 'texture' for other packs (core-2d's graphics).

  • readonly name: 'texture' — Its registry name.

TextureHandle

interface TextureHandle

The painter: the verbs paint a canvas, which shows from the next frame. Coordinates are texture pixels, origin top-left. Every verb returns the handle.

  • readonly handle: Handle — The roster handle of the sprite: move it, tint it, tween it, kill it.
  • readonly width: number — Texture width in pixels.
  • readonly height: number — Texture height in pixels.
  • clear(color?: string): this — Wipe to transparent, or fill with a CSS colour.
  • rect(x: number, y: number, w: number, h: number, color: string, alpha?: number, rot?: number): this — A filled rectangle from its top-left; rot in radians about its centre; alpha 0..1, default 1.
  • line(x0: number, y0: number, x1: number, y1: number, width: number, color: string, alpha?: number): this — A round-capped stroke; width in pixels.
  • poly(points: ReadonlyArray<{ x: number; y: number }>, width: number, color: string, alpha?: number, closed?: boolean): this — A stroked polyline, round joins; closed joins the last point to the first. Fewer than two points draws nothing.
  • fill(points: ReadonlyArray<{ x: number; y: number }>, color: string, alpha?: number): this — A filled polygon. Fewer than three points draws nothing.
  • circle(cx: number, cy: number, r: number, color: string, alpha?: number): this — A filled disc of radius r pixels.
  • ring(cx: number, cy: number, r: number, thickness: number, color: string, alpha?: number): this — A stroked circle; thickness in pixels, centred on the radius.
  • text(str: string, x: number, y: number, opts?: { font?: string; color?: string; align?: CanvasTextAlign; baseline?: CanvasTextBaseline; alpha?: number }): this — Canvas text: a CSS font string (default '16px sans-serif'), a colour (default '#ffffff'), an alignment (default left, top).
  • sprite(frame: number, x: number, y: number, w?: number, h?: number, opts?: { rot?: number; alpha?: number; tint?: string }): this — Paint a frame (on any atlas page, or a picture's own texture) centred at x,y; w/h default to the frame's size, rot in radians, tint multiplies the pixels. A copy: an animated frame does not stay live.
  • draw(fn: (ctx: import('@phaser-ae/kernel').PaintContext) => void): this — The escape hatch: paint with the 2D context yourself.
  • flush(): this — Push the paint to the GPU now. Not needed: what is painted shows from the next frame on its own.
  • destroy(): void — Remove the object; the same as handle.kill().
  • readonly flushes: number — Frames flushed so far.

TextureSpec

interface TextureSpec

What create spawns: the texture's size, and the sprite fields of the object that carries it.

  • id?: string — The object's id. Default 'texture'.
  • width?: number — Texture width in pixels; rounded, minimum 1. Default: the screen's width. A big texture gets a texture of its own; a small one shares the atlas.
  • height?: number — Texture height in pixels; rounded, minimum 1. Default: the screen's height.
  • x?: number — The object's centre, world or screen units by layer. Default 0, or the screen's centre for a screen-sized texture.
  • y?: number — The object's centre, world or screen units by layer. Default 0, or the screen's centre for a screen-sized texture.
  • layer?: string — The draw layer; the world's default when omitted.
  • clear?: boolean — Start transparent where nothing is painted. Default true.
  • tags?: string[] — Tags on the object. Default ['texture'].
  • visible?: boolean — Whether the object draws. Default true.