@code-dot-org/dance-party
Advanced tools
Comparing version 0.0.40 to 0.0.41
{ | ||
"name": "@code-dot-org/dance-party", | ||
"version": "0.0.40", | ||
"version": "0.0.41", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -469,2 +469,5 @@ const constants = require('./constants'); | ||
} | ||
this.image = p5.createGraphics(75, 130); | ||
this.image.scale(7); | ||
drawPineapple(this.image.drawingContext); | ||
}, | ||
@@ -477,4 +480,4 @@ draw: function () { | ||
p5.rotate(pineapple.rot); | ||
p5.scale(pineapple.life / 20); | ||
drawPineapple(p5._renderer.drawingContext); | ||
p5.scale(pineapple.life / 20 / (7 * p5.pixelDensity())); | ||
p5.drawingContext.drawImage(this.image.elt, -35, -65); | ||
pineapple.life--; | ||
@@ -492,43 +495,50 @@ if (pineapple.life < 0) { | ||
this.splatter = { | ||
splats:[], | ||
numSplats:100, | ||
buffer: null, | ||
splats: [], | ||
numSplats: 5, | ||
randomSplat: function () { | ||
let r = randomNumber(30,60); | ||
return {x: randomNumber(0,400), | ||
y: randomNumber(0,400), | ||
color: randomColorFromPalette(), | ||
width: r, | ||
height: r, | ||
return { | ||
x: p5.random(0, 400), | ||
y: p5.random(0, 400), | ||
r: p5.random(5, 15), | ||
color: randomColorFromPalette(), | ||
}; | ||
}, | ||
init: function () { | ||
if (this.splats.length) { | ||
this.splats.length = 0; | ||
for (let i = 0; i < this.numSplats; i++) { | ||
this.splats.push(this.randomSplat()); | ||
} | ||
if (this.buffer) { | ||
this.buffer.clear(); | ||
return; | ||
} | ||
for (var i=0;i<this.numSplats;i++) { | ||
this.splats.push(this.randomSplat()); | ||
} | ||
p5.strokeWeight(0); | ||
this.buffer = p5.createGraphics(p5.width, p5.height); | ||
this.buffer.noStroke(); | ||
this.buffer.drawingContext.globalAlpha = 0.8; | ||
}, | ||
update: function () { | ||
//TODO: add some music-driven change? Right now it just grows continuously. | ||
}, | ||
draw: function () { | ||
p5.strokeWeight(0); | ||
// first make a pass and remove items, traversing in reverse so that removals | ||
// dont affect traversal | ||
for (var i=this.splats.length-1;i>=0;i--) { | ||
if (randomNumber(0,50) === 0) { | ||
// remove existing | ||
this.splats.splice(i, 1); | ||
// add new item to end of array, so that it gets rendered above older ones | ||
this.splats.push(this.randomSplat()); | ||
for (let splat of this.splats) { | ||
if (splat.r > 30) { | ||
splat.x = p5.random(0, 400); | ||
splat.y = p5.random(0, 400); | ||
splat.r = p5.random(5, 15); | ||
splat.color = randomColorFromPalette(); | ||
} | ||
splat.r += p5.random(1); | ||
this.buffer.fill(splat.color); | ||
for (let i = 0; i < 20; i++) { | ||
this.buffer.ellipse(p5.randomGaussian(splat.x, splat.r), p5.randomGaussian(splat.y, splat.r), p5.random(2, 8)); | ||
} | ||
} | ||
for (i=0;i<this.splats.length;i++) { | ||
p5.fill(this.splats[i].color); | ||
this.splats[i].width+=randomNumber(0,4); | ||
this.splats[i].height+=randomNumber(0,4); | ||
p5.ellipse(this.splats[i].x,this.splats[i].y,this.splats[i].width,this.splats[i].height); | ||
} | ||
// Copy the off-screen buffer to the canvas. | ||
p5.push(); | ||
p5.scale(1 / p5.pixelDensity()); | ||
p5.drawingContext.drawImage(this.buffer.elt, 0, 0); | ||
p5.pop(); | ||
} | ||
@@ -767,3 +777,3 @@ }; | ||
this.shapes.triangle(20, 0, 50, 30, 30, 60); | ||
this.shapes.fill(colorFromPalette(5)); | ||
this.shapes.fill(colorFromPalette(4)); | ||
this.shapes.ellipse(100, 50, 80); | ||
@@ -960,3 +970,3 @@ this.shapes.fill(colorFromPalette(1)); | ||
draw: function () { | ||
p5.background('lightblue'); | ||
p5.background(lerpColorFromPalette(0.5)); | ||
let flake = { | ||
@@ -963,0 +973,0 @@ x: p5.random(-100, 400), |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
22721246
112052
3