UNPKG

@tsparticles/engine

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.

24 lines (23 loc) 857 B
import { AnimationOptions, RangedAnimationOptions } from "./AnimationOptions.js"; import { OptionLoader } from "../../Utils/OptionLoader.js"; import { isNull } from "../../Utils/TypeUtils.js"; import { loadNestedProperty } from "../../Utils/OptionsUtils.js"; import { setRangeValue } from "../../Utils/MathUtils.js"; export class ValueWithRandom extends OptionLoader { value = 0; doLoad(data) { if (!isNull(data.value)) { this.value = setRangeValue(data.value); } } } export class AnimationValueWithRandom extends ValueWithRandom { animation = new AnimationOptions(); doLoad(data) { super.doLoad(data); loadNestedProperty(this, "animation", data.animation); } } export class RangedAnimationValueWithRandom extends AnimationValueWithRandom { animation = new RangedAnimationOptions(); }