xxxxxxxxxx
let yoff = 0.0;
let o = 0.0;
let p = 0.0;
let mySound;
let amplitude;
let counter = 0;
let sound;
let index = 0;
function preload() {
eye = loadImage("eye.png");
eye2 = loadImage("eye2.png");
sound = loadSound('green_jewels.mp3');
}
function setup() {
createCanvas(windowWidth, windowHeight);
sound.setVolume(1);
sound.loop();
amplitude = new p5.Amplitude();
}
function draw() {
let h = map(sin(counter), -0.2, 0.5, 50, 20);
background(0, 0, h,20);
counter += 0.01;
//background(0,20);
imageMode(CENTER);
let amp = map(amplitude.getLevel(), 0, 1, 10, 500);
//scale
o = + 0.04;
p = cos(o) * 2;
var r3 = map(amplitude.getLevel(), 0, 1, 0,01*PI);
var r = map(amplitude.getLevel(), 0, 1, 0,1*PI);
var r1 = map(amplitude.getLevel(), 0, 1, 0,01*PI);
var r2 = map(amplitude.getLevel(), 0, 1, 0, 0.2*PI);
//rect
push();
noStroke();
fill(199,0,0,20);
//rotate(-r*10);
rect(0,0,width,400*r3)
pop();
//wellen
push();
fill(0);
beginShape();
let xoff = 0;
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xoff, yoff), 0, 1, 200, 300);
vertex(x, y);
xoff += 0.05*r;
}
yoff += 0.01;
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
pop();
push();
translate(0,height/2-400)
fill(0,0,20);
beginShape();
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xoff, yoff), 0, 1, 200, 300);
vertex(x, y);
xoff += 0.05*r1;
}
yoff += 0.01;
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
pop();
push();
translate(0,height/2-300)
fill(0,0,30);
beginShape();
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xoff, yoff), 0, 1, 200, 300);
vertex(x, y);
xoff += 0.05*r1;
}
yoff += 0.01;
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
pop();
push();
translate(0,height/2-200)
fill(0,0,40);
beginShape();
for (let x = 0; x <= width; x += 10) {
let y = map(noise(xoff, yoff), 0, 1, 200, 300);
vertex(x, y);
xoff += 0.05*r;
}
yoff += 0.01;
vertex(width, height);
vertex(0, height);
endShape(CLOSE);
pop();
//lines
push();
let level = amplitude.getLevel();
let peak = map(level, 0, 1, 0, height);
translate (width/2,height/2);
rotate(millis() / 9);
stroke(0);//schwarz
line(index*r2, 0, index*r, peak);
if (index < width)
index += 2;
else
index = 0;
pop();
push();
translate (width/2,height/2);
rotate(millis() / 8);
stroke(10,0,0);//rot
line(index*r2, 0, index*r, peak);
if (index < width)
index += 2;
else
index = 0;
pop();
push();
translate (width/2,height/2);
rotate(millis() / 8);
stroke(255,r*100);//weiss
line(index*r2, 0, index*r, peak);
if (index < width)
index += 2;
else
index = 0;
pop();
push();
translate (width/2,height/2);
rotate(millis() / 7);
stroke(255,r*100);//weiss
line(index*r2, 0, index*r, peak);
if (index < width)
index += 2;
else
index = 0;
pop();
push();
translate (width/2,height/2);
rotate(millis() / 2);
stroke(80,0,0);//rot
line(index*r2, 0, index*r, peak);
if (index < width)
index += 2;
else
index = 0;
pop();
//eye
push();
tint(r*500,0,0,60)
image(eye2,width/2,height/2,100,30);
pop();
push();
fill(r*200,0,0,70)
noStroke();
ellipse(width/2,height/2,30,30,50);
pop();
}