@tsparticles/plugin-motion 3.0.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +70 -0
- package/browser/MotionInstance.js +49 -0
- package/browser/Options/Classes/Motion.js +16 -0
- package/browser/Options/Classes/MotionReduce.js +17 -0
- package/browser/Options/Interfaces/IMotion.js +1 -0
- package/browser/Options/Interfaces/IMotionReduce.js +1 -0
- package/browser/index.js +28 -0
- package/browser/types.js +1 -0
- package/cjs/MotionInstance.js +64 -0
- package/cjs/Options/Classes/Motion.js +20 -0
- package/cjs/Options/Classes/MotionReduce.js +21 -0
- package/cjs/Options/Interfaces/IMotion.js +2 -0
- package/cjs/Options/Interfaces/IMotionReduce.js +2 -0
- package/cjs/index.js +43 -0
- package/cjs/types.js +2 -0
- package/esm/MotionInstance.js +49 -0
- package/esm/Options/Classes/Motion.js +16 -0
- package/esm/Options/Classes/MotionReduce.js +17 -0
- package/esm/Options/Interfaces/IMotion.js +1 -0
- package/esm/Options/Interfaces/IMotionReduce.js +1 -0
- package/esm/index.js +28 -0
- package/esm/types.js +1 -0
- package/package.json +81 -0
- package/report.html +39 -0
- package/tsparticles.plugin.motion.js +209 -0
- package/tsparticles.plugin.motion.min.js +2 -0
- package/tsparticles.plugin.motion.min.js.LICENSE.txt +8 -0
- package/types/MotionInstance.d.ts +9 -0
- package/types/Options/Classes/Motion.d.ts +9 -0
- package/types/Options/Classes/MotionReduce.d.ts +8 -0
- package/types/Options/Interfaces/IMotion.d.ts +5 -0
- package/types/Options/Interfaces/IMotionReduce.d.ts +4 -0
- package/types/index.d.ts +2 -0
- package/types/types.d.ts +12 -0
- package/umd/MotionInstance.js +63 -0
- package/umd/Options/Classes/Motion.js +30 -0
- package/umd/Options/Classes/MotionReduce.js +31 -0
- package/umd/Options/Interfaces/IMotion.js +12 -0
- package/umd/Options/Interfaces/IMotionReduce.js +12 -0
- package/umd/index.js +42 -0
- package/umd/types.js +12 -0
|
@@ -0,0 +1,209 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Author : Matteo Bruni
|
|
3
|
+
* MIT license: https://opensource.org/licenses/MIT
|
|
4
|
+
* Demo / Generator : https://particles.js.org/
|
|
5
|
+
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
|
+
* How to use? : Check the GitHub README
|
|
7
|
+
* v3.0.0-alpha.0
|
|
8
|
+
*/
|
|
9
|
+
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
|
+
if(typeof exports === 'object' && typeof module === 'object')
|
|
11
|
+
module.exports = factory(require("@tsparticles/engine"));
|
|
12
|
+
else if(typeof define === 'function' && define.amd)
|
|
13
|
+
define(["@tsparticles/engine"], factory);
|
|
14
|
+
else {
|
|
15
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
16
|
+
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
17
|
+
}
|
|
18
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
|
|
19
|
+
return /******/ (() => { // webpackBootstrap
|
|
20
|
+
/******/ "use strict";
|
|
21
|
+
/******/ var __webpack_modules__ = ({
|
|
22
|
+
|
|
23
|
+
/***/ 533:
|
|
24
|
+
/***/ ((module) => {
|
|
25
|
+
|
|
26
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__533__;
|
|
27
|
+
|
|
28
|
+
/***/ })
|
|
29
|
+
|
|
30
|
+
/******/ });
|
|
31
|
+
/************************************************************************/
|
|
32
|
+
/******/ // The module cache
|
|
33
|
+
/******/ var __webpack_module_cache__ = {};
|
|
34
|
+
/******/
|
|
35
|
+
/******/ // The require function
|
|
36
|
+
/******/ function __webpack_require__(moduleId) {
|
|
37
|
+
/******/ // Check if module is in cache
|
|
38
|
+
/******/ var cachedModule = __webpack_module_cache__[moduleId];
|
|
39
|
+
/******/ if (cachedModule !== undefined) {
|
|
40
|
+
/******/ return cachedModule.exports;
|
|
41
|
+
/******/ }
|
|
42
|
+
/******/ // Create a new module (and put it into the cache)
|
|
43
|
+
/******/ var module = __webpack_module_cache__[moduleId] = {
|
|
44
|
+
/******/ // no module.id needed
|
|
45
|
+
/******/ // no module.loaded needed
|
|
46
|
+
/******/ exports: {}
|
|
47
|
+
/******/ };
|
|
48
|
+
/******/
|
|
49
|
+
/******/ // Execute the module function
|
|
50
|
+
/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
51
|
+
/******/
|
|
52
|
+
/******/ // Return the exports of the module
|
|
53
|
+
/******/ return module.exports;
|
|
54
|
+
/******/ }
|
|
55
|
+
/******/
|
|
56
|
+
/************************************************************************/
|
|
57
|
+
/******/ /* webpack/runtime/define property getters */
|
|
58
|
+
/******/ (() => {
|
|
59
|
+
/******/ // define getter functions for harmony exports
|
|
60
|
+
/******/ __webpack_require__.d = (exports, definition) => {
|
|
61
|
+
/******/ for(var key in definition) {
|
|
62
|
+
/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
|
|
63
|
+
/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
|
|
64
|
+
/******/ }
|
|
65
|
+
/******/ }
|
|
66
|
+
/******/ };
|
|
67
|
+
/******/ })();
|
|
68
|
+
/******/
|
|
69
|
+
/******/ /* webpack/runtime/hasOwnProperty shorthand */
|
|
70
|
+
/******/ (() => {
|
|
71
|
+
/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
72
|
+
/******/ })();
|
|
73
|
+
/******/
|
|
74
|
+
/******/ /* webpack/runtime/make namespace object */
|
|
75
|
+
/******/ (() => {
|
|
76
|
+
/******/ // define __esModule on exports
|
|
77
|
+
/******/ __webpack_require__.r = (exports) => {
|
|
78
|
+
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
79
|
+
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
80
|
+
/******/ }
|
|
81
|
+
/******/ Object.defineProperty(exports, '__esModule', { value: true });
|
|
82
|
+
/******/ };
|
|
83
|
+
/******/ })();
|
|
84
|
+
/******/
|
|
85
|
+
/************************************************************************/
|
|
86
|
+
var __webpack_exports__ = {};
|
|
87
|
+
// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
|
|
88
|
+
(() => {
|
|
89
|
+
// ESM COMPAT FLAG
|
|
90
|
+
__webpack_require__.r(__webpack_exports__);
|
|
91
|
+
|
|
92
|
+
// EXPORTS
|
|
93
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
94
|
+
"loadMotionPlugin": () => (/* binding */ loadMotionPlugin)
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/MotionReduce.js
|
|
98
|
+
class MotionReduce {
|
|
99
|
+
constructor() {
|
|
100
|
+
this.factor = 4;
|
|
101
|
+
this.value = true;
|
|
102
|
+
}
|
|
103
|
+
load(data) {
|
|
104
|
+
if (!data) {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
if (data.factor !== undefined) {
|
|
108
|
+
this.factor = data.factor;
|
|
109
|
+
}
|
|
110
|
+
if (data.value !== undefined) {
|
|
111
|
+
this.value = data.value;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
;// CONCATENATED MODULE: ./dist/browser/Options/Classes/Motion.js
|
|
116
|
+
|
|
117
|
+
class Motion {
|
|
118
|
+
constructor() {
|
|
119
|
+
this.disable = false;
|
|
120
|
+
this.reduce = new MotionReduce();
|
|
121
|
+
}
|
|
122
|
+
load(data) {
|
|
123
|
+
if (!data) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
if (data.disable !== undefined) {
|
|
127
|
+
this.disable = data.disable;
|
|
128
|
+
}
|
|
129
|
+
this.reduce.load(data.reduce);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
133
|
+
var engine_root_window_ = __webpack_require__(533);
|
|
134
|
+
;// CONCATENATED MODULE: ./dist/browser/MotionInstance.js
|
|
135
|
+
|
|
136
|
+
class MotionInstance {
|
|
137
|
+
constructor(container, engine) {
|
|
138
|
+
this._container = container;
|
|
139
|
+
this._engine = engine;
|
|
140
|
+
}
|
|
141
|
+
async init() {
|
|
142
|
+
const container = this._container,
|
|
143
|
+
options = container.actualOptions.motion;
|
|
144
|
+
if (options && (options.disable || options.reduce.value)) {
|
|
145
|
+
const mediaQuery = (0,engine_root_window_.safeMatchMedia)("(prefers-reduced-motion: reduce)");
|
|
146
|
+
if (mediaQuery) {
|
|
147
|
+
this._handleMotionChange(mediaQuery);
|
|
148
|
+
const handleChange = async () => {
|
|
149
|
+
this._handleMotionChange(mediaQuery);
|
|
150
|
+
try {
|
|
151
|
+
await container.refresh();
|
|
152
|
+
} catch (_a) {}
|
|
153
|
+
};
|
|
154
|
+
if (mediaQuery.addEventListener !== undefined) {
|
|
155
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
156
|
+
} else if (mediaQuery.addListener !== undefined) {
|
|
157
|
+
mediaQuery.addListener(handleChange);
|
|
158
|
+
}
|
|
159
|
+
} else {
|
|
160
|
+
container.retina.reduceFactor = 1;
|
|
161
|
+
}
|
|
162
|
+
} else {
|
|
163
|
+
container.retina.reduceFactor = 1;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
_handleMotionChange(mediaQuery) {
|
|
167
|
+
const container = this._container,
|
|
168
|
+
motion = container.actualOptions.motion;
|
|
169
|
+
if (!motion) {
|
|
170
|
+
return;
|
|
171
|
+
}
|
|
172
|
+
container.retina.reduceFactor = mediaQuery.matches ? motion.disable ? 0 : motion.reduce.value ? 1 / motion.reduce.factor : 1 : 1;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
176
|
+
|
|
177
|
+
|
|
178
|
+
class MotionPlugin {
|
|
179
|
+
constructor(engine) {
|
|
180
|
+
this.id = "motion";
|
|
181
|
+
this._engine = engine;
|
|
182
|
+
}
|
|
183
|
+
getPlugin(container) {
|
|
184
|
+
return new MotionInstance(container, this._engine);
|
|
185
|
+
}
|
|
186
|
+
loadOptions(options, source) {
|
|
187
|
+
if (!this.needsPlugin()) {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
let motionOptions = options.motion;
|
|
191
|
+
if ((motionOptions === null || motionOptions === void 0 ? void 0 : motionOptions.load) === undefined) {
|
|
192
|
+
options.motion = motionOptions = new Motion();
|
|
193
|
+
}
|
|
194
|
+
motionOptions.load(source === null || source === void 0 ? void 0 : source.motion);
|
|
195
|
+
}
|
|
196
|
+
needsPlugin() {
|
|
197
|
+
return true;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
async function loadMotionPlugin(engine) {
|
|
201
|
+
const plugin = new MotionPlugin(engine);
|
|
202
|
+
await engine.addPlugin(plugin);
|
|
203
|
+
}
|
|
204
|
+
})();
|
|
205
|
+
|
|
206
|
+
/******/ return __webpack_exports__;
|
|
207
|
+
/******/ })()
|
|
208
|
+
;
|
|
209
|
+
});
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
/*! For license information please see tsparticles.plugin.motion.min.js.LICENSE.txt */
|
|
2
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],t);else{var o="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var i in o)("object"==typeof exports?exports:e)[i]=o[i]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function i(e){var n=o[e];if(void 0!==n)return n.exports;var r=o[e]={exports:{}};return t[e](r,r.exports,i),r.exports}i.d=(e,t)=>{for(var o in t)i.o(t,o)&&!i.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{i.r(n),i.d(n,{loadMotionPlugin:()=>s});class e{constructor(){this.factor=4,this.value=!0}load(e){e&&(void 0!==e.factor&&(this.factor=e.factor),void 0!==e.value&&(this.value=e.value))}}class t{constructor(){this.disable=!1,this.reduce=new e}load(e){e&&(void 0!==e.disable&&(this.disable=e.disable),this.reduce.load(e.reduce))}}var o=i(533);class r{constructor(e,t){this._container=e,this._engine=t}async init(){const e=this._container,t=e.actualOptions.motion;if(t&&(t.disable||t.reduce.value)){const t=(0,o.safeMatchMedia)("(prefers-reduced-motion: reduce)");if(t){this._handleMotionChange(t);const o=async()=>{this._handleMotionChange(t);try{await e.refresh()}catch(e){}};void 0!==t.addEventListener?t.addEventListener("change",o):void 0!==t.addListener&&t.addListener(o)}else e.retina.reduceFactor=1}else e.retina.reduceFactor=1}_handleMotionChange(e){const t=this._container,o=t.actualOptions.motion;o&&(t.retina.reduceFactor=e.matches?o.disable?0:o.reduce.value?1/o.reduce.factor:1:1)}}class a{constructor(e){this.id="motion",this._engine=e}getPlugin(e){return new r(e,this._engine)}loadOptions(e,o){if(!this.needsPlugin())return;let i=e.motion;void 0===(null==i?void 0:i.load)&&(e.motion=i=new t),i.load(null==o?void 0:o.motion)}needsPlugin(){return!0}}async function s(e){const t=new a(e);await e.addPlugin(t)}})(),n})()));
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Engine, IContainerPlugin } from "@tsparticles/engine";
|
|
2
|
+
import type { MotionContainer } from "./types";
|
|
3
|
+
export declare class MotionInstance implements IContainerPlugin {
|
|
4
|
+
private readonly _container;
|
|
5
|
+
private readonly _engine;
|
|
6
|
+
constructor(container: MotionContainer, engine: Engine);
|
|
7
|
+
init(): Promise<void>;
|
|
8
|
+
private _handleMotionChange;
|
|
9
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { IMotion } from "../Interfaces/IMotion";
|
|
3
|
+
import { MotionReduce } from "./MotionReduce";
|
|
4
|
+
export declare class Motion implements IMotion, IOptionLoader<IMotion> {
|
|
5
|
+
disable: boolean;
|
|
6
|
+
reduce: MotionReduce;
|
|
7
|
+
constructor();
|
|
8
|
+
load(data?: RecursivePartial<IMotion>): void;
|
|
9
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { IMotionReduce } from "../Interfaces/IMotionReduce";
|
|
3
|
+
export declare class MotionReduce implements IMotionReduce, IOptionLoader<IMotionReduce> {
|
|
4
|
+
factor: number;
|
|
5
|
+
value: boolean;
|
|
6
|
+
constructor();
|
|
7
|
+
load(data?: RecursivePartial<IMotionReduce>): void;
|
|
8
|
+
}
|
package/types/index.d.ts
ADDED
package/types/types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Container, IOptions, Options } from "@tsparticles/engine";
|
|
2
|
+
import type { IMotion } from "./Options/Interfaces/IMotion";
|
|
3
|
+
import type { Motion } from "./Options/Classes/Motion";
|
|
4
|
+
export type IMotionOptions = IOptions & {
|
|
5
|
+
motion?: IMotion;
|
|
6
|
+
};
|
|
7
|
+
export type MotionOptions = Options & {
|
|
8
|
+
motion?: Motion;
|
|
9
|
+
};
|
|
10
|
+
export type MotionContainer = Container & {
|
|
11
|
+
actualOptions: MotionOptions;
|
|
12
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MotionInstance = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
14
|
+
class MotionInstance {
|
|
15
|
+
constructor(container, engine) {
|
|
16
|
+
this._container = container;
|
|
17
|
+
this._engine = engine;
|
|
18
|
+
}
|
|
19
|
+
async init() {
|
|
20
|
+
const container = this._container, options = container.actualOptions.motion;
|
|
21
|
+
if (options && (options.disable || options.reduce.value)) {
|
|
22
|
+
const mediaQuery = (0, engine_1.safeMatchMedia)("(prefers-reduced-motion: reduce)");
|
|
23
|
+
if (mediaQuery) {
|
|
24
|
+
this._handleMotionChange(mediaQuery);
|
|
25
|
+
const handleChange = async () => {
|
|
26
|
+
this._handleMotionChange(mediaQuery);
|
|
27
|
+
try {
|
|
28
|
+
await container.refresh();
|
|
29
|
+
}
|
|
30
|
+
catch (_a) {
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
if (mediaQuery.addEventListener !== undefined) {
|
|
34
|
+
mediaQuery.addEventListener("change", handleChange);
|
|
35
|
+
}
|
|
36
|
+
else if (mediaQuery.addListener !== undefined) {
|
|
37
|
+
mediaQuery.addListener(handleChange);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
container.retina.reduceFactor = 1;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
container.retina.reduceFactor = 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
_handleMotionChange(mediaQuery) {
|
|
49
|
+
const container = this._container, motion = container.actualOptions.motion;
|
|
50
|
+
if (!motion) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
container.retina.reduceFactor = mediaQuery.matches
|
|
54
|
+
? motion.disable
|
|
55
|
+
? 0
|
|
56
|
+
: motion.reduce.value
|
|
57
|
+
? 1 / motion.reduce.factor
|
|
58
|
+
: 1
|
|
59
|
+
: 1;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
exports.MotionInstance = MotionInstance;
|
|
63
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./MotionReduce"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.Motion = void 0;
|
|
13
|
+
const MotionReduce_1 = require("./MotionReduce");
|
|
14
|
+
class Motion {
|
|
15
|
+
constructor() {
|
|
16
|
+
this.disable = false;
|
|
17
|
+
this.reduce = new MotionReduce_1.MotionReduce();
|
|
18
|
+
}
|
|
19
|
+
load(data) {
|
|
20
|
+
if (!data) {
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
if (data.disable !== undefined) {
|
|
24
|
+
this.disable = data.disable;
|
|
25
|
+
}
|
|
26
|
+
this.reduce.load(data.reduce);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
exports.Motion = Motion;
|
|
30
|
+
});
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.MotionReduce = void 0;
|
|
13
|
+
class MotionReduce {
|
|
14
|
+
constructor() {
|
|
15
|
+
this.factor = 4;
|
|
16
|
+
this.value = true;
|
|
17
|
+
}
|
|
18
|
+
load(data) {
|
|
19
|
+
if (!data) {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (data.factor !== undefined) {
|
|
23
|
+
this.factor = data.factor;
|
|
24
|
+
}
|
|
25
|
+
if (data.value !== undefined) {
|
|
26
|
+
this.value = data.value;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.MotionReduce = MotionReduce;
|
|
31
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|
package/umd/index.js
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports", "./Options/Classes/Motion", "./MotionInstance"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.loadMotionPlugin = void 0;
|
|
13
|
+
const Motion_1 = require("./Options/Classes/Motion");
|
|
14
|
+
const MotionInstance_1 = require("./MotionInstance");
|
|
15
|
+
class MotionPlugin {
|
|
16
|
+
constructor(engine) {
|
|
17
|
+
this.id = "motion";
|
|
18
|
+
this._engine = engine;
|
|
19
|
+
}
|
|
20
|
+
getPlugin(container) {
|
|
21
|
+
return new MotionInstance_1.MotionInstance(container, this._engine);
|
|
22
|
+
}
|
|
23
|
+
loadOptions(options, source) {
|
|
24
|
+
if (!this.needsPlugin()) {
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
let motionOptions = options.motion;
|
|
28
|
+
if ((motionOptions === null || motionOptions === void 0 ? void 0 : motionOptions.load) === undefined) {
|
|
29
|
+
options.motion = motionOptions = new Motion_1.Motion();
|
|
30
|
+
}
|
|
31
|
+
motionOptions.load(source === null || source === void 0 ? void 0 : source.motion);
|
|
32
|
+
}
|
|
33
|
+
needsPlugin() {
|
|
34
|
+
return true;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function loadMotionPlugin(engine) {
|
|
38
|
+
const plugin = new MotionPlugin(engine);
|
|
39
|
+
await engine.addPlugin(plugin);
|
|
40
|
+
}
|
|
41
|
+
exports.loadMotionPlugin = loadMotionPlugin;
|
|
42
|
+
});
|
package/umd/types.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
(function (factory) {
|
|
2
|
+
if (typeof module === "object" && typeof module.exports === "object") {
|
|
3
|
+
var v = factory(require, exports);
|
|
4
|
+
if (v !== undefined) module.exports = v;
|
|
5
|
+
}
|
|
6
|
+
else if (typeof define === "function" && define.amd) {
|
|
7
|
+
define(["require", "exports"], factory);
|
|
8
|
+
}
|
|
9
|
+
})(function (require, exports) {
|
|
10
|
+
"use strict";
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
});
|