evanyou-canvas
Advanced tools
Comparing version 0.3.3 to 1.0.0
@@ -1,2 +0,2 @@ | ||
module.exports=function(e,t){void 0===t&&(t=!0),"string"==typeof e&&(e=document.querySelector(e));var n=function(e){var t=document.createElement("canvas");return t.setAttribute("style","position:absolute;left:0;top:0;width:100%;height:100%;z-index:-1;pointer-events:none"),e.prepend(t),t}(e),i=function(e){var t,n=e.getContext("2d"),i=window.devicePixelRatio||1,o=window.innerWidth,r=window.innerHeight,l=90,a=Math,c=0,d=2*a.PI,u=a.cos,h=a.random;function s(){for(n.clearRect(0,0,o,r),t=[{x:0,y:.7*r+l},{x:0,y:.7*r-l}];t[1].x<o+l;)f(t[0],t[1])}function f(e,i){n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(i.x,i.y);var o=i.x+(2*h()-.25)*l,a=function e(t){var n=t+(2*h()-1.1)*l;return n>r||n<0?e(t):n}(i.y);n.lineTo(o,a),n.closePath(),n.fillStyle="#"+(127*u(c-=d/-50)+128<<16|127*u(c+d/3)+128<<8|127*u(c+d/3*2)+128).toString(16),n.fill(),t[0]=t[1],t[1]={x:o,y:a}}return e.width=o*i,e.height=r*i,n.scale(i,i),n.globalAlpha=.6,s(),s}(n);return t&&document.addEventListener("click",i),{element:n,update:i}}; | ||
module.exports=function(){var e=document.createElement("canvas"),n=function(e){var n,t=e.getContext("2d"),i=window.devicePixelRatio||1,o=window.innerWidth,c=window.innerHeight,r=Math,a=0,l=2*r.PI,d=r.cos,u=r.random;function f(){for(t.clearRect(0,0,o,c),n=[{x:0,y:.7*c+90},{x:0,y:.7*c-90}];n[1].x<o+90;)v(n[0],n[1])}function v(e,i){t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(i.x,i.y);var o=i.x+90*(2*u()-.25),c=x(i.y);t.lineTo(o,c),t.closePath(),t.fillStyle="#"+(127*d(a-=l/-50)+128<<16|127*d(a+l/3)+128<<8|127*d(a+l/3*2)+128).toString(16),t.fill(),n[0]=n[1],n[1]={x:o,y:c}}function x(e){var n=e+90*(2*u()-1.1);return n>c||n<0?x(e):n}return e.width=o*i,e.height=c*i,t.scale(i,i),t.globalAlpha=.6,f(),f}(e);return document.addEventListener("click",n),{canvas:e,update:n,offClick:function(){return document.removeEventListener("click",n)}}}; | ||
//# sourceMappingURL=evanyou-canvas.js.map |
@@ -1,2 +0,2 @@ | ||
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):e.evanyouCanvas=t()}(this,function(){return function(e,t){void 0===t&&(t=!0),"string"==typeof e&&(e=document.querySelector(e));var n=function(e){var t=document.createElement("canvas");return t.setAttribute("style","position:absolute;left:0;top:0;width:100%;height:100%;z-index:-1;pointer-events:none"),e.prepend(t),t}(e),o=function(e){var t,n=e.getContext("2d"),o=window.devicePixelRatio||1,i=window.innerWidth,r=window.innerHeight,d=90,u=Math,a=0,c=2*u.PI,l=u.cos,f=u.random;function s(){for(n.clearRect(0,0,i,r),t=[{x:0,y:.7*r+d},{x:0,y:.7*r-d}];t[1].x<i+d;)y(t[0],t[1])}function y(e,o){n.beginPath(),n.moveTo(e.x,e.y),n.lineTo(o.x,o.y);var i=o.x+(2*f()-.25)*d,u=function e(t){var n=t+(2*f()-1.1)*d;return n>r||n<0?e(t):n}(o.y);n.lineTo(i,u),n.closePath(),n.fillStyle="#"+(127*l(a-=c/-50)+128<<16|127*l(a+c/3)+128<<8|127*l(a+c/3*2)+128).toString(16),n.fill(),t[0]=t[1],t[1]={x:i,y:u}}return e.width=i*o,e.height=r*o,n.scale(o,o),n.globalAlpha=.6,s(),s}(n);return t&&document.addEventListener("click",o),{element:n,update:o}}}); | ||
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):(e||self).evanyouCanvas=n()}(this,function(){return function(){var e=document.createElement("canvas"),n=function(e){var n,t=e.getContext("2d"),o=window.devicePixelRatio||1,i=window.innerWidth,c=window.innerHeight,a=Math,r=0,l=2*a.PI,d=a.cos,f=a.random;function u(){for(t.clearRect(0,0,i,c),n=[{x:0,y:.7*c+90},{x:0,y:.7*c-90}];n[1].x<i+90;)s(n[0],n[1])}function s(e,o){t.beginPath(),t.moveTo(e.x,e.y),t.lineTo(o.x,o.y);var i=o.x+90*(2*f()-.25),c=v(o.y);t.lineTo(i,c),t.closePath(),t.fillStyle="#"+(127*d(r-=l/-50)+128<<16|127*d(r+l/3)+128<<8|127*d(r+l/3*2)+128).toString(16),t.fill(),n[0]=n[1],n[1]={x:i,y:c}}function v(e){var n=e+90*(2*f()-1.1);return n>c||n<0?v(e):n}return e.width=i*o,e.height=c*o,t.scale(o,o),t.globalAlpha=.6,u(),u}(e);return document.addEventListener("click",n),{canvas:e,update:n,offClick:function(){return document.removeEventListener("click",n)}}}}); | ||
//# sourceMappingURL=evanyou-canvas.umd.js.map |
{ | ||
"name": "evanyou-canvas", | ||
"version": "0.3.3", | ||
"version": "1.0.0", | ||
"main": "dist/evanyou-canvas.umd.js", | ||
"module": "dist/evanyou-canvas.mjs", | ||
"types": "index.d.ts", | ||
"scripts": { | ||
"build": "microbundle src/index.js" | ||
"build": "microbundle src/index.ts" | ||
}, | ||
@@ -23,4 +22,4 @@ "license": "MIT", | ||
"devDependencies": { | ||
"microbundle": "^0.11.0" | ||
"microbundle": "^0.13.0" | ||
} | ||
} |
@@ -7,10 +7,12 @@ # evanyou-canvas | ||
```js | ||
import ec from "evanyou-canvas"; | ||
// const ec = require("evanyou-canvas"); | ||
```ts | ||
import evanyouCanvas from 'evanyou-canvas' | ||
``` | ||
const { element, update } = ec("#parent"); // selector or element | ||
// element: canvas element | ||
// update(): draw canvas | ||
```ts | ||
export default function evanyouCanvas(): { | ||
canvas: HTMLCanvasElement | ||
update: () => void | ||
offClick: () => void | ||
} | ||
``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
19923
17
99
1
18
1