New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

canvas-confetti

Package Overview
Dependencies
Maintainers
1
Versions
37
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

canvas-confetti - npm Package Compare versions

Comparing version

to
1.6.0

24

dist/confetti.browser.js

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

// canvas-confetti v1.5.1 built on 2022-02-08T22:20:40.944Z
// canvas-confetti v1.6.0 built on 2022-10-24T21:26:41.619Z
!(function (window, module) {

@@ -145,3 +145,3 @@ // source content

' } else if (msg.data.reset) {',
' CONFETTI.reset();',
' CONFETTI && CONFETTI.reset();',
' } else if (msg.data.resize) {',

@@ -341,2 +341,22 @@ ' SIZE.width = msg.data.resize.width;',

ellipse(context, fetti.x, fetti.y, Math.abs(x2 - x1) * fetti.ovalScalar, Math.abs(y2 - y1) * fetti.ovalScalar, Math.PI / 10 * fetti.wobble, 0, 2 * Math.PI);
} else if (fetti.shape === 'star') {
var rot = Math.PI / 2 * 3;
var innerRadius = 4 * fetti.scalar;
var outerRadius = 8 * fetti.scalar;
var x = fetti.x;
var y = fetti.y;
var spikes = 5;
var step = Math.PI / spikes;
while (spikes--) {
x = fetti.x + Math.cos(rot) * outerRadius;
y = fetti.y + Math.sin(rot) * outerRadius;
context.lineTo(x, y);
rot += step;
x = fetti.x + Math.cos(rot) * innerRadius;
y = fetti.y + Math.sin(rot) * innerRadius;
context.lineTo(x, y);
rot += step;
}
} else {

@@ -343,0 +363,0 @@ context.moveTo(Math.floor(fetti.x), Math.floor(fetti.y));

2

package.json
{
"name": "canvas-confetti",
"version": "1.5.1",
"version": "1.6.0",
"description": "performant confetti animation in the browser",

@@ -5,0 +5,0 @@ "main": "src/confetti.js",

@@ -74,3 +74,3 @@ # [![Canvas Confetti](https://cdn.jsdelivr.net/gh/catdad-experiments/catdad-experiments-org@5ed78b/canvas-confetti/logo.jpg)](https://github.com/catdad/canvas-confetti/)

- `colors` _Array<String>_: An array of color strings, in the HEX format... you know, like `#bada55`.
- `shapes` _Array<String>_: An array of shapes for the confetti. The possible values are `square` and `circle`. The default is to use both shapes in an even mix. You can even change the mix by providing a value such as `['circle', 'circle', 'square']` to use two third circles and one third squares.
- `shapes` _Array<String>_: An array of shapes for the confetti. The possible values are `square`, `circle`, and `star`. The default is to use both squares and circles in an even mix. To use a single shape, you can provide just one shape in the array, such as `['star']`. You can also change the mix by providing a value such as `['circle', 'circle', 'square']` to use two third circles and one third squares.
- `scalar` _Number (default: 1)_: Scale factor for each confetti particle. Use decimals to make the confetti smaller. Go on, try teeny tiny confetti, they are adorable!

@@ -77,0 +77,0 @@ - `zIndex` _Integer (default: 100)_: The confetti should be on top, after all. But if you have a crazy high page, you can set it even higher.

@@ -142,3 +142,3 @@ (function main(global, module, isWorker, workerSize) {

' } else if (msg.data.reset) {',
' CONFETTI.reset();',
' CONFETTI && CONFETTI.reset();',
' } else if (msg.data.resize) {',

@@ -338,2 +338,22 @@ ' SIZE.width = msg.data.resize.width;',

ellipse(context, fetti.x, fetti.y, Math.abs(x2 - x1) * fetti.ovalScalar, Math.abs(y2 - y1) * fetti.ovalScalar, Math.PI / 10 * fetti.wobble, 0, 2 * Math.PI);
} else if (fetti.shape === 'star') {
var rot = Math.PI / 2 * 3;
var innerRadius = 4 * fetti.scalar;
var outerRadius = 8 * fetti.scalar;
var x = fetti.x;
var y = fetti.y;
var spikes = 5;
var step = Math.PI / spikes;
while (spikes--) {
x = fetti.x + Math.cos(rot) * outerRadius;
y = fetti.y + Math.sin(rot) * outerRadius;
context.lineTo(x, y);
rot += step;
x = fetti.x + Math.cos(rot) * innerRadius;
y = fetti.y + Math.sin(rot) * innerRadius;
context.lineTo(x, y);
rot += step;
}
} else {

@@ -340,0 +360,0 @@ context.moveTo(Math.floor(fetti.x), Math.floor(fetti.y));

Sorry, the diff of this file is not supported yet