Skip to content
party.js logoparty.js logo

ReferenceBehaviorsType

BehaviorUpdate

Updates a particle by one simulation step.

type BehaviorUpdate = (particle: Particle, ctx: BehaviorUpdateContext) => void;

A function that updates a particle by a single simulation step.

Called for every particle on every step, in the order that the behaviors are listed in. Any “per-second” changes should be scaled by ctx.dt to make the behavior independent of the step size.

particleParticle

The particle to be updated.

ctxBehaviorUpdateContext

The context supplied to the update, including the random number generator and the time step.