@tsparticles/updater-twinkle 4.0.0-beta.0 → 4.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/{190.min.js → 802.min.js} +1 -1
- package/browser/TwinkleUpdater.js +7 -5
- package/browser/index.js +4 -4
- package/cjs/TwinkleUpdater.js +7 -5
- package/cjs/index.js +4 -4
- package/dist_browser_TwinkleUpdater_js.js +2 -2
- package/esm/TwinkleUpdater.js +7 -5
- package/esm/index.js +4 -4
- package/package.json +2 -2
- package/report.html +84 -29
- package/tsparticles.updater.twinkle.js +2 -2
- package/tsparticles.updater.twinkle.min.js +2 -2
- package/types/TwinkleUpdater.d.ts +5 -4
- package/umd/TwinkleUpdater.js +7 -5
- package/umd/index.js +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";(this.webpackChunk_tsparticles_updater_twinkle=this.webpackChunk_tsparticles_updater_twinkle||[]).push([[
|
|
1
|
+
"use strict";(this.webpackChunk_tsparticles_updater_twinkle=this.webpackChunk_tsparticles_updater_twinkle||[]).push([[802],{802(e,t,o){o.d(t,{TwinkleUpdater:()=>n});var l=o(303);class i{color;enable;frequency;opacity;constructor(){this.enable=!1,this.frequency=.05,this.opacity=1}load(e){(0,l.isNull)(e)||(void 0!==e.color&&(this.color=l.OptionsColor.create(this.color,e.color)),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.frequency&&(this.frequency=e.frequency),void 0!==e.opacity&&(this.opacity=(0,l.setRangeValue)(e.opacity)))}}class r{enable;fillColor;frequency;opacity;strokeColor;constructor(){this.enable=!1,this.frequency=.05,this.opacity=1}load(e){(0,l.isNull)(e)||(void 0!==e.fillColor&&(this.fillColor=l.OptionsColor.create(this.fillColor,e.fillColor)),void 0!==e.strokeColor&&(this.strokeColor=l.OptionsColor.create(this.strokeColor,e.strokeColor)),void 0!==e.enable&&(this.enable=e.enable),void 0!==e.frequency&&(this.frequency=e.frequency),void 0!==e.opacity&&(this.opacity=(0,l.setRangeValue)(e.opacity)))}}class s{links;particles;constructor(){this.links=new i,this.particles=new r}load(e){(0,l.isNull)(e)||(this.links.load(e.links),this.particles.load(e.particles))}}class n{_container;_pluginManager;constructor(e,t){this._pluginManager=e,this._container=t}getColorStyles(e,t,o,i){let r=e.options,{_container:s}=this,n=r.twinkle;if(!n)return{};let a=n.particles,c=a.enable&&(0,l.getRandom)()<a.frequency,p=e.options.zIndex,u=(1-e.zIndexFactor)**p.opacityRate,h=c?(0,l.getRangeValue)(a.opacity)*u:i,d=(0,l.rangeColorToHsl)(this._pluginManager,a.fillColor),y=(0,l.rangeColorToHsl)(this._pluginManager,a.strokeColor),f=(()=>{if(d)return(0,l.getStyleFromHsl)(d,s.hdr,h)})(),k=(()=>{if(y)return(0,l.getStyleFromHsl)(y,s.hdr,h)})(),C={},g=c&&(!!f||!!k);return C.fill=g?f:void 0,C.stroke=g?k:void 0,C}init(){}isEnabled(e){let t=e.options.twinkle;return!!t&&t.particles.enable}loadOptions(e,...t){for(let o of(e.twinkle??=new s,t))e.twinkle.load(o?.twinkle)}update(){}}}}]);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { getRandom, getRangeValue, getStyleFromHsl, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Twinkle } from "./Options/Classes/Twinkle.js";
|
|
3
3
|
export class TwinkleUpdater {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
_container;
|
|
5
|
+
_pluginManager;
|
|
6
|
+
constructor(pluginManager, container) {
|
|
7
|
+
this._pluginManager = pluginManager;
|
|
8
|
+
this._container = container;
|
|
7
9
|
}
|
|
8
10
|
getColorStyles(particle, _context, _radius, opacity) {
|
|
9
|
-
const pOptions = particle.options, { container } =
|
|
11
|
+
const pOptions = particle.options, { _container: container } = this, twinkleOptions = pOptions["twinkle"];
|
|
10
12
|
if (!twinkleOptions) {
|
|
11
13
|
return {};
|
|
12
14
|
}
|
|
13
|
-
const twinkle = twinkleOptions.particles, twinkling = twinkle.enable && getRandom() < twinkle.frequency, zIndexOptions = particle.options.zIndex, zOffset = 1, zOpacityFactor = (zOffset - particle.zIndexFactor) ** zIndexOptions.opacityRate, twinklingOpacity = twinkling ? getRangeValue(twinkle.opacity) * zOpacityFactor : opacity, twinkleFillRgb = rangeColorToHsl(this.
|
|
15
|
+
const twinkle = twinkleOptions.particles, twinkling = twinkle.enable && getRandom() < twinkle.frequency, zIndexOptions = particle.options.zIndex, zOffset = 1, zOpacityFactor = (zOffset - particle.zIndexFactor) ** zIndexOptions.opacityRate, twinklingOpacity = twinkling ? getRangeValue(twinkle.opacity) * zOpacityFactor : opacity, twinkleFillRgb = rangeColorToHsl(this._pluginManager, twinkle.fillColor), twinkleStrokeRgb = rangeColorToHsl(this._pluginManager, twinkle.strokeColor), getTwinkleFillStyle = () => {
|
|
14
16
|
if (!twinkleFillRgb) {
|
|
15
17
|
return undefined;
|
|
16
18
|
}
|
package/browser/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadTwinkleUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("twinkle", async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.1");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("twinkle", async (container) => {
|
|
5
5
|
const { TwinkleUpdater } = await import("./TwinkleUpdater.js");
|
|
6
|
-
return new TwinkleUpdater(e);
|
|
6
|
+
return new TwinkleUpdater(e.pluginManager, container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
package/cjs/TwinkleUpdater.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { getRandom, getRangeValue, getStyleFromHsl, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Twinkle } from "./Options/Classes/Twinkle.js";
|
|
3
3
|
export class TwinkleUpdater {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
_container;
|
|
5
|
+
_pluginManager;
|
|
6
|
+
constructor(pluginManager, container) {
|
|
7
|
+
this._pluginManager = pluginManager;
|
|
8
|
+
this._container = container;
|
|
7
9
|
}
|
|
8
10
|
getColorStyles(particle, _context, _radius, opacity) {
|
|
9
|
-
const pOptions = particle.options, { container } =
|
|
11
|
+
const pOptions = particle.options, { _container: container } = this, twinkleOptions = pOptions["twinkle"];
|
|
10
12
|
if (!twinkleOptions) {
|
|
11
13
|
return {};
|
|
12
14
|
}
|
|
13
|
-
const twinkle = twinkleOptions.particles, twinkling = twinkle.enable && getRandom() < twinkle.frequency, zIndexOptions = particle.options.zIndex, zOffset = 1, zOpacityFactor = (zOffset - particle.zIndexFactor) ** zIndexOptions.opacityRate, twinklingOpacity = twinkling ? getRangeValue(twinkle.opacity) * zOpacityFactor : opacity, twinkleFillRgb = rangeColorToHsl(this.
|
|
15
|
+
const twinkle = twinkleOptions.particles, twinkling = twinkle.enable && getRandom() < twinkle.frequency, zIndexOptions = particle.options.zIndex, zOffset = 1, zOpacityFactor = (zOffset - particle.zIndexFactor) ** zIndexOptions.opacityRate, twinklingOpacity = twinkling ? getRangeValue(twinkle.opacity) * zOpacityFactor : opacity, twinkleFillRgb = rangeColorToHsl(this._pluginManager, twinkle.fillColor), twinkleStrokeRgb = rangeColorToHsl(this._pluginManager, twinkle.strokeColor), getTwinkleFillStyle = () => {
|
|
14
16
|
if (!twinkleFillRgb) {
|
|
15
17
|
return undefined;
|
|
16
18
|
}
|
package/cjs/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadTwinkleUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("twinkle", async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.1");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("twinkle", async (container) => {
|
|
5
5
|
const { TwinkleUpdater } = await import("./TwinkleUpdater.js");
|
|
6
|
-
return new TwinkleUpdater(e);
|
|
6
|
+
return new TwinkleUpdater(e.pluginManager, container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
|
@@ -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
|
-
* v4.0.0-beta.
|
|
7
|
+
* v4.0.0-beta.1
|
|
8
8
|
*/
|
|
9
9
|
"use strict";
|
|
10
10
|
/*
|
|
@@ -53,7 +53,7 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
53
53
|
\****************************************/
|
|
54
54
|
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
55
55
|
|
|
56
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TwinkleUpdater: () => (/* binding */ TwinkleUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Twinkle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Twinkle.js */ \"./dist/browser/Options/Classes/Twinkle.js\");\n\n\nclass TwinkleUpdater {\n
|
|
56
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ TwinkleUpdater: () => (/* binding */ TwinkleUpdater)\n/* harmony export */ });\n/* harmony import */ var _tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @tsparticles/engine */ \"@tsparticles/engine\");\n/* harmony import */ var _Options_Classes_Twinkle_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Options/Classes/Twinkle.js */ \"./dist/browser/Options/Classes/Twinkle.js\");\n\n\nclass TwinkleUpdater {\n _container;\n _pluginManager;\n constructor(pluginManager, container){\n this._pluginManager = pluginManager;\n this._container = container;\n }\n getColorStyles(particle, _context, _radius, opacity) {\n const pOptions = particle.options, { _container: container } = this, twinkleOptions = pOptions[\"twinkle\"];\n if (!twinkleOptions) {\n return {};\n }\n const twinkle = twinkleOptions.particles, twinkling = twinkle.enable && (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRandom)() < twinkle.frequency, zIndexOptions = particle.options.zIndex, zOffset = 1, zOpacityFactor = (zOffset - particle.zIndexFactor) ** zIndexOptions.opacityRate, twinklingOpacity = twinkling ? (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getRangeValue)(twinkle.opacity) * zOpacityFactor : opacity, twinkleFillRgb = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(this._pluginManager, twinkle.fillColor), twinkleStrokeRgb = (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.rangeColorToHsl)(this._pluginManager, twinkle.strokeColor), getTwinkleFillStyle = ()=>{\n if (!twinkleFillRgb) {\n return undefined;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(twinkleFillRgb, container.hdr, twinklingOpacity);\n }, getTwinkleStrokeStyle = ()=>{\n if (!twinkleStrokeRgb) {\n return undefined;\n }\n return (0,_tsparticles_engine__WEBPACK_IMPORTED_MODULE_0__.getStyleFromHsl)(twinkleStrokeRgb, container.hdr, twinklingOpacity);\n }, twinkleFillStyle = getTwinkleFillStyle(), twinkleStrokeStyle = getTwinkleStrokeStyle(), res = {}, needsTwinkle = twinkling && (!!twinkleFillStyle || !!twinkleStrokeStyle);\n res.fill = needsTwinkle ? twinkleFillStyle : undefined;\n res.stroke = needsTwinkle ? twinkleStrokeStyle : undefined;\n return res;\n }\n init() {}\n isEnabled(particle) {\n const pOptions = particle.options, twinkleOptions = pOptions.twinkle;\n if (!twinkleOptions) {\n return false;\n }\n return twinkleOptions.particles.enable;\n }\n loadOptions(options, ...sources) {\n options.twinkle ??= new _Options_Classes_Twinkle_js__WEBPACK_IMPORTED_MODULE_1__.Twinkle();\n for (const source of sources){\n options.twinkle.load(source?.twinkle);\n }\n }\n update() {}\n}\n\n\n//# sourceURL=webpack://@tsparticles/updater-twinkle/./dist/browser/TwinkleUpdater.js?\n}");
|
|
57
57
|
|
|
58
58
|
/***/ }
|
|
59
59
|
|
package/esm/TwinkleUpdater.js
CHANGED
|
@@ -1,16 +1,18 @@
|
|
|
1
1
|
import { getRandom, getRangeValue, getStyleFromHsl, rangeColorToHsl, } from "@tsparticles/engine";
|
|
2
2
|
import { Twinkle } from "./Options/Classes/Twinkle.js";
|
|
3
3
|
export class TwinkleUpdater {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
_container;
|
|
5
|
+
_pluginManager;
|
|
6
|
+
constructor(pluginManager, container) {
|
|
7
|
+
this._pluginManager = pluginManager;
|
|
8
|
+
this._container = container;
|
|
7
9
|
}
|
|
8
10
|
getColorStyles(particle, _context, _radius, opacity) {
|
|
9
|
-
const pOptions = particle.options, { container } =
|
|
11
|
+
const pOptions = particle.options, { _container: container } = this, twinkleOptions = pOptions["twinkle"];
|
|
10
12
|
if (!twinkleOptions) {
|
|
11
13
|
return {};
|
|
12
14
|
}
|
|
13
|
-
const twinkle = twinkleOptions.particles, twinkling = twinkle.enable && getRandom() < twinkle.frequency, zIndexOptions = particle.options.zIndex, zOffset = 1, zOpacityFactor = (zOffset - particle.zIndexFactor) ** zIndexOptions.opacityRate, twinklingOpacity = twinkling ? getRangeValue(twinkle.opacity) * zOpacityFactor : opacity, twinkleFillRgb = rangeColorToHsl(this.
|
|
15
|
+
const twinkle = twinkleOptions.particles, twinkling = twinkle.enable && getRandom() < twinkle.frequency, zIndexOptions = particle.options.zIndex, zOffset = 1, zOpacityFactor = (zOffset - particle.zIndexFactor) ** zIndexOptions.opacityRate, twinklingOpacity = twinkling ? getRangeValue(twinkle.opacity) * zOpacityFactor : opacity, twinkleFillRgb = rangeColorToHsl(this._pluginManager, twinkle.fillColor), twinkleStrokeRgb = rangeColorToHsl(this._pluginManager, twinkle.strokeColor), getTwinkleFillStyle = () => {
|
|
14
16
|
if (!twinkleFillRgb) {
|
|
15
17
|
return undefined;
|
|
16
18
|
}
|
package/esm/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export async function loadTwinkleUpdater(engine) {
|
|
2
|
-
engine.checkVersion("4.0.0-beta.
|
|
3
|
-
await engine.register(e => {
|
|
4
|
-
e.addParticleUpdater("twinkle", async () => {
|
|
2
|
+
engine.checkVersion("4.0.0-beta.1");
|
|
3
|
+
await engine.pluginManager.register(e => {
|
|
4
|
+
e.pluginManager.addParticleUpdater("twinkle", async (container) => {
|
|
5
5
|
const { TwinkleUpdater } = await import("./TwinkleUpdater.js");
|
|
6
|
-
return new TwinkleUpdater(e);
|
|
6
|
+
return new TwinkleUpdater(e.pluginManager, container);
|
|
7
7
|
});
|
|
8
8
|
});
|
|
9
9
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsparticles/updater-twinkle",
|
|
3
|
-
"version": "4.0.0-beta.
|
|
3
|
+
"version": "4.0.0-beta.1",
|
|
4
4
|
"description": "tsParticles particles twinkle updater",
|
|
5
5
|
"homepage": "https://particles.js.org",
|
|
6
6
|
"repository": {
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"./package.json": "./package.json"
|
|
88
88
|
},
|
|
89
89
|
"dependencies": {
|
|
90
|
-
"@tsparticles/engine": "4.0.0-beta.
|
|
90
|
+
"@tsparticles/engine": "4.0.0-beta.1"
|
|
91
91
|
},
|
|
92
92
|
"publishConfig": {
|
|
93
93
|
"access": "public"
|