xxxxxxxxxx
49
let diameter = 50;
let mic;
function setup() {
createCanvas(400, 400);
noStroke();
background(50);
colorMode(HSB);
mic = new p5.AudioIn();
mic.start();
}
function draw() {
//background(128);
if(mouseIsPressed){
stroke(255, 255, 255, 30);
}else{
noStroke();
}
//fill(255, 0, 255, 50);
//fill(255, 255, 255, 50);
// Now in HSB, 0-360 for hue, 0-100 for saturation and luminance
let hue = mapp(mouseX, 0, width, 0, 360);
fill(hue, 100, 100, 0.5);
//let redAmt = map(mouseX, 0, width, 0, 255);
//fill(redAmt, 0, 0, 200);
//diameter = dist(mouseX, mouseY, pmouseX, pmouseY);
diameter = mic.getLevel() * 200;
circle(mouseX, mouseY, diameter);
}
function keyPressed(){
if(key == ' '){
background(50);
}
}