Skip to content
party.js logoparty.js logo

ReferenceCustom effectsFunction

emitFrom()

Spawns particles from an area.

function emitFrom(shape: Live<EmissionShape>): SamplerFn<Vec3>;

Creates a sampler for particle positions spread across an area.

The shape is Live: pass a function to make the follow something that changes, for example the window width. It’s read again for every particle that spawns.

shapeLive<EmissionShape>

The area to spawn particles from.

// Along a line across the full width of the window.
const positionSampler = emitFrom(() => ({
type: "rect",
width: window.innerWidth,
height: 0,
}));