UNPKG

@tsparticles/interaction-external-bubble

Version:

tsParticles bubble external interaction

12 lines (11 loc) 481 B
import { clamp } from "@tsparticles/engine"; export function calculateBubbleValue(particleValue, modeValue, optionsValue, ratio) { if (modeValue >= optionsValue) { const value = particleValue + (modeValue - optionsValue) * ratio; return clamp(value, particleValue, modeValue); } else if (modeValue < optionsValue) { const value = particleValue - (optionsValue - modeValue) * ratio; return clamp(value, modeValue, particleValue); } }