UNPKG

tsparticles

Version:

Easily create highly customizable particle, confetti and fireworks animations and use them as animated backgrounds for your website. Ready to use components available also for React, Vue.js (2.x and 3.x), Angular, Svelte, jQuery, Preact, Riot.js, Inferno.

41 lines (40 loc) 1.09 kB
import { HslAnimation } from "./HslAnimation"; import { OptionsColor } from "./OptionsColor"; /** * [[include:Options/Particles/Color.md]] * @category Options */ export class AnimatableColor extends OptionsColor { constructor() { super(); this.animation = new HslAnimation(); } static create(source, data) { const color = new AnimatableColor(); color.load(source); if (data !== undefined) { if (typeof data === "string" || data instanceof Array) { color.load({ value: data }); } else { color.load(data); } } return color; } load(data) { super.load(data); if (!data) { return; } const colorAnimation = data.animation; if (colorAnimation !== undefined) { if (colorAnimation.enable !== undefined) { this.animation.h.load(colorAnimation); } else { this.animation.load(data.animation); } } } }