sound = loadSound("Instrumental_Luis.wav");
img = loadImage("8-masked.png");
createCanvas(size, size);
amplitude = new p5.Amplitude();
let colorPrimary = color(11, 218, 144);
let colorContrast = color(255, 255, 255);
background(colorContrast);
translate(size/2, size/2);
let levelAdjusted = map(amplitude.getLevel(), 0, 1, 0.05, size/100);
for (let i = 0; i < 8; i++) {
line(-size/2, pos + offset*i, size/2, pos + offset*i);
pos = pos - levelAdjusted;
if (pos + offset*i < -size) {
image(img, -size/2, -size/2, size, size);
if (frameCount % 2 == 0) {
snowflakes.push(new snowflake());
for (let flake of snowflakes) {
this.posY = random(-50, 0);
this.initialangle = random(0, 2 * PI);
this.size = random(size/100, size/50);
this.radius = sqrt(random(pow(size / 2, 2)));
this.update = function(time) {
let angle = w * time + this.initialangle;
this.posX = size / 2 + this.radius * sin(angle);
this.posY += pow(this.size, 0.2);
let index = snowflakes.indexOf(this);
snowflakes.splice(index, 1);
this.display = function() {
ellipse(this.posX, this.posY, this.size);