@tsparticles/shape-path 4.0.0-alpha.2 → 4.0.0-alpha.21
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/549.min.js +1 -0
- package/browser/PathDrawer.js +1 -4
- package/browser/index.js +7 -5
- package/cjs/PathDrawer.js +1 -4
- package/cjs/index.js +7 -5
- package/dist_browser_PathDrawer_js.js +2 -22
- package/esm/PathDrawer.js +1 -4
- package/esm/index.js +7 -5
- package/package.json +3 -2
- package/report.html +3 -3
- package/tsparticles.shape.path.js +25 -15
- package/tsparticles.shape.path.min.js +2 -2
- package/types/IShapePathData.d.ts +4 -0
- package/types/PathDrawer.d.ts +0 -1
- package/types/PathParticle.d.ts +2 -2
- package/types/index.d.ts +1 -1
- package/umd/PathDrawer.js +3 -6
- package/umd/index.js +7 -5
- package/237.min.js +0 -2
- package/237.min.js.LICENSE.txt +0 -1
- package/browser/SegmentType.js +0 -8
- package/browser/Utils.js +0 -82
- package/cjs/SegmentType.js +0 -8
- package/cjs/Utils.js +0 -82
- package/esm/SegmentType.js +0 -8
- package/esm/Utils.js +0 -82
- package/tsparticles.shape.path.min.js.LICENSE.txt +0 -1
- package/types/IPathData.d.ts +0 -10
- package/types/SegmentType.d.ts +0 -7
- package/types/Utils.d.ts +0 -2
- package/umd/SegmentType.js +0 -21
- package/umd/Utils.js +0 -95
- /package/browser/{IPathData.js → IShapePathData.js} +0 -0
- /package/cjs/{IPathData.js → IShapePathData.js} +0 -0
- /package/esm/{IPathData.js → IShapePathData.js} +0 -0
- /package/umd/{IPathData.js → IShapePathData.js} +0 -0
|
@@ -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-alpha.
|
|
7
|
+
* v4.0.0-alpha.21
|
|
8
8
|
*/
|
|
9
9
|
/*
|
|
10
10
|
* ATTENTION: The "eval" devtool has been used (maybe by default in mode: "development").
|
|
@@ -16,28 +16,18 @@
|
|
|
16
16
|
*/
|
|
17
17
|
(function webpackUniversalModuleDefinition(root, factory) {
|
|
18
18
|
if(typeof exports === 'object' && typeof module === 'object')
|
|
19
|
-
module.exports = factory(require("@tsparticles/engine"));
|
|
19
|
+
module.exports = factory(require("@tsparticles/engine"), require("@tsparticles/path-utils"));
|
|
20
20
|
else if(typeof define === 'function' && define.amd)
|
|
21
|
-
define(["@tsparticles/engine"], factory);
|
|
21
|
+
define(["@tsparticles/engine", "@tsparticles/path-utils"], factory);
|
|
22
22
|
else {
|
|
23
|
-
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine")) : factory(root["window"]);
|
|
23
|
+
var a = typeof exports === 'object' ? factory(require("@tsparticles/engine"), require("@tsparticles/path-utils")) : factory(root["window"], root["window"]);
|
|
24
24
|
for(var i in a) (typeof exports === 'object' ? exports : root)[i] = a[i];
|
|
25
25
|
}
|
|
26
|
-
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__) => {
|
|
26
|
+
})(this, (__WEBPACK_EXTERNAL_MODULE__tsparticles_engine__, __WEBPACK_EXTERNAL_MODULE__tsparticles_path_utils__) => {
|
|
27
27
|
return /******/ (() => { // webpackBootstrap
|
|
28
28
|
/******/ "use strict";
|
|
29
29
|
/******/ var __webpack_modules__ = ({
|
|
30
30
|
|
|
31
|
-
/***/ "./dist/browser/index.js"
|
|
32
|
-
/*!*******************************!*\
|
|
33
|
-
!*** ./dist/browser/index.js ***!
|
|
34
|
-
\*******************************/
|
|
35
|
-
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
36
|
-
|
|
37
|
-
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPathShape: () => (/* binding */ loadPathShape)\n/* harmony export */ });\nfunction loadPathShape(engine) {\n engine.checkVersion(\"4.0.0-alpha.2\");\n engine.register(async e => {\n const {\n PathDrawer\n } = await __webpack_require__.e(/*! import() */ \"dist_browser_PathDrawer_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PathDrawer.js */ \"./dist/browser/PathDrawer.js\"));\n e.addShape(new PathDrawer());\n });\n}\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/index.js?\n}");
|
|
38
|
-
|
|
39
|
-
/***/ },
|
|
40
|
-
|
|
41
31
|
/***/ "@tsparticles/engine"
|
|
42
32
|
/*!*********************************************************************************************************************************!*\
|
|
43
33
|
!*** external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"} ***!
|
|
@@ -46,6 +36,26 @@ eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpa
|
|
|
46
36
|
|
|
47
37
|
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_engine__;
|
|
48
38
|
|
|
39
|
+
/***/ },
|
|
40
|
+
|
|
41
|
+
/***/ "@tsparticles/path-utils"
|
|
42
|
+
/*!*********************************************************************************************************************************************!*\
|
|
43
|
+
!*** external {"commonjs":"@tsparticles/path-utils","commonjs2":"@tsparticles/path-utils","amd":"@tsparticles/path-utils","root":"window"} ***!
|
|
44
|
+
\*********************************************************************************************************************************************/
|
|
45
|
+
(module) {
|
|
46
|
+
|
|
47
|
+
module.exports = __WEBPACK_EXTERNAL_MODULE__tsparticles_path_utils__;
|
|
48
|
+
|
|
49
|
+
/***/ },
|
|
50
|
+
|
|
51
|
+
/***/ "./dist/browser/index.js"
|
|
52
|
+
/*!*******************************!*\
|
|
53
|
+
!*** ./dist/browser/index.js ***!
|
|
54
|
+
\*******************************/
|
|
55
|
+
(__unused_webpack___webpack_module__, __webpack_exports__, __webpack_require__) {
|
|
56
|
+
|
|
57
|
+
eval("{__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ loadPathShape: () => (/* binding */ loadPathShape)\n/* harmony export */ });\nasync function loadPathShape(engine) {\n engine.checkVersion(\"4.0.0-alpha.21\");\n await engine.register((e)=>{\n e.addShape([\n \"path\"\n ], async ()=>{\n const { PathDrawer } = await __webpack_require__.e(/*! import() */ \"dist_browser_PathDrawer_js\").then(__webpack_require__.bind(__webpack_require__, /*! ./PathDrawer.js */ \"./dist/browser/PathDrawer.js\"));\n return new PathDrawer();\n });\n });\n}\n\n\n//# sourceURL=webpack://@tsparticles/shape-path/./dist/browser/index.js?\n}");
|
|
58
|
+
|
|
49
59
|
/***/ }
|
|
50
60
|
|
|
51
61
|
/******/ });
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("@tsparticles/engine"),require("@tsparticles/path-utils"));else if("function"==typeof define&&define.amd)define(["@tsparticles/engine","@tsparticles/path-utils"],t);else{var r="object"==typeof exports?t(require("@tsparticles/engine"),require("@tsparticles/path-utils")):t(e.window,e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e,t)=>(()=>{"use strict";var r,o,i,a={303(t){t.exports=e},580(e){e.exports=t}},n={};function s(e){var t=n[e];if(void 0!==t)return t.exports;var r=n[e]={exports:{}};return a[e](r,r.exports,s),r.exports}s.m=a,s.d=(e,t)=>{for(var r in t)s.o(t,r)&&!s.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},s.f={},s.e=e=>Promise.all(Object.keys(s.f).reduce((t,r)=>(s.f[r](e,t),t),[])),s.u=e=>""+e+".min.js",s.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||Function("return this")()}catch(e){if("object"==typeof window)return window}}(),s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),p={},s.l=(e,t,r,o)=>{if(p[e])return void p[e].push(t);if(void 0!==r)for(var i,a,n=document.getElementsByTagName("script"),c=0;c<n.length;c++){var l=n[c];if(l.getAttribute("src")==e||l.getAttribute("data-webpack")=="@tsparticles/shape-path:"+r){i=l;break}}i||(a=!0,(i=document.createElement("script")).charset="utf-8",s.nc&&i.setAttribute("nonce",s.nc),i.setAttribute("data-webpack","@tsparticles/shape-path:"+r),i.src=e),p[e]=[t];var u=(t,r)=>{i.onerror=i.onload=null,clearTimeout(d);var o=p[e];if(delete p[e],i.parentNode&&i.parentNode.removeChild(i),o&&o.forEach(e=>e(r)),t)return t(r)},d=setTimeout(u.bind(null,void 0,{type:"timeout",target:i}),12e4);i.onerror=u.bind(null,i.onerror),i.onload=u.bind(null,i.onload),a&&document.head.appendChild(i)},s.r=e=>{"u">typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},s.g.importScripts&&(c=s.g.location+"");var p,c,l=s.g.document;if(!c&&l&&(l.currentScript&&"SCRIPT"===l.currentScript.tagName.toUpperCase()&&(c=l.currentScript.src),!c)){var u=l.getElementsByTagName("script");if(u.length)for(var d=u.length-1;d>-1&&(!c||!/^http(s?):/.test(c));)c=u[d--].src}if(!c)throw Error("Automatic publicPath is not supported in this browser");s.p=c=c.replace(/^blob:/,"").replace(/#.*$/,"").replace(/\?.*$/,"").replace(/\/[^\/]+$/,"/"),r={381:0},s.f.j=(e,t)=>{var o=s.o(r,e)?r[e]:void 0;if(0!==o)if(o)t.push(o[2]);else{var i=new Promise((t,i)=>o=r[e]=[t,i]);t.push(o[2]=i);var a=s.p+s.u(e),n=Error();s.l(a,t=>{if(s.o(r,e)&&(0!==(o=r[e])&&(r[e]=void 0),o)){var i=t&&("load"===t.type?"missing":t.type),a=t&&t.target&&t.target.src;n.message="Loading chunk "+e+` failed.
|
|
2
|
+
(`+i+": "+a+")",n.name="ChunkLoadError",n.type=i,n.request=a,o[1](n)}},"chunk-"+e,e)}},o=(e,t)=>{var o,i,[a,n,p]=t,c=0;if(a.some(e=>0!==r[e])){for(o in n)s.o(n,o)&&(s.m[o]=n[o]);p&&p(s)}for(e&&e(t);c<a.length;c++)i=a[c],s.o(r,i)&&r[i]&&r[i][0](),r[i]=0},(i=this.webpackChunk_tsparticles_shape_path=this.webpackChunk_tsparticles_shape_path||[]).forEach(o.bind(null,0)),i.push=o.bind(null,i.push.bind(i));var h={};async function f(e){e.checkVersion("4.0.0-alpha.21"),await e.register(e=>{e.addShape(["path"],async()=>{let{PathDrawer:e}=await s.e(549).then(s.bind(s,549));return new e})})}return s.r(h),s.d(h,{loadPathShape:()=>f}),h})());
|
package/types/PathDrawer.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type Container, type IShapeDrawData, type IShapeDrawer } from "@tsparticles/engine";
|
|
2
2
|
import type { PathParticle } from "./PathParticle.js";
|
|
3
3
|
export declare class PathDrawer implements IShapeDrawer<PathParticle> {
|
|
4
|
-
readonly validTypes: readonly ["path"];
|
|
5
4
|
draw(data: IShapeDrawData<PathParticle>): void;
|
|
6
5
|
particleInit(_container: Container, particle: PathParticle): void;
|
|
7
6
|
}
|
package/types/PathParticle.d.ts
CHANGED
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { type Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadPathShape(engine: Engine): void
|
|
2
|
+
export declare function loadPathShape(engine: Engine): Promise<void>;
|
package/umd/PathDrawer.js
CHANGED
|
@@ -4,24 +4,21 @@
|
|
|
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", "
|
|
7
|
+
define(["require", "exports", "@tsparticles/engine", "@tsparticles/path-utils"], factory);
|
|
8
8
|
}
|
|
9
9
|
})(function (require, exports) {
|
|
10
10
|
"use strict";
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.PathDrawer = void 0;
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
|
-
const
|
|
14
|
+
const path_utils_1 = require("@tsparticles/path-utils");
|
|
15
15
|
class PathDrawer {
|
|
16
|
-
constructor() {
|
|
17
|
-
this.validTypes = ["path"];
|
|
18
|
-
}
|
|
19
16
|
draw(data) {
|
|
20
17
|
const { context, particle, radius } = data;
|
|
21
18
|
if (!particle.pathData) {
|
|
22
19
|
return;
|
|
23
20
|
}
|
|
24
|
-
(0,
|
|
21
|
+
(0, path_utils_1.drawPath)(context, radius, particle.pathData);
|
|
25
22
|
}
|
|
26
23
|
particleInit(_container, particle) {
|
|
27
24
|
const shape = particle.shapeData;
|
package/umd/index.js
CHANGED
|
@@ -44,11 +44,13 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
44
44
|
var __syncRequire = typeof module === "object" && typeof module.exports === "object";
|
|
45
45
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
46
|
exports.loadPathShape = loadPathShape;
|
|
47
|
-
function loadPathShape(engine) {
|
|
48
|
-
engine.checkVersion("4.0.0-alpha.
|
|
49
|
-
engine.register(
|
|
50
|
-
|
|
51
|
-
|
|
47
|
+
async function loadPathShape(engine) {
|
|
48
|
+
engine.checkVersion("4.0.0-alpha.21");
|
|
49
|
+
await engine.register(e => {
|
|
50
|
+
e.addShape(["path"], async () => {
|
|
51
|
+
const { PathDrawer } = await (__syncRequire ? Promise.resolve().then(() => __importStar(require("./PathDrawer.js"))) : new Promise((resolve_1, reject_1) => { require(["./PathDrawer.js"], resolve_1, reject_1); }).then(__importStar));
|
|
52
|
+
return new PathDrawer();
|
|
53
|
+
});
|
|
52
54
|
});
|
|
53
55
|
}
|
|
54
56
|
});
|
package/237.min.js
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
/*! For license information please see 237.min.js.LICENSE.txt */
|
|
2
|
-
(this.webpackChunk_tsparticles_shape_path=this.webpackChunk_tsparticles_shape_path||[]).push([[237],{237(e,a,s){s.d(a,{PathDrawer:()=>i});var t,r=s(303);!function(e){e.line="line",e.bezier="bezier",e.quadratic="quadratic",e.arc="arc",e.ellipse="ellipse"}(t||(t={}));class i{constructor(){this.validTypes=["path"]}draw(e){const{context:a,particle:s,radius:r}=e;s.pathData&&function(e,a,s){const r=s.segments[0];if(!r)return;const i=r.values[0];if(!i)return;e.moveTo(i.x*a,i.y*a);for(const r of s.segments){const s=r.values[0],i=1,c=2,n=3;if(!s)continue;const l=r.values[i],u=r.values[c],o=r.values[n];switch(r.type){case t.line:e.lineTo(s.x*a,s.y*a);break;case t.bezier:if(!l||!u||!o)break;e.bezierCurveTo(l.x*a,l.y*a,u.x*a,u.y*a,o.x*a,o.y*a);break;case t.quadratic:if(!l||!u)break;e.quadraticCurveTo(l.x*a,l.y*a,u.x*a,u.y*a);break;case t.arc:if(!l||!u)break;e.arc(s.x*a,s.y*a,l.x*a,u.x,u.y);break;case t.ellipse:if(!l||!u||!o)break;e.ellipse(s.x*a,s.y*a,l.x*a,l.y*a,u.x,o.x,o.y)}}if(!s.half)return;for(let r=s.segments.length-1;r>=0;r--){const i=s.segments[r];if(!i)continue;const c=i.values[0],n=1,l=2,u=i.values[n],o=i.values[l];switch(i.type){case t.line:if(!c)break;e.lineTo(c.x*-a,c.y*a);break;case t.bezier:if(!c||!u||!o)break;e.bezierCurveTo(-o.x*a,o.y*a,-u.x*a,u.y*a,c.x*a,c.y*a);break;case t.quadratic:if(!u||!o)break;e.quadraticCurveTo(-u.x*a,u.y*a,-o.x*a,o.y*a);case t.arc:case t.ellipse:}}}(a,r,s.pathData)}particleInit(e,a){const s=a.shapeData;s&&(a.pathData=(0,r.deepExtend)({},s))}}}}]);
|
package/237.min.js.LICENSE.txt
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Path Shape v4.0.0-alpha.2 by Matteo Bruni */
|
package/browser/SegmentType.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var SegmentType;
|
|
2
|
-
(function (SegmentType) {
|
|
3
|
-
SegmentType["line"] = "line";
|
|
4
|
-
SegmentType["bezier"] = "bezier";
|
|
5
|
-
SegmentType["quadratic"] = "quadratic";
|
|
6
|
-
SegmentType["arc"] = "arc";
|
|
7
|
-
SegmentType["ellipse"] = "ellipse";
|
|
8
|
-
})(SegmentType || (SegmentType = {}));
|
package/browser/Utils.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { SegmentType } from "./SegmentType.js";
|
|
2
|
-
export function drawPath(ctx, radius, path) {
|
|
3
|
-
const firstIndex = 0, firstSegment = path.segments[firstIndex];
|
|
4
|
-
if (!firstSegment) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
const firstValue = firstSegment.values[firstIndex];
|
|
8
|
-
if (!firstValue) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
12
|
-
for (const segment of path.segments) {
|
|
13
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
14
|
-
if (!value) {
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
const segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3], segmentValue4 = segment.values[index4];
|
|
18
|
-
switch (segment.type) {
|
|
19
|
-
case SegmentType.line:
|
|
20
|
-
ctx.lineTo(value.x * radius, value.y * radius);
|
|
21
|
-
break;
|
|
22
|
-
case SegmentType.bezier:
|
|
23
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
ctx.bezierCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius, segmentValue4.x * radius, segmentValue4.y * radius);
|
|
27
|
-
break;
|
|
28
|
-
case SegmentType.quadratic:
|
|
29
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
ctx.quadraticCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius);
|
|
33
|
-
break;
|
|
34
|
-
case SegmentType.arc:
|
|
35
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
ctx.arc(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue3.x, segmentValue3.y);
|
|
39
|
-
break;
|
|
40
|
-
case SegmentType.ellipse:
|
|
41
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
ctx.ellipse(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x, segmentValue4.x, segmentValue4.y);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (!path.half) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const lengthOffset = 1, minLength = 0;
|
|
51
|
-
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
52
|
-
const segment = path.segments[i];
|
|
53
|
-
if (!segment) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3];
|
|
57
|
-
switch (segment.type) {
|
|
58
|
-
case SegmentType.line:
|
|
59
|
-
if (!value) {
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
63
|
-
break;
|
|
64
|
-
case SegmentType.bezier:
|
|
65
|
-
if (!value || !segmentValue2 || !segmentValue3) {
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
ctx.bezierCurveTo(-segmentValue3.x * radius, segmentValue3.y * radius, -segmentValue2.x * radius, segmentValue2.y * radius, value.x * radius, value.y * radius);
|
|
69
|
-
break;
|
|
70
|
-
case SegmentType.quadratic:
|
|
71
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
ctx.quadraticCurveTo(-segmentValue2.x * radius, segmentValue2.y * radius, -segmentValue3.x * radius, segmentValue3.y * radius);
|
|
75
|
-
break;
|
|
76
|
-
case SegmentType.arc:
|
|
77
|
-
case SegmentType.ellipse:
|
|
78
|
-
default:
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
package/cjs/SegmentType.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var SegmentType;
|
|
2
|
-
(function (SegmentType) {
|
|
3
|
-
SegmentType["line"] = "line";
|
|
4
|
-
SegmentType["bezier"] = "bezier";
|
|
5
|
-
SegmentType["quadratic"] = "quadratic";
|
|
6
|
-
SegmentType["arc"] = "arc";
|
|
7
|
-
SegmentType["ellipse"] = "ellipse";
|
|
8
|
-
})(SegmentType || (SegmentType = {}));
|
package/cjs/Utils.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { SegmentType } from "./SegmentType.js";
|
|
2
|
-
export function drawPath(ctx, radius, path) {
|
|
3
|
-
const firstIndex = 0, firstSegment = path.segments[firstIndex];
|
|
4
|
-
if (!firstSegment) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
const firstValue = firstSegment.values[firstIndex];
|
|
8
|
-
if (!firstValue) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
12
|
-
for (const segment of path.segments) {
|
|
13
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
14
|
-
if (!value) {
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
const segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3], segmentValue4 = segment.values[index4];
|
|
18
|
-
switch (segment.type) {
|
|
19
|
-
case SegmentType.line:
|
|
20
|
-
ctx.lineTo(value.x * radius, value.y * radius);
|
|
21
|
-
break;
|
|
22
|
-
case SegmentType.bezier:
|
|
23
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
ctx.bezierCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius, segmentValue4.x * radius, segmentValue4.y * radius);
|
|
27
|
-
break;
|
|
28
|
-
case SegmentType.quadratic:
|
|
29
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
ctx.quadraticCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius);
|
|
33
|
-
break;
|
|
34
|
-
case SegmentType.arc:
|
|
35
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
ctx.arc(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue3.x, segmentValue3.y);
|
|
39
|
-
break;
|
|
40
|
-
case SegmentType.ellipse:
|
|
41
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
ctx.ellipse(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x, segmentValue4.x, segmentValue4.y);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (!path.half) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const lengthOffset = 1, minLength = 0;
|
|
51
|
-
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
52
|
-
const segment = path.segments[i];
|
|
53
|
-
if (!segment) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3];
|
|
57
|
-
switch (segment.type) {
|
|
58
|
-
case SegmentType.line:
|
|
59
|
-
if (!value) {
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
63
|
-
break;
|
|
64
|
-
case SegmentType.bezier:
|
|
65
|
-
if (!value || !segmentValue2 || !segmentValue3) {
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
ctx.bezierCurveTo(-segmentValue3.x * radius, segmentValue3.y * radius, -segmentValue2.x * radius, segmentValue2.y * radius, value.x * radius, value.y * radius);
|
|
69
|
-
break;
|
|
70
|
-
case SegmentType.quadratic:
|
|
71
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
ctx.quadraticCurveTo(-segmentValue2.x * radius, segmentValue2.y * radius, -segmentValue3.x * radius, segmentValue3.y * radius);
|
|
75
|
-
break;
|
|
76
|
-
case SegmentType.arc:
|
|
77
|
-
case SegmentType.ellipse:
|
|
78
|
-
default:
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
package/esm/SegmentType.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
export var SegmentType;
|
|
2
|
-
(function (SegmentType) {
|
|
3
|
-
SegmentType["line"] = "line";
|
|
4
|
-
SegmentType["bezier"] = "bezier";
|
|
5
|
-
SegmentType["quadratic"] = "quadratic";
|
|
6
|
-
SegmentType["arc"] = "arc";
|
|
7
|
-
SegmentType["ellipse"] = "ellipse";
|
|
8
|
-
})(SegmentType || (SegmentType = {}));
|
package/esm/Utils.js
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { SegmentType } from "./SegmentType.js";
|
|
2
|
-
export function drawPath(ctx, radius, path) {
|
|
3
|
-
const firstIndex = 0, firstSegment = path.segments[firstIndex];
|
|
4
|
-
if (!firstSegment) {
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
const firstValue = firstSegment.values[firstIndex];
|
|
8
|
-
if (!firstValue) {
|
|
9
|
-
return;
|
|
10
|
-
}
|
|
11
|
-
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
12
|
-
for (const segment of path.segments) {
|
|
13
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
14
|
-
if (!value) {
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
const segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3], segmentValue4 = segment.values[index4];
|
|
18
|
-
switch (segment.type) {
|
|
19
|
-
case SegmentType.line:
|
|
20
|
-
ctx.lineTo(value.x * radius, value.y * radius);
|
|
21
|
-
break;
|
|
22
|
-
case SegmentType.bezier:
|
|
23
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
24
|
-
break;
|
|
25
|
-
}
|
|
26
|
-
ctx.bezierCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius, segmentValue4.x * radius, segmentValue4.y * radius);
|
|
27
|
-
break;
|
|
28
|
-
case SegmentType.quadratic:
|
|
29
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
30
|
-
break;
|
|
31
|
-
}
|
|
32
|
-
ctx.quadraticCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius);
|
|
33
|
-
break;
|
|
34
|
-
case SegmentType.arc:
|
|
35
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
ctx.arc(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue3.x, segmentValue3.y);
|
|
39
|
-
break;
|
|
40
|
-
case SegmentType.ellipse:
|
|
41
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
ctx.ellipse(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x, segmentValue4.x, segmentValue4.y);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
if (!path.half) {
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const lengthOffset = 1, minLength = 0;
|
|
51
|
-
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
52
|
-
const segment = path.segments[i];
|
|
53
|
-
if (!segment) {
|
|
54
|
-
continue;
|
|
55
|
-
}
|
|
56
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3];
|
|
57
|
-
switch (segment.type) {
|
|
58
|
-
case SegmentType.line:
|
|
59
|
-
if (!value) {
|
|
60
|
-
break;
|
|
61
|
-
}
|
|
62
|
-
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
63
|
-
break;
|
|
64
|
-
case SegmentType.bezier:
|
|
65
|
-
if (!value || !segmentValue2 || !segmentValue3) {
|
|
66
|
-
break;
|
|
67
|
-
}
|
|
68
|
-
ctx.bezierCurveTo(-segmentValue3.x * radius, segmentValue3.y * radius, -segmentValue2.x * radius, segmentValue2.y * radius, value.x * radius, value.y * radius);
|
|
69
|
-
break;
|
|
70
|
-
case SegmentType.quadratic:
|
|
71
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
ctx.quadraticCurveTo(-segmentValue2.x * radius, segmentValue2.y * radius, -segmentValue3.x * radius, segmentValue3.y * radius);
|
|
75
|
-
break;
|
|
76
|
-
case SegmentType.arc:
|
|
77
|
-
case SegmentType.ellipse:
|
|
78
|
-
default:
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/*! tsParticles Path Shape v4.0.0-alpha.2 by Matteo Bruni */
|
package/types/IPathData.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import type { ICoordinates, IShapeValues } from "@tsparticles/engine";
|
|
2
|
-
import type { SegmentType } from "./SegmentType.js";
|
|
3
|
-
export interface IPathData extends IShapeValues {
|
|
4
|
-
half: boolean;
|
|
5
|
-
segments: ISegmentData[];
|
|
6
|
-
}
|
|
7
|
-
export interface ISegmentData {
|
|
8
|
-
type: SegmentType;
|
|
9
|
-
values: ICoordinates[];
|
|
10
|
-
}
|
package/types/SegmentType.d.ts
DELETED
package/types/Utils.d.ts
DELETED
package/umd/SegmentType.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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.SegmentType = void 0;
|
|
13
|
-
var SegmentType;
|
|
14
|
-
(function (SegmentType) {
|
|
15
|
-
SegmentType["line"] = "line";
|
|
16
|
-
SegmentType["bezier"] = "bezier";
|
|
17
|
-
SegmentType["quadratic"] = "quadratic";
|
|
18
|
-
SegmentType["arc"] = "arc";
|
|
19
|
-
SegmentType["ellipse"] = "ellipse";
|
|
20
|
-
})(SegmentType || (exports.SegmentType = SegmentType = {}));
|
|
21
|
-
});
|
package/umd/Utils.js
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
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", "./SegmentType.js"], factory);
|
|
8
|
-
}
|
|
9
|
-
})(function (require, exports) {
|
|
10
|
-
"use strict";
|
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
exports.drawPath = drawPath;
|
|
13
|
-
const SegmentType_js_1 = require("./SegmentType.js");
|
|
14
|
-
function drawPath(ctx, radius, path) {
|
|
15
|
-
const firstIndex = 0, firstSegment = path.segments[firstIndex];
|
|
16
|
-
if (!firstSegment) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
const firstValue = firstSegment.values[firstIndex];
|
|
20
|
-
if (!firstValue) {
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
ctx.moveTo(firstValue.x * radius, firstValue.y * radius);
|
|
24
|
-
for (const segment of path.segments) {
|
|
25
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, index4 = 3;
|
|
26
|
-
if (!value) {
|
|
27
|
-
continue;
|
|
28
|
-
}
|
|
29
|
-
const segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3], segmentValue4 = segment.values[index4];
|
|
30
|
-
switch (segment.type) {
|
|
31
|
-
case SegmentType_js_1.SegmentType.line:
|
|
32
|
-
ctx.lineTo(value.x * radius, value.y * radius);
|
|
33
|
-
break;
|
|
34
|
-
case SegmentType_js_1.SegmentType.bezier:
|
|
35
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
36
|
-
break;
|
|
37
|
-
}
|
|
38
|
-
ctx.bezierCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius, segmentValue4.x * radius, segmentValue4.y * radius);
|
|
39
|
-
break;
|
|
40
|
-
case SegmentType_js_1.SegmentType.quadratic:
|
|
41
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
42
|
-
break;
|
|
43
|
-
}
|
|
44
|
-
ctx.quadraticCurveTo(segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x * radius, segmentValue3.y * radius);
|
|
45
|
-
break;
|
|
46
|
-
case SegmentType_js_1.SegmentType.arc:
|
|
47
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
48
|
-
break;
|
|
49
|
-
}
|
|
50
|
-
ctx.arc(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue3.x, segmentValue3.y);
|
|
51
|
-
break;
|
|
52
|
-
case SegmentType_js_1.SegmentType.ellipse:
|
|
53
|
-
if (!segmentValue2 || !segmentValue3 || !segmentValue4) {
|
|
54
|
-
break;
|
|
55
|
-
}
|
|
56
|
-
ctx.ellipse(value.x * radius, value.y * radius, segmentValue2.x * radius, segmentValue2.y * radius, segmentValue3.x, segmentValue4.x, segmentValue4.y);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
if (!path.half) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const lengthOffset = 1, minLength = 0;
|
|
63
|
-
for (let i = path.segments.length - lengthOffset; i >= minLength; i--) {
|
|
64
|
-
const segment = path.segments[i];
|
|
65
|
-
if (!segment) {
|
|
66
|
-
continue;
|
|
67
|
-
}
|
|
68
|
-
const value = segment.values[firstIndex], index2 = 1, index3 = 2, segmentValue2 = segment.values[index2], segmentValue3 = segment.values[index3];
|
|
69
|
-
switch (segment.type) {
|
|
70
|
-
case SegmentType_js_1.SegmentType.line:
|
|
71
|
-
if (!value) {
|
|
72
|
-
break;
|
|
73
|
-
}
|
|
74
|
-
ctx.lineTo(value.x * -radius, value.y * radius);
|
|
75
|
-
break;
|
|
76
|
-
case SegmentType_js_1.SegmentType.bezier:
|
|
77
|
-
if (!value || !segmentValue2 || !segmentValue3) {
|
|
78
|
-
break;
|
|
79
|
-
}
|
|
80
|
-
ctx.bezierCurveTo(-segmentValue3.x * radius, segmentValue3.y * radius, -segmentValue2.x * radius, segmentValue2.y * radius, value.x * radius, value.y * radius);
|
|
81
|
-
break;
|
|
82
|
-
case SegmentType_js_1.SegmentType.quadratic:
|
|
83
|
-
if (!segmentValue2 || !segmentValue3) {
|
|
84
|
-
break;
|
|
85
|
-
}
|
|
86
|
-
ctx.quadraticCurveTo(-segmentValue2.x * radius, segmentValue2.y * radius, -segmentValue3.x * radius, segmentValue3.y * radius);
|
|
87
|
-
break;
|
|
88
|
-
case SegmentType_js_1.SegmentType.arc:
|
|
89
|
-
case SegmentType_js_1.SegmentType.ellipse:
|
|
90
|
-
default:
|
|
91
|
-
break;
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|