xxxxxxxxxx
26
let y
let y2
//0-200
let h=200
let width = 30
let res = 1
function setup() {
createCanvas(400, 400);
}
function draw() {
background(220);
for(let x = -200; x<=200; x+=(1/res)){
//problem here
y = cos(x*(1/width))*h
y2 = cos((x-1)*(1/width))*h
point(map(x,-200,200,0,400),y+200);
line(map(x,-200,200,0,400),y+200,map(x-1,-200,200,0,400),(y)+200)
if (map(x,-200,200,0,400)==mouseX)
ellipse(mouseX,y+200,20)
}
if (map(x,-200,200,0,400)==mouseX){
ellipse(mouseX,y+200,20)
}
}