UNPKG

@tsparticles/plugin-motion

Version:

tsParticles motion sickness plugin

29 lines (28 loc) 867 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MotionPlugin = void 0; const Motion_js_1 = require("./Options/Classes/Motion.js"); const MotionInstance_js_1 = require("./MotionInstance.js"); class MotionPlugin { constructor(engine) { this.id = "motion"; this._engine = engine; } getPlugin(container) { return Promise.resolve(new MotionInstance_js_1.MotionInstance(container, this._engine)); } loadOptions(options, source) { if (!this.needsPlugin()) { return; } let motionOptions = options.motion; if (!motionOptions?.load) { options.motion = motionOptions = new Motion_js_1.Motion(); } motionOptions.load(source?.motion); } needsPlugin() { return true; } } exports.MotionPlugin = MotionPlugin;