xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(0);
stroke(0)
strokeWeight(2)
x=0
y=height/2
// strokeWeight(0.1)
}
// var number = 1
var x = 0
var y = 0
var r = 30
var vy = 0
var sec = 0
function draw() {
// background(0,5)
// print(number)
//---------
px=x
py=y
x=x+2
y=y+vy
vy=vy+0.5
if (y>height){
vy=-vy
}
//---------
x+=random(-5,5)
y+=random(-5,5)
// if (second()!=sec){
// sec=second()
// x=random(width)
// y=random(height)
// r=random(50)
// }
fill(map(y,0,height,0,255),map(x,0,width,0,255) ,50)
ellipse(x,y,r,r)
// stroke(255)
r+=random(-5,5)
line(x,y,px,py)
if (mouseIsPressed){
x = lerp(x,mouseX,0.1)
y = lerp(y,mouseY,0.1)
}
// line(0,0,px,py)
// line(0,0,x,y)
// // fill(255)
// text(sec,x+random(-50,50),y)
// let ll = dist(mouseX,mouseY,pmouseX,pmouseY)
// stroke(255,map(ll,0,100,0,255,true)*2)
// line(pmouseX,pmouseY,mouseX,mouseY)
// strokeWeight(1)
// // stroke(0)
// line(x,y,mouseX,mouseY)
// line(x,y,pmouseX,pmouseY)
// ellipse(mouseX, mouseY, 20, 20);
}