Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

js-confetti

Package Overview
Dependencies
Maintainers
1
Versions
41
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

js-confetti - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

2

dist/index.js

@@ -1,1 +0,1 @@

!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.jsConfetti=e():t.jsConfetti=e()}(self,(function(){return(()=>{"use strict";var t={374:(t,e,n)=>{function i(t){return+t.replace(/px/,"")}function o(t,e){return Math.floor(Math.random()*(e-t+1))+t}n.r(e),n.d(e,{default:()=>f});var r=["#fcf403","#62fc03","#f4fc03","#03e7fc","#03fca5","#a503fc","#fc03ad","#fc9003"];function a(t,e){var n=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),n.push.apply(n,i)}return n}function s(t,e,n){return e in t?Object.defineProperty(t,e,{value:n,enumerable:!0,configurable:!0,writable:!0}):t[e]=n,t}function c(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}var l=function(){function t(e,n){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.speedX=.1*o(500,900)/100,this.speedY=.1*o(500,900)/100,this.radius=10,this.angle="left"===n?o(-140,0)*Math.PI/180:o(0,-140)*Math.PI/180,this.position=function(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?a(Object(n),!0).forEach((function(e){s(t,e,n[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):a(Object(n)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))}))}return t}({},e),this.color=r[o(0,r.length-1)]}var e,n;return e=t,(n=[{key:"draw",value:function(t){var e=this.position,n=this.radius,i=this.color,o=window.devicePixelRatio;t.fillStyle=i,t.beginPath(),t.arc(e.x*o,e.y*o,n*o,0,2*Math.PI,!0),t.fill()}},{key:"updatePosition",value:function(t){var e=this.speedX,n=this.speedY,i=this.angle;this.position.x+=Math.cos(i)*t*e,this.position.y+=Math.sin(i)*t*n,this.speedY-=5e-4*t}}])&&c(e.prototype,n),t}();function u(t,e){for(var n=0;n<e.length;n++){var i=e[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}const f=function(){function t(){var e=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.canvas=document.createElement("canvas"),this.canvas.style.position="absolute",this.canvas.style.width="100%",this.canvas.style.height="100%",this.canvas.style.top="0",this.canvas.style.left="0",this.canvas.style.zIndex="1000",this.canvas.style.pointerEvents="none",document.body.appendChild(this.canvas),this.canvasContext=this.canvas.getContext("2d"),this.shapes=[],this.lastUpdated=(new Date).getTime(),setTimeout((function(){return e.loop.call(e)}),0)}var e,n;return e=t,(n=[{key:"loop",value:function(){var t,e,n,o,r,a=this;t=this.canvas,e=window.devicePixelRatio,o=i((n=getComputedStyle(t)).getPropertyValue("width")),r=i(n.getPropertyValue("height")),t.setAttribute("width",(o*e).toString()),t.setAttribute("height",(r*e).toString());var s=(new Date).getTime(),c=s-this.lastUpdated;this.shapes.forEach((function(t){t.updatePosition(c),t.draw(a.canvasContext)})),this.lastUpdated=s,setTimeout((function(){return a.loop.call(a)}),0)}},{key:"addConfetti",value:function(){for(var t=5*window.innerHeight/7,e={x:0,y:t},n={x:window.innerWidth,y:t},i=0;i<50;i++)this.shapes.push(new l(e,"right")),this.shapes.push(new l(n,"left"))}}])&&u(e.prototype,n),t}()}},e={};function n(i){if(e[i])return e[i].exports;var o=e[i]={exports:{}};return t[i](o,o.exports,n),o.exports}return n.d=(t,e)=>{for(var i in e)n.o(e,i)&&!n.o(t,i)&&Object.defineProperty(t,i,{enumerable:!0,get:e[i]})},n.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),n.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n(374)})()}));
!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.jsConfetti=e():t.jsConfetti=e()}(self,(function(){return(()=>{"use strict";var t={276:(t,e,i)=>{function n(t){return+t.replace(/px/,"")}function r(t,e){return Math.floor(Math.random()*(e-t+1))+t}i.r(e),i.d(e,{default:()=>f});var o=["#fcf403","#62fc03","#f4fc03","#03e7fc","#03fca5","#a503fc","#fc03ad","#fc9003"];function a(t,e){var i=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),i.push.apply(i,n)}return i}function s(t,e,i){return e in t?Object.defineProperty(t,e,{value:i,enumerable:!0,configurable:!0,writable:!0}):t[e]=i,t}function c(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}var u=function(){function t(e,i){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.speed={x:.1*r(500,900)/100,y:.1*r(500,900)/100},this.rotationSpeed=.1*r(20,1e3)/100,this.radius={x:10,y:10},this.radiusYUpdateDirection="down",this.angle="left"===i?r(-140,0)*Math.PI/180:r(0,-140)*Math.PI/180,this.position=function(t){for(var e=1;e<arguments.length;e++){var i=null!=arguments[e]?arguments[e]:{};e%2?a(Object(i),!0).forEach((function(e){s(t,e,i[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(i)):a(Object(i)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(i,e))}))}return t}({},e),this.color=o[r(0,o.length-1)]}var e,i;return e=t,(i=[{key:"draw",value:function(t){var e=this.position,i=this.radius,n=this.color,r=window.devicePixelRatio;t.fillStyle=n,t.beginPath(),t.ellipse(e.x*r,e.y*r,i.x*r,i.y*r,0,0,2*Math.PI),t.fill()}},{key:"updatePosition",value:function(t){var e=this.speed,i=this.angle,n=this.radiusYUpdateDirection,r=this.rotationSpeed;this.position.x+=Math.cos(i)*t*e.x,this.position.y+=Math.sin(i)*t*e.y,"down"===n?(this.radius.y-=t*r*.1,this.radius.y<=0&&(this.radius.y=0,this.radiusYUpdateDirection="up")):(this.radius.y+=t*r*.1,this.radius.y>=10&&(this.radius.y=10,this.radiusYUpdateDirection="down")),this.speed.y-=5e-4*t}}])&&c(e.prototype,i),t}();function l(t,e){for(var i=0;i<e.length;i++){var n=e[i];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}const f=function(){function t(){var e,i=this;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.canvas=((e=document.createElement("canvas")).style.position="fixed",e.style.width="100%",e.style.height="100%",e.style.top="0",e.style.left="0",e.style.zIndex="1000",e.style.pointerEvents="none",document.body.appendChild(e),e),this.canvasContext=this.canvas.getContext("2d"),this.shapes=[],this.lastUpdated=(new Date).getTime(),setTimeout((function(){return i.loop.call(i)}),0)}var e,i;return e=t,(i=[{key:"loop",value:function(){var t,e,i,r,o,a=this;t=this.canvas,e=window.devicePixelRatio,r=n((i=getComputedStyle(t)).getPropertyValue("width")),o=n(i.getPropertyValue("height")),t.setAttribute("width",(r*e).toString()),t.setAttribute("height",(o*e).toString());var s=(new Date).getTime(),c=s-this.lastUpdated;this.shapes.forEach((function(t){t.updatePosition(c),t.draw(a.canvasContext)})),this.lastUpdated=s,setTimeout((function(){return a.loop.call(a)}),0)}},{key:"addConfetti",value:function(){for(var t=5*window.innerHeight/7,e={x:0,y:t},i={x:window.innerWidth,y:t},n=0;n<50;n++)this.shapes.push(new u(e,"right")),this.shapes.push(new u(i,"left"))}}])&&l(e.prototype,i),t}()}},e={};function i(n){if(e[n])return e[n].exports;var r=e[n]={exports:{}};return t[n](r,r.exports,i),r.exports}return i.d=(t,e)=>{for(var n in e)i.o(e,n)&&!i.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},i.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),i.r=t=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i(276)})()}));
{
"name": "js-confetti",
"version": "0.0.8",
"version": "0.0.9",
"license": "MIT",

@@ -5,0 +5,0 @@ "description": "js-confetti",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc