Skip to content

@modoki/engine / index / RenderConfig

Interface: RenderConfig

Particles

alignToVelocity?

optional alignToVelocity?: boolean

2D: rotate each sprite to face its direction of travel (atan2(vy, vx)), with startRotation / rotationOverLife / rotationSpeed applied as an additive offset on top (so art that "points up" can be corrected once). Off by default. Ignored by the 3D billboard backend, which is always camera-facing. Central to 2D VFX: streaking sparks, tumbling debris, arrows, slashes.


anchor?

optional anchor?: "center" | "bottom"

Billboard pivot. 'center' (default) anchors the sprite at the particle position. 'bottom' anchors the bottom edge there, so the sprite grows upward from its base — keeps a ground strike's impact planted (no apparent scaling around the middle) and lets you place the emitter on the ground plane.


aspect?

optional aspect?: number

Billboard width/height ratio (default 1 = square). Values < 1 make a tall quad,

1 a wide one. startSize controls the height; width = height × aspect. Use this to match a non-square sprite-sheet cell (e.g. a tall lightning bolt at aspect 0.5) so the texture renders without distortion or wasted transparent padding.


blend

blend: BlendMode


meshLit?

optional meshLit?: boolean

mesh mode: shade with scene lighting (true) or render flat/unlit (false, default)


meshPrimitive?

optional meshPrimitive?: MeshPrimitive

mesh mode: which built-in primitive to instance (default 'box')


mode?

optional mode?: "mesh" | "billboard"

'billboard' (default) = camera-facing textured quads; 'mesh' = instanced 3D primitives


offset?

optional offset?: [number, number]

Constant [x, y] offset of the sprite from its anchor, in units of startSize (so it scales with the particle). Applied in billboard space after the anchor: +x right, +y up. Use it to fine-tune where the art sits — e.g. nudge a bolt down so its in-texture impact point (not the cell edge) lands exactly on the ground.


renderOrder?

optional renderOrder?: number

draw-order hint relative to other transparent objects. In 2D this is the sprite's zIndex within its Canvas2D — use it to place particles above or below other 2D content.


softParticles?

optional softParticles?: boolean

depth-based soft fade near opaque geometry (Phase 3)


spriteCycles?

optional spriteCycles?: number

loop/pingpong: full animation cycles over the particle lifetime (default 1)


spriteMode?

optional spriteMode?: SpriteMode

how the sprite-sheet plays over the particle lifetime (default 'once')


spriteRandomStart?

optional spriteRandomStart?: boolean

randomize each particle's starting frame for visual variety (default false)


texture?

optional texture?: string

optional sprite-sheet/texture asset ref; when empty a soft round particle is used


tilesX?

optional tilesX?: number

sprite-sheet grid columns (default 1) — frame advances over particle lifetime


tilesY?

optional tilesY?: number

sprite-sheet grid rows (default 1)

Built with Modoki.