Skip to content

ParticleDef beta ​

Interface of @v12-engine/client

ts
export interface ParticleDef

An emitter of particles (effects plan B1), drawn by the renderer's particles. Every field reads the effect's knobs (Param). Sizes and speeds are in world units (a cell is 1), times in seconds

Members ​

alpha ​

ts
alpha?: Param<FxCurve>;

How opaque over their life, times the colour's own: a fade out when left out ([1, 0])

angle ​

ts
angle?: Param<Range>;

What they are turned to at birth, in radians: 0 when left out, [0, 6.28] any way

billboard ​

ts
billboard?: Param<'camera' | 'up' | 'stretched' | 'flat'>;

How they face: the camera (camera, when left out), the camera but upright (up: flames), long along the way they go (stretched: sparks, rain), or lying flat, facing up (flat: ripples, a shockwave): those go up or down only, not sideways, and grow and turn in place (their size, rotation)

blend ​

ts
blend?: Param<'add' | 'alpha' | 'multiply'>;

How they are laid over what is behind: added (add, light: fire, sparks), over it (alpha: smoke, dust), multiply (shade). add when left out

bursts ​

ts
bursts?: Param<readonly {
        at: number;
        count: number;
    }[]>;

How many at once, at moments of the part (seconds from its start): an explosion's [{ at: 0, count: 80 }]

capacity ​

ts
capacity?: number;

The most that are alive at once: from the rate, the bursts and their lifetime when left out

color ​

ts
color?: Param<Gradient>;

Their colour over their life (Gradient), its alpha the colour's own: white when left out

direction ​

ts
direction?: Param<readonly [number, number, number] | readonly [readonly [number, number, number], readonly [number, number, number]]>;

Which way they set off from a point, a box, a cylinder: between the two, straight up when left out

drag ​

ts
drag?: Param<FxCurve>;

How much they slow, 0 (not at all) to 1 (to a stop over their life), or over their life as a curve

fallback ​

ts
fallback?: ParticleTexture;

What they are drawn with where texture's file is not there (a game without @v12-engine/assets): a texture made in the page, its flipbook not played. The file is drawn with all the same, as squares, when left out

flipbook ​

ts
flipbook?: Param<Flipbook>;

A texture of frames, in columns and rows, played through: fps frames a second (once over its life when left out), from a random frame (random), over and over (loop)

gpu ​

ts
gpu?: 'auto' | boolean;

Moved on the graphics card where it can: auto (when left out) does for a big one (500 alive and more) that asks for nothing only the CPU does (sub, soft, ground), yes or no always

gravity ​

ts
gravity?: Param<number>;

How hard they are pulled down (up when less than 0): 0 when left out

lifetime ​

ts
lifetime?: Param<Range>;

Seconds each lasts: 1 when left out

lit ​

ts
lit?: Param<boolean>;

Darker at night (to a little over half), as what is lit by the sun is: smoke and dust are, fire and sparks are not. No when left out

local ​

ts
local?: Param<boolean>;

They move with what they come from rather than stay where they were let go: a torch carried. No when left out

name ​

ts
name?: string;

Its name, as the debug tools and what is refused say it: fx when left out

noise ​

ts
noise?: Param<number | {
        strength: number;
        scale?: number;
    }>;

How much they are thrown about (turbulence): how strong, and how big its swirls are. None when left out

order ​

ts
order?: Param<number>;

The group it is drawn in, 0 to 3: 0 (when left out) with the world, hidden behind what stands in front of it; higher drawn over everything of the lower groups (a mark that must always show)

over ​

ts
over?: ParticleOver;

The emitter over the part's time (ParticleOver): how many, how big, of what colour, how fast and from how wide, as the part goes on. As the fields say all along when left out

prewarm ​

ts
prewarm?: Param<number>;

Seconds of it run before it is shown, so a fire is already burning as it comes into view: none when left out

rate ​

ts
rate?: Param<number>;

How many a second, for as long as the part lasts. None when left out

rotation ​

ts
rotation?: Param<FxCurve>;

How fast they turn, radians a second, over their life: none when left out

shape ​

ts
shape?: Param<EmitterShape>;

Where they start and which way they go (EmitterShape): a point when left out

size ​

ts
size?: Param<FxCurve>;

How big, across, over their life (FxCurve): 0.3 when left out

soft ​

ts
soft?: Param<number>;

How far over the ground they fade out as they come near it, rather than cut through it. None when left out (on the CPU only)

speed ​

ts
speed?: Param<Range>;

How fast they set off: 1 when left out

spread ​

ts
spread?: Param<number>;

How far from the shape's own way they may go, 0 to 1 (sphere, hemisphere, cylinder): 0 when left out

stretch ​

ts
stretch?: Param<Range>;

How much wider than tall, or taller with billboard: 'stretched': 1 when left out

sub ​

ts
sub?: readonly {
        on?: 'death' | 'birth';
        particles: ParticleDef;
    }[];

Emitters started from each particle: at its end (death: sparks off embers that burn out) or carried with it all its life (birth: a trail of smoke behind each piece). One of the list, picked at random, for each. On the CPU only

texture ​

ts
texture?: Param<ParticleTexture>;

What they are drawn with (ParticleTexture): a soft round dot when left out

velocity ​

ts
velocity?: Param<FxCurve>;

How fast they go over their life, times the speed they set off with: as they set off when left out

wind ​

ts
wind?: Param<number>;

How much the map's wind (client.wind) carries them, 0 not at all: smoke 1, sparks 0.2. 0 when left out