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.5.0

2

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

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

# [![Canvas Confetti](https://cdn.jsdelivr.net/gh/catdad-experiments/catdad-experiments-org@5ed78b/canvas-confetti/logo.jpg)](https://github.com/catdad/canvas-confetti/)
[![travis][travis.svg]][travis.link]
[![github actions ci][ci.svg]][ci.link]
[![jsdelivr][jsdelivr.svg]][jsdelivr.link]

@@ -8,4 +8,4 @@ [![npm-downloads][npm-downloads.svg]][npm.link]

[travis.svg]: https://travis-ci.org/catdad/canvas-confetti.svg?branch=master
[travis.link]: https://travis-ci.org/catdad/canvas-confetti
[ci.svg]: https://github.com/catdad/canvas-confetti/actions/workflows/ci.yml/badge.svg
[ci.link]: https://github.com/catdad/canvas-confetti/actions/workflows/ci.yml?query=branch%3Amaster
[jsdelivr.svg]: https://data.jsdelivr.com/v1/package/npm/canvas-confetti/badge?style=rounded

@@ -34,3 +34,3 @@ [jsdelivr.link]: https://www.jsdelivr.com/package/npm/canvas-confetti

```html
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.4.0/dist/confetti.browser.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/canvas-confetti@1.5.0/dist/confetti.browser.min.js"></script>
```

@@ -94,7 +94,7 @@

_**Important: If you use `useWorker: true`, I own your canvas now. It's mine now and I can do whatever I want with it (don't worry... I'll just put confetti inside it, I promise). You must not try to use the canvas in any way (other than I guess removing it from the DOM), as it will throw an error. When using workers for rendering, control of the canvas must be transfered to the web worker, preventing any usage of that canvas on the main thread. If you must manipulate the canvas in any way, do not use this option.**_
_**Important: If you use `useWorker: true`, I own your canvas now. It's mine now and I can do whatever I want with it (don't worry... I'll just put confetti inside it, I promise). You must not try to use the canvas in any way (other than I guess removing it from the DOM), as it will throw an error. When using workers for rendering, control of the canvas must be transferred to the web worker, preventing any usage of that canvas on the main thread. If you must manipulate the canvas in any way, do not use this option.**_
```javascript
var myCanvas = document.createElement('canvas');
document.appendChild(myCanvas);
document.body.appendChild(myCanvas);

@@ -127,3 +127,3 @@ var myConfetti = confetti.create(myCanvas, {

var myCanvas = document.createElement('canvas');
document.appendChild(myCanvas);
document.body.appendChild(myCanvas);

@@ -130,0 +130,0 @@ var myConfetti = confetti.create(myCanvas, { resize: true });

@@ -290,5 +290,6 @@ (function main(global, module, isWorker, workerSize) {

wobble: Math.random() * 10,
wobbleSpeed: Math.min(0.11, Math.random() * 0.1 + 0.05),
velocity: (opts.startVelocity * 0.5) + (Math.random() * opts.startVelocity),
angle2D: -radAngle + ((0.5 * radSpread) - (Math.random() * radSpread)),
tiltAngle: Math.random() * Math.PI,
tiltAngle: (Math.random() * (0.75 - 0.25) + 0.25) * Math.PI,
color: opts.color,

@@ -300,3 +301,3 @@ shape: opts.shape,

drift: opts.drift,
random: Math.random() + 5,
random: Math.random() + 2,
tiltSin: 0,

@@ -315,3 +316,3 @@ tiltCos: 0,

fetti.y += Math.sin(fetti.angle2D) * fetti.velocity + fetti.gravity;
fetti.wobble += 0.1;
fetti.wobble += fetti.wobbleSpeed;
fetti.velocity *= fetti.decay;

@@ -321,3 +322,3 @@ fetti.tiltAngle += 0.1;

fetti.tiltCos = Math.cos(fetti.tiltAngle);
fetti.random = Math.random() + 5;
fetti.random = Math.random() + 2;
fetti.wobbleX = fetti.x + ((10 * fetti.scalar) * Math.cos(fetti.wobble));

@@ -583,3 +584,17 @@ fetti.wobbleY = fetti.y + ((10 * fetti.scalar) * Math.sin(fetti.wobble));

module.exports = confettiCannon(null, { useWorker: true, resize: true });
// Make default export lazy to defer worker creation until called.
var defaultFire;
function getDefaultFire() {
if (!defaultFire) {
defaultFire = confettiCannon(null, { useWorker: true, resize: true });
}
return defaultFire;
}
module.exports = function() {
return getDefaultFire().apply(this, arguments);
};
module.exports.reset = function() {
getDefaultFire().reset();
};
module.exports.create = confettiCannon;

@@ -586,0 +601,0 @@ }((function () {