@tsparticles/shape-circle
Advanced tools
Comparing version 3.0.3 to 3.1.0
@@ -1,2 +0,3 @@ | ||
import { isObject } from "@tsparticles/engine"; | ||
import { degToRad, isObject, } from "@tsparticles/engine"; | ||
const double = 2, doublePI = Math.PI * double, sides = 12, maxAngle = 360, minAngle = 0, origin = { x: 0, y: 0 }; | ||
export class CircleDrawer { | ||
@@ -6,22 +7,22 @@ draw(data) { | ||
if (!particle.circleRange) { | ||
particle.circleRange = { min: 0, max: Math.PI * 2 }; | ||
particle.circleRange = { min: minAngle, max: doublePI }; | ||
} | ||
const circleRange = particle.circleRange; | ||
context.arc(0, 0, radius, circleRange.min, circleRange.max, false); | ||
context.arc(origin.x, origin.y, radius, circleRange.min, circleRange.max, false); | ||
} | ||
getSidesCount() { | ||
return 12; | ||
return sides; | ||
} | ||
particleInit(container, particle) { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
max: maxAngle, | ||
min: minAngle, | ||
}; | ||
particle.circleRange = !isObject(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
min: minAngle, | ||
max: degToRad(angle), | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
: { min: degToRad(angle.min), max: degToRad(angle.max) }; | ||
} | ||
} |
@@ -5,2 +5,3 @@ "use strict"; | ||
const engine_1 = require("@tsparticles/engine"); | ||
const double = 2, doublePI = Math.PI * double, sides = 12, maxAngle = 360, minAngle = 0, origin = { x: 0, y: 0 }; | ||
class CircleDrawer { | ||
@@ -10,23 +11,23 @@ draw(data) { | ||
if (!particle.circleRange) { | ||
particle.circleRange = { min: 0, max: Math.PI * 2 }; | ||
particle.circleRange = { min: minAngle, max: doublePI }; | ||
} | ||
const circleRange = particle.circleRange; | ||
context.arc(0, 0, radius, circleRange.min, circleRange.max, false); | ||
context.arc(origin.x, origin.y, radius, circleRange.min, circleRange.max, false); | ||
} | ||
getSidesCount() { | ||
return 12; | ||
return sides; | ||
} | ||
particleInit(container, particle) { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
max: maxAngle, | ||
min: minAngle, | ||
}; | ||
particle.circleRange = !(0, engine_1.isObject)(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
min: minAngle, | ||
max: (0, engine_1.degToRad)(angle), | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
: { min: (0, engine_1.degToRad)(angle.min), max: (0, engine_1.degToRad)(angle.max) }; | ||
} | ||
} | ||
exports.CircleDrawer = CircleDrawer; |
@@ -1,2 +0,3 @@ | ||
import { isObject } from "@tsparticles/engine"; | ||
import { degToRad, isObject, } from "@tsparticles/engine"; | ||
const double = 2, doublePI = Math.PI * double, sides = 12, maxAngle = 360, minAngle = 0, origin = { x: 0, y: 0 }; | ||
export class CircleDrawer { | ||
@@ -6,22 +7,22 @@ draw(data) { | ||
if (!particle.circleRange) { | ||
particle.circleRange = { min: 0, max: Math.PI * 2 }; | ||
particle.circleRange = { min: minAngle, max: doublePI }; | ||
} | ||
const circleRange = particle.circleRange; | ||
context.arc(0, 0, radius, circleRange.min, circleRange.max, false); | ||
context.arc(origin.x, origin.y, radius, circleRange.min, circleRange.max, false); | ||
} | ||
getSidesCount() { | ||
return 12; | ||
return sides; | ||
} | ||
particleInit(container, particle) { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
max: maxAngle, | ||
min: minAngle, | ||
}; | ||
particle.circleRange = !isObject(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
min: minAngle, | ||
max: degToRad(angle), | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
: { min: degToRad(angle.min), max: degToRad(angle.max) }; | ||
} | ||
} |
{ | ||
"name": "@tsparticles/shape-circle", | ||
"version": "3.0.3", | ||
"version": "3.1.0", | ||
"description": "tsParticles circle shape", | ||
@@ -62,3 +62,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.0.3" | ||
"@tsparticles/engine": "^3.1.0" | ||
}, | ||
@@ -65,0 +65,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.0.3 | ||
* v3.1.0 | ||
*/ | ||
@@ -102,2 +102,11 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
const CircleDrawer_double = 2, | ||
doublePI = Math.PI * CircleDrawer_double, | ||
sides = 12, | ||
maxAngle = 360, | ||
minAngle = 0, | ||
origin = { | ||
x: 0, | ||
y: 0 | ||
}; | ||
class CircleDrawer { | ||
@@ -112,11 +121,11 @@ draw(data) { | ||
particle.circleRange = { | ||
min: 0, | ||
max: Math.PI * 2 | ||
min: minAngle, | ||
max: doublePI | ||
}; | ||
} | ||
const circleRange = particle.circleRange; | ||
context.arc(0, 0, radius, circleRange.min, circleRange.max, false); | ||
context.arc(origin.x, origin.y, radius, circleRange.min, circleRange.max, false); | ||
} | ||
getSidesCount() { | ||
return 12; | ||
return sides; | ||
} | ||
@@ -126,11 +135,11 @@ particleInit(container, particle) { | ||
angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0 | ||
max: maxAngle, | ||
min: minAngle | ||
}; | ||
particle.circleRange = !(0,engine_root_window_.isObject)(angle) ? { | ||
min: 0, | ||
max: angle * Math.PI / 180 | ||
min: minAngle, | ||
max: (0,engine_root_window_.degToRad)(angle) | ||
} : { | ||
min: angle.min * Math.PI / 180, | ||
max: angle.max * Math.PI / 180 | ||
min: (0,engine_root_window_.degToRad)(angle.min), | ||
max: (0,engine_root_window_.degToRad)(angle.max) | ||
}; | ||
@@ -137,0 +146,0 @@ } |
/*! For license information please see tsparticles.shape.circle.min.js.LICENSE.txt */ | ||
!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 n in r)("object"==typeof exports?exports:e)[n]=r[n]}}(this,(e=>(()=>{"use strict";var t={533:t=>{t.exports=e}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,n),a.exports}n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var o={};return(()=>{n.r(o),n.d(o,{loadCircleShape:()=>r});var e=n(533);class t{draw(e){const{context:t,particle:r,radius:n}=e;r.circleRange||(r.circleRange={min:0,max:2*Math.PI});const o=r.circleRange;t.arc(0,0,n,o.min,o.max,!1)}getSidesCount(){return 12}particleInit(t,r){const n=r.shapeData,o=n?.angle??{max:360,min:0};r.circleRange=(0,e.isObject)(o)?{min:o.min*Math.PI/180,max:o.max*Math.PI/180}:{min:0,max:o*Math.PI/180}}}async function r(e,r=!0){await e.addShape("circle",new t,r)}})(),o})())); | ||
!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 n=r[e];if(void 0!==n)return n.exports;var a=r[e]={exports:{}};return t[e](a,a.exports,o),a.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 n={};return(()=>{o.r(n),o.d(n,{loadCircleShape:()=>c});var e=o(533);const t=2*Math.PI,r=0,a=0;class i{draw(e){const{context:o,particle:n,radius:i}=e;n.circleRange||(n.circleRange={min:0,max:t});const c=n.circleRange;o.arc(r,a,i,c.min,c.max,!1)}getSidesCount(){return 12}particleInit(t,r){const o=r.shapeData,n=o?.angle??{max:360,min:0};r.circleRange=(0,e.isObject)(n)?{min:(0,e.degToRad)(n.min),max:(0,e.degToRad)(n.max)}:{min:0,max:(0,e.degToRad)(n)}}}async function c(e,t=!0){await e.addShape("circle",new i,t)}})(),n})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Circle Shape v3.0.3 by Matteo Bruni */ | ||
/*! tsParticles Circle Shape v3.1.0 by Matteo Bruni */ |
@@ -14,2 +14,3 @@ (function (factory) { | ||
const engine_1 = require("@tsparticles/engine"); | ||
const double = 2, doublePI = Math.PI * double, sides = 12, maxAngle = 360, minAngle = 0, origin = { x: 0, y: 0 }; | ||
class CircleDrawer { | ||
@@ -19,21 +20,21 @@ draw(data) { | ||
if (!particle.circleRange) { | ||
particle.circleRange = { min: 0, max: Math.PI * 2 }; | ||
particle.circleRange = { min: minAngle, max: doublePI }; | ||
} | ||
const circleRange = particle.circleRange; | ||
context.arc(0, 0, radius, circleRange.min, circleRange.max, false); | ||
context.arc(origin.x, origin.y, radius, circleRange.min, circleRange.max, false); | ||
} | ||
getSidesCount() { | ||
return 12; | ||
return sides; | ||
} | ||
particleInit(container, particle) { | ||
const shapeData = particle.shapeData, angle = shapeData?.angle ?? { | ||
max: 360, | ||
min: 0, | ||
max: maxAngle, | ||
min: minAngle, | ||
}; | ||
particle.circleRange = !(0, engine_1.isObject)(angle) | ||
? { | ||
min: 0, | ||
max: (angle * Math.PI) / 180, | ||
min: minAngle, | ||
max: (0, engine_1.degToRad)(angle), | ||
} | ||
: { min: (angle.min * Math.PI) / 180, max: (angle.max * Math.PI) / 180 }; | ||
: { min: (0, engine_1.degToRad)(angle.min), max: (0, engine_1.degToRad)(angle.max) }; | ||
} | ||
@@ -40,0 +41,0 @@ } |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
295689
354
Updated@tsparticles/engine@^3.1.0