xxxxxxxxxx
25
let osc;
function setup() {
createCanvas(400, 400);
osc = new p5.Oscillator();
osc.start();
colorMode(HSB);
}
function draw() {
let c = map(mouseX, 0, width, 0, 360, true);
background(0, 0, 66);
let pitch = map(mouseX, 0, width, 200, 800, true);
osc.freq(pitch);
let siz = map(mouseY, height, 0, 10, 150, true);
fill(c, 100, 100);
ellipse(mouseX, mouseY, siz);
let vol = map(mouseY, 0, height, 1, 0, true);
osc.amp(vol);
}