xxxxxxxxxx
54
var x = 0;
var y = 0;
var a = 200;
var b = 200;
var d = 90;
var state = false;
var mic;
var s = second();
//var A = 20;
function setup() {
createCanvas(1024, 1024);
background(255);
mic = new p5.AudioIn();
mic.start();
}
function draw() {
var vol = mic.getLevel();
micLevel = mic.getLevel();
var h = map(vol*20, 1, 10, 6, 50);
ellipse(a,b,d+(h+=1),d+(h+=1));
if (state) {
background(0,0) && fill(h+random(110,250),h+random(150,250),h+random(180,250));
} else {
background(255,0) && fill(h+random(110,250),h+random(150,250),h+random(180,250));
}
if(mouseX > 100 && mouseX <250 ) {background(random(200,255), 20) && stroke (255)}
else {background(200, 180, 220,1) && stroke(0);}
if (random(-10) > -3) {
line(x, y, x+20, y+20) && strokeWeight(4);
}
else {
//line(x, y+20, x+20, y);
}
if (x > width) {
x = 0;
y += 20;
}
if (y > height) {
x = 0;
y = 0;
}
}