xxxxxxxxxx
function setup() {
createCanvas(windowWidth, windowHeight);
background(100);
}
//generative art gif
var r = 0
var x = 50, y= 50
var vx = 3, vy = 3
var txt = "Hello"
function draw() {
// background(0)
// print(5==110)
if (mouseIsPressed){
fill('red')
}else{
fill('yellow')
}
ellipse(x, y, 50);
text(txt,x+100,y)
txt = txt+"."
x = x+vx
y = y+vy
vy += 0.2
//反彈
if (y>height){
vy = -vy*0.5
y=height
}
}