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

bubbleworks

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bubbleworks - npm Package Compare versions

Comparing version 1.1.1 to 1.2.1

50

index.js

@@ -10,3 +10,3 @@

var render = function render(particles, ctx, width, height) {
requestAnimationFrame(function() {
requestAnimationFrame(function () {
if (!isRendered) {

@@ -18,3 +18,3 @@ return

ctx.clearRect(0, 0, width, height)
particles.forEach(function(p, i) {
particles.forEach(function (p, i) {
p.x += p.speed * Math.cos(p.rotation * Math.PI / 180)

@@ -27,3 +27,7 @@ p.y += p.speed * Math.sin(p.rotation * Math.PI / 180)

p.y += p.yVel
if (p.opacity < 0 || p.radius < 0) return
if (p.opacity < 0 || p.radius < 0) {
return
}
ctx.beginPath()

@@ -38,17 +42,27 @@ ctx.globalAlpha = p.opacity

function explode (x, y, colors) {
function explode (opts) {
if (!opts) {
throw new Error('Missing options for bubbleworks')
}
var x = opts.x
var y = opts.y
var colors = opts.colors
var parentNode = opts.parentNode || document.body
var particles = []
var ratio = window.devicePixelRatio
var c = document.createElement("canvas")
var ctx = c.getContext("2d")
c.style.position = "absolute"
c.style.left = x - 100 + "px"
c.style.top = y - 100 + "px"
c.style.pointerEvents = "none"
c.style.width = 200 + "px"
c.style.height = 200 + "px"
var c = document.createElement('canvas')
var ctx = c.getContext('2d')
c.style.position = 'absolute'
c.style.left = x - 100 + 'px'
c.style.top = y - 100 + 'px'
c.style.pointerEvents = 'none'
c.style.width = 200 + 'px'
c.style.height = 200 + 'px'
c.style.zIndex = 100
c.width = 200 * ratio
c.height = 200 * ratio
document.body.appendChild(c)
parentNode.appendChild(c)

@@ -72,7 +86,13 @@ for (var i = 0; i < bubbles; i++) {

setTimeout(function() {
document.body.removeChild(c)
isRendered = true
setTimeout(function () {
parentNode.removeChild(c)
}, 1000)
setTimeout(function () {
isRendered = false
}, 1100)
}
module.exports = explode
{
"name": "bubbleworks",
"version": "1.1.1",
"version": "1.2.1",
"main": "index.js",
"license": "MIT"
}
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