UNPKG

@dominicstop/utils

Version:

Yet another event emitter written in typescript.

29 lines 1.01 kB
import { Vector2D } from "../geometry"; import { AnyParticle } from "./AnyParticle"; import { SomeParticleForce } from "./SomeParticleForce"; /** * Applies a central attractive force pulling the particle toward * a fixed center (e.g., like a spring). */ export declare class CentralAttractionForce implements SomeParticleForce { /** * the point particles are attracted to, i.e. The point where the particles * will move towards to. * */ center: Vector2D; /** Attraction constant (e.g., spring stiffness k) */ strength: number; isActive: boolean; constructor(center: Vector2D, strength: number, isActive?: boolean); /** * Applies a force to the particle: * `F = -strength * (particle.position - center)` * * This simulates a harmonic potential pulling particles inward. * * @param particle The particle to apply the force to. */ apply(particle: AnyParticle): void; } //# sourceMappingURL=CentralAttractionForce.d.ts.map