@code-dot-org/dance-party
Advanced tools
Comparing version 0.0.49 to 0.0.51
{ | ||
"name": "@code-dot-org/dance-party", | ||
"version": "0.0.49", | ||
"version": "0.0.51", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/main.js", |
@@ -51,2 +51,9 @@ module.exports = { | ||
'stars', | ||
'music_wave', | ||
'ripples', | ||
'ripples_random', | ||
'quads', | ||
'flowers', | ||
'squiggles', | ||
'growing_stars' | ||
], | ||
@@ -67,2 +74,5 @@ FOREGROUND_EFFECTS: [ | ||
'raining_tacos', | ||
'emojis', | ||
'hearts_colorful', | ||
'exploding_stars' | ||
], | ||
@@ -69,0 +79,0 @@ PALETTES: { |
@@ -798,11 +798,10 @@ const constants = require('./constants'); | ||
init: function () { | ||
if (this.buffer) { | ||
return; | ||
if (!this.buffer) { | ||
this.buffer = p5.createGraphics(400, 400); | ||
this.buffer.noFill(); | ||
this.buffer.stroke('#0f0'); | ||
this.buffer.strokeWeight(2); | ||
this.buffer.strokeJoin(p5.BEVEL); | ||
this.buffer.background(0); | ||
} | ||
this.buffer = p5.createGraphics(400, 400); | ||
this.buffer.noFill(); | ||
this.buffer.stroke('#0f0'); | ||
this.buffer.strokeWeight(2); | ||
this.buffer.strokeJoin(p5.BEVEL); | ||
this.buffer.background(0); | ||
@@ -823,2 +822,7 @@ for (let i = 0; i < 2; i++) { | ||
}, | ||
reset: function () { | ||
this.shapes = []; | ||
p5.edges = null; | ||
this.buffer.clear(); | ||
}, | ||
draw: function () { | ||
@@ -1368,3 +1372,3 @@ this.buffer.drawingContext.globalAlpha = 0.25; | ||
for (let i = 0; i < 100; i++) { | ||
let theta = p5.random(0, p5.TWO_PI); | ||
let theta = p5.random(0, 360); | ||
let velocity = p5.random(4,12); | ||
@@ -1381,3 +1385,3 @@ this.stars.push({ | ||
draw: function () { | ||
p5.angleMode(p5.RADIANS); | ||
p5.angleMode(p5.DEGREES); | ||
p5.noStroke(); | ||
@@ -1555,3 +1559,3 @@ if (this.stars.length === 0) { | ||
init: function () { | ||
p5.angleMode(p5.RADIANS); | ||
p5.angleMode(p5.DEGREES); | ||
this.colorIndex = 0; | ||
@@ -1626,7 +1630,7 @@ this.stars = []; | ||
points: [], | ||
dotSpacing: 3, | ||
dotSpacing: 4, | ||
amplitude: 40, | ||
period: 400, | ||
dotRadius: 7, | ||
numSquiggles: 8, | ||
dotRadius: 14, | ||
numSquiggles: 5, | ||
init: function () { | ||
@@ -1633,0 +1637,0 @@ this.points = []; |
@@ -253,2 +253,7 @@ /* eslint-disable no-unused-vars, curly, eqeqeq */ | ||
let backgroundEffect = this.getBackgroundEffect(); | ||
if (backgroundEffect.reset) { | ||
backgroundEffect.reset(); | ||
} | ||
this.world.background_color = null; | ||
@@ -360,2 +365,3 @@ this.world.fg_effect = null; | ||
var sprite = this.p5_.createSprite(location.x, location.y); | ||
sprite.isDancer = true; | ||
@@ -588,3 +594,3 @@ if (name) { | ||
if (group === "all") { | ||
return this.p5_.allSprites; | ||
return this.p5_.allSprites.filter(sprite => sprite.isDancer); | ||
} | ||
@@ -591,0 +597,0 @@ |
// Star helper function from https://p5js.org/examples/form-star.html | ||
module.exports = function drawStar(p5, x, y, radius1, radius2, numPoints) { | ||
let angle = p5.TWO_PI / numPoints; | ||
let angle = 360 / numPoints; | ||
let halfAngle = angle / 2.0; | ||
p5.beginShape(); | ||
for (let a = 0; a < p5.TWO_PI; a += angle) { | ||
for (let a = 0; a < 360; a += angle) { | ||
let sx = x + p5.cos(a) * radius2; | ||
@@ -8,0 +8,0 @@ let sy = y + p5.sin(a) * radius2; |
@@ -78,3 +78,3 @@ const test = require('tape'); | ||
nativeAPI.setBackgroundEffect('rand'); | ||
t.equal(nativeAPI.world.bg_effect, 'fireworks'); | ||
t.equal(nativeAPI.world.bg_effect, 'swirl'); | ||
nativeAPI.getBackgroundEffect().draw({bpm: 120}); | ||
@@ -81,0 +81,0 @@ |
@@ -92,3 +92,4 @@ const test = require('tape'); | ||
['ripples_random'], | ||
['squiggles'] | ||
['squiggles'], | ||
['growing_stars'] | ||
].forEach(effect => { | ||
@@ -95,0 +96,0 @@ let name = effect[0] + (effect[1] ? ("_" + effect[1]) : ""); |
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
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
24303893
167
113073