UNPKG

@tsparticles/updater-orbit

Version:

tsParticles particles orbit updater

26 lines (25 loc) 846 B
import { AnimationOptions, OptionsColor, isNull, loadProperty, loadRangeProperty, } from "@tsparticles/engine"; import { OrbitRotation } from "./OrbitRotation.js"; export class Orbit { animation = new AnimationOptions(); color; enable = false; opacity = 1; radius; rotation = new OrbitRotation(); width = 1; load(data) { if (isNull(data)) { return; } this.animation.load(data.animation); this.rotation.load(data.rotation); loadProperty(this, "enable", data.enable); loadRangeProperty(this, "opacity", data.opacity); loadRangeProperty(this, "width", data.width); loadRangeProperty(this, "radius", data.radius); if (data.color !== undefined) { this.color = OptionsColor.create(this.color, data.color); } } }