105



float x = 33;
float y = 5;
float velocity = 0.0;//速力
float radius = 15.0;//直径
float friction = 0.999;//摩擦
float acceleration = 0.3;//加速

void setup(){
size(100,100);
smooth();
noStroke();
ellipseMode(RADIUS);
}

void draw(){
fill(0,12);
rect(0,0,width,height);
fill(255);
velocity += acceleration;
velocity *= friction;
y += velocity;
if(y > (height-radius)){
y = height - radius;
velocity = -velocity;
}
ellipse(x,y,radius,radius);
}

コメント