API reference

Every public class, method, and event in @codexo/exojs. Generated from source.

C

classApplyForce

@codexo/exojs-particles / particles / stable

Adds a constant 2D acceleration to every live particle's velocity each frame. Use for gravity (`new ApplyForce(0, 980)`), wind, or any uniform force field. Force is applied to all particles equally — for per-particle variation, layer multiple ApplyForce modules with different gates. GPU-eligible: implements UpdateModule.wgsl so this module runs in the system's compute shader on WebGPU backends with no CPU readback.

2
props
5
methods
0
events
Import
import { ApplyForce } from '@codexo/exojs-particles'

Adds a constant 2D acceleration to every live particle's velocity each frame. Use for gravity (`new ApplyForce(0, 980)`), wind, or any uniform force field. Force is applied to all particles equally — for per-particle variation, layer multiple ApplyForce modules with different gates.

GPU-eligible: implements UpdateModule.wgsl so this module runs in the system's compute shader on WebGPU backends with no CPU readback.

Constructors 1
new(accelerationX: number, accelerationY: number): ApplyForce
Methods 5
apply(system: ParticleSystem, dt: number): void
destroy(): void
uploadTextures(device: GPUDevice, textures: ReadonlyMap<string, GPUTexture>): void
wgsl(): WgslContribution
writeUniforms(view: DataView, offset: number): void
Properties 2
accelerationX: number
accelerationY: number
Source