@tsparticles/shape-spiral 3.0.0-alpha.0 → 3.0.0-beta.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/README.md +16 -12
- package/browser/SpiralDrawer.js +17 -8
- package/browser/index.js +2 -2
- package/cjs/SpiralDrawer.js +17 -8
- package/cjs/index.js +2 -2
- package/esm/SpiralDrawer.js +17 -8
- package/esm/index.js +2 -2
- package/package.json +10 -5
- package/report.html +4 -4
- package/tsparticles.shape.spiral.js +66 -23
- package/tsparticles.shape.spiral.min.js +1 -1
- package/tsparticles.shape.spiral.min.js.LICENSE.txt +1 -8
- package/types/ISpiralData.d.ts +4 -3
- package/types/SpiralDrawer.d.ts +4 -3
- package/types/SpiralParticle.d.ts +6 -0
- package/types/index.d.ts +1 -1
- package/umd/SpiralDrawer.js +18 -9
- package/umd/index.js +2 -2
- package/types/ISpiralParticle.d.ts +0 -5
- /package/browser/{ISpiralParticle.js → SpiralParticle.js} +0 -0
- /package/cjs/{ISpiralParticle.js → SpiralParticle.js} +0 -0
- /package/esm/{ISpiralParticle.js → SpiralParticle.js} +0 -0
- /package/umd/{ISpiralParticle.js → SpiralParticle.js} +0 -0
|
@@ -4,22 +4,54 @@
|
|
|
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.0
|
|
8
8
|
*/
|
|
9
9
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
10
10
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
11
|
-
module.exports = factory();
|
|
11
|
+
module.exports = factory(require("@tsparticles/engine"));
|
|
12
12
|
else if(typeof define === 'function' && define.amd)
|
|
13
|
-
define([], factory);
|
|
13
|
+
define(["@tsparticles/engine"], factory);
|
|
14
14
|
else {
|
|
15
|
-
var a = factory();
|
|
15
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
16
16
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
17
17
|
}
|
|
18
|
-
})(this, () => {
|
|
18
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__533__) => {
|
|
19
19
|
return /******/ (() => { // webpackBootstrap
|
|
20
20
|
/******/ "use strict";
|
|
21
|
-
/******/
|
|
22
|
-
|
|
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
|
+
/******/ }
|
|
23
55
|
/******/
|
|
24
56
|
/************************************************************************/
|
|
25
57
|
/******/ /* webpack/runtime/define property getters */
|
|
@@ -52,41 +84,52 @@ return /******/ (() => { // webpackBootstrap
|
|
|
52
84
|
/******/
|
|
53
85
|
/************************************************************************/
|
|
54
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
|
+
(() => {
|
|
55
89
|
// ESM COMPAT FLAG
|
|
56
90
|
__webpack_require__.r(__webpack_exports__);
|
|
57
91
|
|
|
58
92
|
// EXPORTS
|
|
59
93
|
__webpack_require__.d(__webpack_exports__, {
|
|
60
|
-
|
|
94
|
+
loadSpiralShape: () => (/* binding */ loadSpiralShape)
|
|
61
95
|
});
|
|
62
96
|
|
|
97
|
+
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
98
|
+
var engine_root_window_ = __webpack_require__(533);
|
|
63
99
|
;// CONCATENATED MODULE: ./dist/browser/SpiralDrawer.js
|
|
100
|
+
|
|
64
101
|
class SpiralDrawer {
|
|
65
102
|
draw(context, particle, radius) {
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
103
|
+
if (particle.spiralInnerRadius === undefined || particle.spiralLineSpacing === undefined || particle.spiralWidthFactor === undefined) {
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
const realWidth = (radius - particle.spiralInnerRadius) / particle.spiralLineSpacing,
|
|
107
|
+
widthFactor = 10;
|
|
108
|
+
for (let i = 0; i < realWidth * widthFactor; i++) {
|
|
109
|
+
const angle = i / widthFactor,
|
|
110
|
+
factor = particle.spiralInnerRadius + particle.spiralLineSpacing * angle,
|
|
111
|
+
pos = {
|
|
112
|
+
x: factor * Math.cos(angle),
|
|
113
|
+
y: factor * Math.sin(angle)
|
|
114
|
+
};
|
|
115
|
+
context.lineTo(pos.x, pos.y);
|
|
74
116
|
}
|
|
75
117
|
}
|
|
76
118
|
particleInit(container, particle) {
|
|
77
|
-
var _a, _b;
|
|
78
119
|
const pixelRatio = container.retina.pixelRatio,
|
|
79
|
-
shapeData = particle.shapeData
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
120
|
+
shapeData = particle.shapeData;
|
|
121
|
+
particle.spiralInnerRadius = (0,engine_root_window_.getRangeValue)(shapeData.innerRadius ?? 1) * pixelRatio;
|
|
122
|
+
particle.spiralLineSpacing = (0,engine_root_window_.getRangeValue)(shapeData.lineSpacing ?? 1) * pixelRatio;
|
|
123
|
+
particle.spiralWidthFactor = (0,engine_root_window_.getRangeValue)(shapeData.widthFactor ?? 10);
|
|
83
124
|
}
|
|
84
125
|
}
|
|
85
126
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
86
127
|
|
|
87
|
-
function loadSpiralShape(engine) {
|
|
88
|
-
engine.addShape("spiral", new SpiralDrawer());
|
|
128
|
+
async function loadSpiralShape(engine, refresh = true) {
|
|
129
|
+
await engine.addShape("spiral", new SpiralDrawer(), refresh);
|
|
89
130
|
}
|
|
131
|
+
})();
|
|
132
|
+
|
|
90
133
|
/******/ return __webpack_exports__;
|
|
91
134
|
/******/ })()
|
|
92
135
|
;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.shape.spiral.min.js.LICENSE.txt */
|
|
2
|
-
!function(e,
|
|
2
|
+
!function(e,r){if("object"==typeof exports&&"object"==typeof module)module.exports=r(require("@tsparticles/engine"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine"],r);else{var i="object"==typeof exports?r(require("@tsparticles/engine")):r(e.window);for(var t in i)("object"==typeof exports?exports:e)[t]=i[t]}}(this,(e=>(()=>{"use strict";var r={533:r=>{r.exports=e}},i={};function t(e){var a=i[e];if(void 0!==a)return a.exports;var n=i[e]={exports:{}};return r[e](n,n.exports,t),n.exports}t.d=(e,r)=>{for(var i in r)t.o(r,i)&&!t.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:r[i]})},t.o=(e,r)=>Object.prototype.hasOwnProperty.call(e,r),t.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{t.r(a),t.d(a,{loadSpiralShape:()=>i});var e=t(533);class r{draw(e,r,i){if(void 0===r.spiralInnerRadius||void 0===r.spiralLineSpacing||void 0===r.spiralWidthFactor)return;const t=(i-r.spiralInnerRadius)/r.spiralLineSpacing;for(let i=0;i<10*t;i++){const t=i/10,a=r.spiralInnerRadius+r.spiralLineSpacing*t,n={x:a*Math.cos(t),y:a*Math.sin(t)};e.lineTo(n.x,n.y)}}particleInit(r,i){const t=r.retina.pixelRatio,a=i.shapeData;i.spiralInnerRadius=(0,e.getRangeValue)(a.innerRadius??1)*t,i.spiralLineSpacing=(0,e.getRangeValue)(a.lineSpacing??1)*t,i.spiralWidthFactor=(0,e.getRangeValue)(a.widthFactor??10)}}async function i(e,i=!0){await e.addShape("spiral",new r,i)}})(),a})()));
|
|
@@ -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.0
|
|
8
|
-
*/
|
|
1
|
+
/*! tsParticles Spiral Shape v3.0.0-beta.0 by Matteo Bruni */
|
package/types/ISpiralData.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { IShapeValues } from "@tsparticles/engine";
|
|
1
|
+
import type { IShapeValues, RangeValue } from "@tsparticles/engine";
|
|
2
2
|
export interface ISpiralData extends IShapeValues {
|
|
3
|
-
innerRadius:
|
|
4
|
-
lineSpacing:
|
|
3
|
+
innerRadius: RangeValue;
|
|
4
|
+
lineSpacing: RangeValue;
|
|
5
|
+
widthFactor: RangeValue;
|
|
5
6
|
}
|
package/types/SpiralDrawer.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Container, type IShapeDrawer } from "@tsparticles/engine";
|
|
2
|
+
import type { SpiralParticle } from "./SpiralParticle";
|
|
2
3
|
export declare class SpiralDrawer implements IShapeDrawer {
|
|
3
|
-
draw(context: CanvasRenderingContext2D, particle:
|
|
4
|
-
particleInit(container: Container, particle:
|
|
4
|
+
draw(context: CanvasRenderingContext2D, particle: SpiralParticle, radius: number): void;
|
|
5
|
+
particleInit(container: Container, particle: SpiralParticle): void;
|
|
5
6
|
}
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadSpiralShape(engine: Engine): void
|
|
2
|
+
export declare function loadSpiralShape(engine: Engine, refresh?: boolean): Promise<void>;
|
package/umd/SpiralDrawer.js
CHANGED
|
@@ -4,25 +4,34 @@
|
|
|
4
4
|
if (v !== undefined) module.exports = v;
|
|
5
5
|
}
|
|
6
6
|
else if (typeof define === "function" && define.amd) {
|
|
7
|
-
define(["require", "exports"], factory);
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.SpiralDrawer = void 0;
|
|
13
|
+
const engine_1 = require("@tsparticles/engine");
|
|
13
14
|
class SpiralDrawer {
|
|
14
15
|
draw(context, particle, radius) {
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
16
|
+
if (particle.spiralInnerRadius === undefined ||
|
|
17
|
+
particle.spiralLineSpacing === undefined ||
|
|
18
|
+
particle.spiralWidthFactor === undefined) {
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const realWidth = (radius - particle.spiralInnerRadius) / particle.spiralLineSpacing, widthFactor = 10;
|
|
22
|
+
for (let i = 0; i < realWidth * widthFactor; i++) {
|
|
23
|
+
const angle = i / widthFactor, factor = particle.spiralInnerRadius + particle.spiralLineSpacing * angle, pos = {
|
|
24
|
+
x: factor * Math.cos(angle),
|
|
25
|
+
y: factor * Math.sin(angle),
|
|
26
|
+
};
|
|
27
|
+
context.lineTo(pos.x, pos.y);
|
|
19
28
|
}
|
|
20
29
|
}
|
|
21
30
|
particleInit(container, particle) {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
31
|
+
const pixelRatio = container.retina.pixelRatio, shapeData = particle.shapeData;
|
|
32
|
+
particle.spiralInnerRadius = (0, engine_1.getRangeValue)(shapeData.innerRadius ?? 1) * pixelRatio;
|
|
33
|
+
particle.spiralLineSpacing = (0, engine_1.getRangeValue)(shapeData.lineSpacing ?? 1) * pixelRatio;
|
|
34
|
+
particle.spiralWidthFactor = (0, engine_1.getRangeValue)(shapeData.widthFactor ?? 10);
|
|
26
35
|
}
|
|
27
36
|
}
|
|
28
37
|
exports.SpiralDrawer = SpiralDrawer;
|
package/umd/index.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.loadSpiralShape = void 0;
|
|
13
13
|
const SpiralDrawer_1 = require("./SpiralDrawer");
|
|
14
|
-
function loadSpiralShape(engine) {
|
|
15
|
-
engine.addShape("spiral", new SpiralDrawer_1.SpiralDrawer());
|
|
14
|
+
async function loadSpiralShape(engine, refresh = true) {
|
|
15
|
+
await engine.addShape("spiral", new SpiralDrawer_1.SpiralDrawer(), refresh);
|
|
16
16
|
}
|
|
17
17
|
exports.loadSpiralShape = loadSpiralShape;
|
|
18
18
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|