API reference

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

C

classAttractToPoint

@codexo/exojs-particles / particles / stable

Pulls every live particle toward a fixed point in the system's local coordinate space. Acceleration magnitude is `strength` (units / s²), applied along the direction `(point − particle)`. The optional `falloff` radius softens the pull near the center — particles within `falloff` units lerp the strength linearly to zero, preventing the singularity at `r = 0` from yielding infinite acceleration. Use cases: orbit anchors, pin emitters to a moving target, simulate a "black hole" pickup. For repulsion, use RepelFromPoint; for tangential motion, layer with OrbitalForce. GPU-eligible.

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

Pulls every live particle toward a fixed point in the system's local coordinate space. Acceleration magnitude is `strength` (units / s²), applied along the direction `(point − particle)`. The optional `falloff` radius softens the pull near the center — particles within `falloff` units lerp the strength linearly to zero, preventing the singularity at `r = 0` from yielding infinite acceleration.

Use cases: orbit anchors, pin emitters to a moving target, simulate a "black hole" pickup. For repulsion, use RepelFromPoint; for tangential motion, layer with OrbitalForce.

GPU-eligible.

Constructors 1
new(x: number, y: number, strength: number, falloff: number): AttractToPoint
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 4
falloff: number
strength: number
x: number
y: number
Source