@tsparticles/shape-star 3.0.0-alpha.1 → 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/StarDrawer.js +4 -7
- package/browser/index.js +2 -2
- package/cjs/StarDrawer.js +4 -7
- package/cjs/index.js +2 -13
- package/esm/StarDrawer.js +4 -7
- package/esm/index.js +2 -2
- package/package.json +6 -5
- package/report.html +4 -4
- package/tsparticles.shape.star.js +8 -12
- package/tsparticles.shape.star.min.js +1 -1
- package/tsparticles.shape.star.min.js.LICENSE.txt +1 -8
- package/types/StarDrawer.d.ts +1 -1
- package/types/index.d.ts +1 -1
- package/umd/StarDrawer.js +4 -7
- package/umd/index.js +2 -2
|
@@ -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.0
|
|
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
|
+
loadStarShape: () => (/* binding */ loadStarShape)
|
|
95
95
|
});
|
|
96
96
|
|
|
97
97
|
// EXTERNAL MODULE: external {"commonjs":"@tsparticles/engine","commonjs2":"@tsparticles/engine","amd":"@tsparticles/engine","root":"window"}
|
|
@@ -100,9 +100,8 @@ var engine_root_window_ = __webpack_require__(533);
|
|
|
100
100
|
|
|
101
101
|
class StarDrawer {
|
|
102
102
|
draw(context, particle, radius) {
|
|
103
|
-
var _a;
|
|
104
103
|
const sides = particle.sides,
|
|
105
|
-
inset =
|
|
104
|
+
inset = particle.starInset ?? 2;
|
|
106
105
|
context.moveTo(0, 0 - radius);
|
|
107
106
|
for (let i = 0; i < sides; i++) {
|
|
108
107
|
context.rotate(Math.PI / sides);
|
|
@@ -112,21 +111,18 @@ class StarDrawer {
|
|
|
112
111
|
}
|
|
113
112
|
}
|
|
114
113
|
getSidesCount(particle) {
|
|
115
|
-
var _a, _b;
|
|
116
114
|
const star = particle.shapeData;
|
|
117
|
-
return Math.round((0,engine_root_window_.getRangeValue)(
|
|
115
|
+
return Math.round((0,engine_root_window_.getRangeValue)(star?.sides ?? 5));
|
|
118
116
|
}
|
|
119
117
|
particleInit(container, particle) {
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
inset = (0,engine_root_window_.getRangeValue)((_a = star === null || star === void 0 ? void 0 : star.inset) !== null && _a !== void 0 ? _a : 2);
|
|
123
|
-
particle.starInset = inset;
|
|
118
|
+
const star = particle.shapeData;
|
|
119
|
+
particle.starInset = (0,engine_root_window_.getRangeValue)(star?.inset ?? 2);
|
|
124
120
|
}
|
|
125
121
|
}
|
|
126
122
|
;// CONCATENATED MODULE: ./dist/browser/index.js
|
|
127
123
|
|
|
128
|
-
async function loadStarShape(engine) {
|
|
129
|
-
await engine.addShape("star", new StarDrawer());
|
|
124
|
+
async function loadStarShape(engine, refresh = true) {
|
|
125
|
+
await engine.addShape("star", new StarDrawer(), refresh);
|
|
130
126
|
}
|
|
131
127
|
})();
|
|
132
128
|
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see tsparticles.shape.star.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
|
|
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 r="object"==typeof exports?t(require("@tsparticles/engine")):t(e.window);for(var o in r)("object"==typeof exports?exports:e)[o]=r[o]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},r={};function o(e){var a=r[e];if(void 0!==a)return a.exports;var n=r[e]={exports:{}};return t[e](n,n.exports,o),n.exports}o.d=(e,t)=>{for(var r in t)o.o(t,r)&&!o.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},o.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),o.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var a={};return(()=>{o.r(a),o.d(a,{loadStarShape:()=>r});var e=o(533);class t{draw(e,t,r){const o=t.sides,a=t.starInset??2;e.moveTo(0,0-r);for(let t=0;t<o;t++)e.rotate(Math.PI/o),e.lineTo(0,0-r*a),e.rotate(Math.PI/o),e.lineTo(0,0-r)}getSidesCount(t){const r=t.shapeData;return Math.round((0,e.getRangeValue)(r?.sides??5))}particleInit(t,r){const o=r.shapeData;r.starInset=(0,e.getRangeValue)(o?.inset??2)}}async function r(e,r=!0){await e.addShape("star",new t,r)}})(),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.1
|
|
8
|
-
*/
|
|
1
|
+
/*! tsParticles Star Shape v3.0.0-beta.0 by Matteo Bruni */
|
package/types/StarDrawer.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type Container, type IShapeDrawer, type Particle } from "@tsparticles/engine";
|
|
2
2
|
import type { StarParticle } from "./StarParticle";
|
|
3
3
|
export declare class StarDrawer implements IShapeDrawer {
|
|
4
4
|
draw(context: CanvasRenderingContext2D, particle: StarParticle, radius: number): void;
|
package/types/index.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { Engine } from "@tsparticles/engine";
|
|
2
|
-
export declare function loadStarShape(engine: Engine): Promise<void>;
|
|
2
|
+
export declare function loadStarShape(engine: Engine, refresh?: boolean): Promise<void>;
|
package/umd/StarDrawer.js
CHANGED
|
@@ -13,8 +13,7 @@
|
|
|
13
13
|
const engine_1 = require("@tsparticles/engine");
|
|
14
14
|
class StarDrawer {
|
|
15
15
|
draw(context, particle, radius) {
|
|
16
|
-
|
|
17
|
-
const sides = particle.sides, inset = (_a = particle.starInset) !== null && _a !== void 0 ? _a : 2;
|
|
16
|
+
const sides = particle.sides, inset = particle.starInset ?? 2;
|
|
18
17
|
context.moveTo(0, 0 - radius);
|
|
19
18
|
for (let i = 0; i < sides; i++) {
|
|
20
19
|
context.rotate(Math.PI / sides);
|
|
@@ -24,14 +23,12 @@
|
|
|
24
23
|
}
|
|
25
24
|
}
|
|
26
25
|
getSidesCount(particle) {
|
|
27
|
-
var _a, _b;
|
|
28
26
|
const star = particle.shapeData;
|
|
29
|
-
return Math.round((0, engine_1.getRangeValue)(
|
|
27
|
+
return Math.round((0, engine_1.getRangeValue)(star?.sides ?? 5));
|
|
30
28
|
}
|
|
31
29
|
particleInit(container, particle) {
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
particle.starInset = inset;
|
|
30
|
+
const star = particle.shapeData;
|
|
31
|
+
particle.starInset = (0, engine_1.getRangeValue)(star?.inset ?? 2);
|
|
35
32
|
}
|
|
36
33
|
}
|
|
37
34
|
exports.StarDrawer = StarDrawer;
|
package/umd/index.js
CHANGED
|
@@ -11,8 +11,8 @@
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.loadStarShape = void 0;
|
|
13
13
|
const StarDrawer_1 = require("./StarDrawer");
|
|
14
|
-
async function loadStarShape(engine) {
|
|
15
|
-
await engine.addShape("star", new StarDrawer_1.StarDrawer());
|
|
14
|
+
async function loadStarShape(engine, refresh = true) {
|
|
15
|
+
await engine.addShape("star", new StarDrawer_1.StarDrawer(), refresh);
|
|
16
16
|
}
|
|
17
17
|
exports.loadStarShape = loadStarShape;
|
|
18
18
|
});
|