@tsparticles/updater-twinkle 3.0.0-alpha.1 → 3.0.0-beta.1
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/README.md +16 -12
- package/browser/Options/Classes/Twinkle.js +1 -1
- package/browser/Options/Classes/TwinkleValues.js +1 -1
- package/browser/TwinkleUpdater.js +3 -3
- package/browser/Types.js +1 -0
- package/browser/index.js +3 -3
- package/browser/package.json +1 -0
- package/cjs/Options/Classes/Twinkle.js +3 -3
- package/cjs/TwinkleUpdater.js +4 -4
- package/cjs/Types.js +2 -0
- package/cjs/index.js +3 -14
- package/cjs/package.json +1 -0
- package/esm/Options/Classes/Twinkle.js +1 -1
- package/esm/Options/Classes/TwinkleValues.js +1 -1
- package/esm/TwinkleUpdater.js +3 -3
- package/esm/Types.js +1 -0
- package/esm/index.js +3 -3
- package/esm/package.json +1 -0
- package/package.json +19 -6
- package/report.html +4 -4
- package/tsparticles.updater.twinkle.js +5 -5
- package/tsparticles.updater.twinkle.min.js +1 -1
- package/tsparticles.updater.twinkle.min.js.LICENSE.txt +1 -8
- package/types/Options/Classes/Twinkle.d.ts +2 -2
- package/types/Options/Classes/TwinkleValues.d.ts +2 -3
- package/types/Options/Interfaces/ITwinkle.d.ts +1 -1
- package/types/TwinkleUpdater.d.ts +2 -13
- package/types/Types.d.ts +12 -0
- package/types/index.d.ts +1 -1
- package/umd/Options/Classes/Twinkle.js +4 -4
- package/umd/TwinkleUpdater.js +4 -4
- package/umd/Types.js +12 -0
- package/umd/index.js +4 -4
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Demo / Generator : https://particles.js.org/
|
|
5
5
|
* GitHub : https://www.github.com/matteobruni/tsparticles
|
|
6
6
|
* How to use? : Check the GitHub README
|
|
7
|
-
* v3.0.0-
|
|
7
|
+
* v3.0.0-beta.1
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
@@ -91,7 +91,7 @@ __webpack_require__.r(__webpack_exports__);
|
|
|
91
91
|
|
|
92
92
|
// EXPORTS
|
|
93
93
|
__webpack_require__.d(__webpack_exports__, {
|
|
94
|
-
|
|
94
|
+
loadTwinkleUpdater: () => (/* binding */ loadTwinkleUpdater)
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
@@ -174,15 +174,15 @@ class TwinkleUpdater {
|
|
|
174
174
|
options.twinkle = new Twinkle();
|
|
175
175
|
}
|
|
176
176
|
for (const source of sources) {
|
|
177
|
-
options.twinkle.load(source
|
|
177
|
+
options.twinkle.load(source?.twinkle);
|
|
178
178
|
}
|
|
179
179
|
}
|
|
180
180
|
update() {}
|
|
181
181
|
}
|
|
182
182
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
183
183
|
|
|
184
|
-
async function loadTwinkleUpdater(engine) {
|
|
185
|
-
await engine.addParticleUpdater("twinkle", () => new TwinkleUpdater());
|
|
184
|
+
async function loadTwinkleUpdater(engine, refresh = true) {
|
|
185
|
+
await engine.addParticleUpdater("twinkle", () => new TwinkleUpdater(), refresh);
|
|
186
186
|
}
|
|
187
187
|
})();
|
|
188
188
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.updater.twinkle.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 r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function r(e){var i=o[e];if(void 0!==i)return i.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadTwinkleUpdater:()=>l});var e=r(533);class t{constructor(){this.enable=!1,this.frequency=.05,this.opacity=1}load(t){t&&(void 0!==t.color&&(this.color=e.OptionsColor.create(this.color,t.color)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.frequency&&(this.frequency=t.frequency),void 0!==t.opacity&&(this.opacity=(0,e.setRangeValue)(t.opacity)))}}class o{constructor(){this.lines=new t,this.particles=new t}load(e){e&&(this.lines.load(e.lines),this.particles.load(e.particles))}}class n{getColorStyles(t,o,r,i){const n=t.options.twinkle;if(!n)return{};const l=n.particles,s=l.enable&&(0,e.getRandom)()<l.frequency,a=t.options.zIndex,c=(1-t.zIndexFactor)**a.opacityRate,p=s?(0,e.getRangeValue)(l.opacity)*c:i,d=(0,e.rangeColorToHsl)(l.color),
|
|
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 r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},o={};function r(e){var i=o[e];if(void 0!==i)return i.exports;var n=o[e]={exports:{}};return t[e](n,n.exports,r),n.exports}r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var i={};return(()=>{r.r(i),r.d(i,{loadTwinkleUpdater:()=>l});var e=r(533);class t{constructor(){this.enable=!1,this.frequency=.05,this.opacity=1}load(t){t&&(void 0!==t.color&&(this.color=e.OptionsColor.create(this.color,t.color)),void 0!==t.enable&&(this.enable=t.enable),void 0!==t.frequency&&(this.frequency=t.frequency),void 0!==t.opacity&&(this.opacity=(0,e.setRangeValue)(t.opacity)))}}class o{constructor(){this.lines=new t,this.particles=new t}load(e){e&&(this.lines.load(e.lines),this.particles.load(e.particles))}}class n{getColorStyles(t,o,r,i){const n=t.options.twinkle;if(!n)return{};const l=n.particles,s=l.enable&&(0,e.getRandom)()<l.frequency,a=t.options.zIndex,c=(1-t.zIndexFactor)**a.opacityRate,p=s?(0,e.getRangeValue)(l.opacity)*c:i,d=(0,e.rangeColorToHsl)(l.color),f=d?(0,e.getStyleFromHsl)(d,p):void 0,u={},y=s&&f;return u.fill=y?f:void 0,u.stroke=y?f:void 0,u}init(){}isEnabled(e){const t=e.options.twinkle;return!!t&&t.particles.enable}loadOptions(e,...t){e.twinkle||(e.twinkle=new o);for(const o of t)e.twinkle.load(o?.twinkle)}update(){}}async function l(e,t=!0){await e.addParticleUpdater("twinkle",(()=>new n),t)}})(),i})()));
|
|
@@ -1,8 +1 @@
|
|
|
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.1
|
|
8
|
-
*/
|
|
1
|
+
/*! tsParticles Twinkle Updater v3.0.0-beta.1 by Matteo Bruni */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { IOptionLoader, RecursivePartial } from "@tsparticles/engine";
|
|
2
|
-
import type { ITwinkle } from "../Interfaces/ITwinkle";
|
|
3
|
-
import { TwinkleValues } from "./TwinkleValues";
|
|
2
|
+
import type { ITwinkle } from "../Interfaces/ITwinkle.js";
|
|
3
|
+
import { TwinkleValues } from "./TwinkleValues.js";
|
|
4
4
|
export declare class Twinkle implements ITwinkle, IOptionLoader<ITwinkle> {
|
|
5
5
|
lines: TwinkleValues;
|
|
6
6
|
particles: TwinkleValues;
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import {
|
|
3
|
-
import type { ITwinkleValues } from "../Interfaces/ITwinkleValues";
|
|
1
|
+
import { type IOptionLoader, OptionsColor, type RangeValue, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { ITwinkleValues } from "../Interfaces/ITwinkleValues.js";
|
|
4
3
|
export declare class TwinkleValues implements ITwinkleValues, IOptionLoader<ITwinkleValues> {
|
|
5
4
|
color?: OptionsColor;
|
|
6
5
|
enable: boolean;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
-
import type
|
|
2
|
-
import type {
|
|
3
|
-
import { Twinkle } from "./Options/Classes/Twinkle";
|
|
4
|
-
type TwinkeParticle = Particle & {
|
|
5
|
-
options: TwinkleParticlesOptions;
|
|
6
|
-
};
|
|
7
|
-
type ITwinkleParticlesOptions = IParticlesOptions & {
|
|
8
|
-
twinkle?: ITwinkle;
|
|
9
|
-
};
|
|
10
|
-
type TwinkleParticlesOptions = ParticlesOptions & {
|
|
11
|
-
twinkle?: Twinkle;
|
|
12
|
-
};
|
|
1
|
+
import { type IParticleColorStyle, type IParticleUpdater, type Particle, type RecursivePartial } from "@tsparticles/engine";
|
|
2
|
+
import type { ITwinkleParticlesOptions, TwinkeParticle, TwinkleParticlesOptions } from "./Types.js";
|
|
13
3
|
export declare class TwinkleUpdater implements IParticleUpdater {
|
|
14
4
|
getColorStyles(particle: Particle, context: CanvasRenderingContext2D, radius: number, opacity: number): IParticleColorStyle;
|
|
15
5
|
init(): void;
|
|
@@ -17,4 +7,3 @@ export declare class TwinkleUpdater implements IParticleUpdater {
|
|
|
17
7
|
loadOptions(options: TwinkleParticlesOptions, ...sources: (RecursivePartial<ITwinkleParticlesOptions> | undefined)[]): void;
|
|
18
8
|
update(): void;
|
|
19
9
|
}
|
|
20
|
-
export {};
|
package/types/Types.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { IParticlesOptions, Particle, ParticlesOptions } from "@tsparticles/engine";
|
|
2
|
+
import type { ITwinkle } from "./Options/Interfaces/ITwinkle.js";
|
|
3
|
+
import type { Twinkle } from "./Options/Classes/Twinkle.js";
|
|
4
|
+
export type TwinkeParticle = Particle & {
|
|
5
|
+
options: TwinkleParticlesOptions;
|
|
6
|
+
};
|
|
7
|
+
export type ITwinkleParticlesOptions = IParticlesOptions & {
|
|
8
|
+
twinkle?: ITwinkle;
|
|
9
|
+
};
|
|
10
|
+
export type TwinkleParticlesOptions = ParticlesOptions & {
|
|
11
|
+
twinkle?: Twinkle;
|
|
12
|
+
};
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadTwinkleUpdater(engine: Engine): Promise<void>;
|
|
2
|
+
export declare function loadTwinkleUpdater(engine: Engine, refresh?: boolean): Promise<void>;
|
|
@@ -4,17 +4,17 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./TwinkleValues"], factory);
|
|
7
|
+
define(["require", "exports", "./TwinkleValues.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.Twinkle = void 0;
|
|
13
|
-
const
|
|
13
|
+
const TwinkleValues_js_1 = require("./TwinkleValues.js");
|
|
14
14
|
class Twinkle {
|
|
15
15
|
constructor() {
|
|
16
|
-
this.lines = new
|
|
17
|
-
this.particles = new
|
|
16
|
+
this.lines = new TwinkleValues_js_1.TwinkleValues();
|
|
17
|
+
this.particles = new TwinkleValues_js_1.TwinkleValues();
|
|
18
18
|
}
|
|
19
19
|
load(data) {
|
|
20
20
|
if (!data) {
|
package/umd/TwinkleUpdater.js
CHANGED
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Twinkle"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "./Options/Classes/Twinkle.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.TwinkleUpdater = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const
|
|
14
|
+
const Twinkle_js_1 = require("./Options/Classes/Twinkle.js");
|
|
15
15
|
class TwinkleUpdater {
|
|
16
16
|
getColorStyles(particle, context, radius, opacity) {
|
|
17
17
|
const pOptions = particle.options, twinkleOptions = pOptions.twinkle;
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
}
|
|
35
35
|
loadOptions(options, ...sources) {
|
|
36
36
|
if (!options.twinkle) {
|
|
37
|
-
options.twinkle = new
|
|
37
|
+
options.twinkle = new Twinkle_js_1.Twinkle();
|
|
38
38
|
}
|
|
39
39
|
for (const source of sources) {
|
|
40
|
-
options.twinkle.load(source
|
|
40
|
+
options.twinkle.load(source?.twinkle);
|
|
41
41
|
}
|
|
42
42
|
}
|
|
43
43
|
update() {
|
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
|
+
});
|
package/umd/index.js
CHANGED
|
@@ -4,15 +4,15 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports", "./TwinkleUpdater"], factory);
|
|
7
|
+
define(["require", "exports", "./TwinkleUpdater.js"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.loadTwinkleUpdater = void 0;
|
|
13
|
-
const
|
|
14
|
-
async function loadTwinkleUpdater(engine) {
|
|
15
|
-
await engine.addParticleUpdater("twinkle", () => new
|
|
13
|
+
const TwinkleUpdater_js_1 = require("./TwinkleUpdater.js");
|
|
14
|
+
async function loadTwinkleUpdater(engine, refresh = true) {
|
|
15
|
+
await engine.addParticleUpdater("twinkle", () => new TwinkleUpdater_js_1.TwinkleUpdater(), refresh);
|
|
16
16
|
}
|
|
17
17
|
exports.loadTwinkleUpdater = loadTwinkleUpdater;
|
|
18
18
|
});
|