xxxxxxxxxx
46
let inTouch = false;
var osc;
p= 0;
function setup() {
createCanvas(windowWidth, windowHeight);
colorMode(HSB);
rectMode(CENTER);
pixelDensity(displayDensity());
osc = new p5.Oscillator();
osc.setType('sine');
osc.freq(100);
osc.amp(0.5);
osc.start();
fill(150, 80, 70);
}
function draw() {
background(360, 0, 0);
let touchY = map(mouseX, 0, width, 0, 255);
let touchX = map(mouseY, 0, height, 0, 255);
if (inTouch = true) {
smiley(windowWidth / 2, windowHeight / 2, random(290, 300), mouseY);
osc.freq(map(mouseY, 0, height, 61, 401));
}
// osc.freq(map(mouseX,0,width,0,400));
noStroke();
}
function smiley(ww, wh, rndm, mouseY) {
fill(200,100,100);
rect(windowWidth/2,windowHeight/2+100,50,200);
ellipse(windowWidth / 2, windowHeight / 2, rndm, 200);
fill(310,20,100);
ellipse(windowWidth/2 - 50, windowHeight/2 -50, random(40,50), 50);
ellipse(windowWidth/2 + 50, windowHeight/2 -50, random(35,40), 30);
ellipse(windowWidth/2,windowHeight/2+30,mouseY,60);
fill(0,0,0);
ellipse(windowWidth/2 - 50, windowHeight/2 -50, random(5,15), 10);
ellipse(windowWidth/2 + 50, windowHeight/2 -50, random(5,20), 5);
}