UNPKG

@tsparticles/interaction-particles-repulse

Version:

tsParticles repulse particles interaction

33 lines (32 loc) 942 B
import { ValueWithRandom, isNull, setRangeValue, } from "@tsparticles/engine"; export class ParticlesRepulse extends ValueWithRandom { constructor() { super(); this.enabled = false; this.distance = 1; this.duration = 1; this.factor = 1; this.speed = 1; } load(data) { super.load(data); if (isNull(data)) { return; } if (data.enabled !== undefined) { this.enabled = data.enabled; } if (data.distance !== undefined) { this.distance = setRangeValue(data.distance); } if (data.duration !== undefined) { this.duration = setRangeValue(data.duration); } if (data.factor !== undefined) { this.factor = setRangeValue(data.factor); } if (data.speed !== undefined) { this.speed = setRangeValue(data.speed); } } }