@tsparticles/shape-text
Advanced tools
Comparing version 3.0.0-beta.4 to 3.0.0-beta.5
@@ -9,8 +9,8 @@ import { executeOnSingleOrMultiple, isInArray, itemFromSingleOrMultiple, loadFont, } from "@tsparticles/engine"; | ||
y: radius / 2, | ||
}; | ||
}, diameter = radius * 2; | ||
if (fill) { | ||
context.fillText(line, pos.x, pos.y + radius * 2 * index); | ||
context.fillText(line, pos.x, pos.y + diameter * index); | ||
} | ||
else { | ||
context.strokeText(line, pos.x, pos.y + radius * 2 * index); | ||
context.strokeText(line, pos.x, pos.y + diameter * index); | ||
} | ||
@@ -17,0 +17,0 @@ }; |
@@ -12,8 +12,8 @@ "use strict"; | ||
y: radius / 2, | ||
}; | ||
}, diameter = radius * 2; | ||
if (fill) { | ||
context.fillText(line, pos.x, pos.y + radius * 2 * index); | ||
context.fillText(line, pos.x, pos.y + diameter * index); | ||
} | ||
else { | ||
context.strokeText(line, pos.x, pos.y + radius * 2 * index); | ||
context.strokeText(line, pos.x, pos.y + diameter * index); | ||
} | ||
@@ -20,0 +20,0 @@ }; |
@@ -9,8 +9,8 @@ import { executeOnSingleOrMultiple, isInArray, itemFromSingleOrMultiple, loadFont, } from "@tsparticles/engine"; | ||
y: radius / 2, | ||
}; | ||
}, diameter = radius * 2; | ||
if (fill) { | ||
context.fillText(line, pos.x, pos.y + radius * 2 * index); | ||
context.fillText(line, pos.x, pos.y + diameter * index); | ||
} | ||
else { | ||
context.strokeText(line, pos.x, pos.y + radius * 2 * index); | ||
context.strokeText(line, pos.x, pos.y + diameter * index); | ||
} | ||
@@ -17,0 +17,0 @@ }; |
{ | ||
"name": "@tsparticles/shape-text", | ||
"version": "3.0.0-beta.4", | ||
"version": "3.0.0-beta.5", | ||
"description": "tsParticles text shape", | ||
@@ -62,3 +62,3 @@ "homepage": "https://particles.js.org", | ||
"dependencies": { | ||
"@tsparticles/engine": "^3.0.0-beta.4" | ||
"@tsparticles/engine": "^3.0.0-beta.5" | ||
}, | ||
@@ -65,0 +65,0 @@ "publishConfig": { |
@@ -7,3 +7,3 @@ /*! | ||
* How to use? : Check the GitHub README | ||
* v3.0.0-beta.4 | ||
* v3.0.0-beta.5 | ||
*/ | ||
@@ -110,7 +110,8 @@ (function webpackUniversalModuleDefinition(root, factory) { | ||
y: radius / 2 | ||
}; | ||
}, | ||
diameter = radius * 2; | ||
if (fill) { | ||
context.fillText(line, pos.x, pos.y + radius * 2 * index); | ||
context.fillText(line, pos.x, pos.y + diameter * index); | ||
} else { | ||
context.strokeText(line, pos.x, pos.y + radius * 2 * index); | ||
context.strokeText(line, pos.x, pos.y + diameter * index); | ||
} | ||
@@ -117,0 +118,0 @@ }; |
/*! For license information please see tsparticles.shape.text.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 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 i=r[e]={exports:{}};return t[e](i,i.exports,o),i.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,{loadTextShape:()=>i});var e=o(533);const t=["text","character","char","multiline-text"];class r{constructor(){this._drawLine=(e,t,r,o,n,i)=>{const a={x:-(t.length*r/2),y:r/2};i?e.fillText(t,a.x,a.y+2*r*n):e.strokeText(t,a.x,a.y+2*r*n)}}draw(t){const{context:r,particle:o,radius:n,opacity:i}=t,a=o.shapeData;if(!a)return;const s=a.value;if(void 0===s)return;void 0===o.text&&(o.text=(0,e.itemFromSingleOrMultiple)(s,o.randomIndexData));const l=o.text,p=a.style??"",c=a.weight??"400",d=2*Math.round(n),f=a.font??"Verdana",u=o.shapeFill,x=l?.split("\n");if(x){r.font=`${p} ${c} ${d}px "${f}"`,r.globalAlpha=i;for(let e=0;e<x.length;e++)this._drawLine(r,x[e],n,i,e,u);r.globalAlpha=1}}async init(r){const o=r.actualOptions;if(t.find((t=>(0,e.isInArray)(t,o.particles.shape.type)))){const r=t.map((e=>o.particles.shape.options[e])).find((e=>!!e)),n=[];(0,e.executeOnSingleOrMultiple)(r,(t=>{n.push((0,e.loadFont)(t.font,t.weight))})),await Promise.all(n)}}particleInit(r,o){if(!o.shape||!t.includes(o.shape))return;const n=o.shapeData;if(void 0===n)return;const i=n.value;void 0!==i&&(o.text=(0,e.itemFromSingleOrMultiple)(i,o.randomIndexData))}}async function i(e,o=!0){await e.addShape(t,new r,o)}})(),n})())); | ||
!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 i=r[e]={exports:{}};return t[e](i,i.exports,o),i.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,{loadTextShape:()=>i});var e=o(533);const t=["text","character","char","multiline-text"];class r{constructor(){this._drawLine=(e,t,r,o,n,i)=>{const a={x:-(t.length*r/2),y:r/2},s=2*r;i?e.fillText(t,a.x,a.y+s*n):e.strokeText(t,a.x,a.y+s*n)}}draw(t){const{context:r,particle:o,radius:n,opacity:i}=t,a=o.shapeData;if(!a)return;const s=a.value;if(void 0===s)return;void 0===o.text&&(o.text=(0,e.itemFromSingleOrMultiple)(s,o.randomIndexData));const l=o.text,p=a.style??"",c=a.weight??"400",d=2*Math.round(n),f=a.font??"Verdana",u=o.shapeFill,x=l?.split("\n");if(x){r.font=`${p} ${c} ${d}px "${f}"`,r.globalAlpha=i;for(let e=0;e<x.length;e++)this._drawLine(r,x[e],n,i,e,u);r.globalAlpha=1}}async init(r){const o=r.actualOptions;if(t.find((t=>(0,e.isInArray)(t,o.particles.shape.type)))){const r=t.map((e=>o.particles.shape.options[e])).find((e=>!!e)),n=[];(0,e.executeOnSingleOrMultiple)(r,(t=>{n.push((0,e.loadFont)(t.font,t.weight))})),await Promise.all(n)}}particleInit(r,o){if(!o.shape||!t.includes(o.shape))return;const n=o.shapeData;if(void 0===n)return;const i=n.value;void 0!==i&&(o.text=(0,e.itemFromSingleOrMultiple)(i,o.randomIndexData))}}async function i(e,o=!0){await e.addShape(t,new r,o)}})(),n})())); |
@@ -1,1 +0,1 @@ | ||
/*! tsParticles Text Shape v3.0.0-beta.4 by Matteo Bruni */ | ||
/*! tsParticles Text Shape v3.0.0-beta.5 by Matteo Bruni */ |
@@ -21,8 +21,8 @@ (function (factory) { | ||
y: radius / 2, | ||
}; | ||
}, diameter = radius * 2; | ||
if (fill) { | ||
context.fillText(line, pos.x, pos.y + radius * 2 * index); | ||
context.fillText(line, pos.x, pos.y + diameter * index); | ||
} | ||
else { | ||
context.strokeText(line, pos.x, pos.y + radius * 2 * index); | ||
context.strokeText(line, pos.x, pos.y + diameter * index); | ||
} | ||
@@ -29,0 +29,0 @@ }; |
Sorry, the diff of this file is not supported yet
304812
558