Animation bei Processing
(EN google-translate)
(PL google-translate)
Als Beispiel soll ein roter Kreis auf einer Kreisbahn gleiten. Eine Umdrehung soll er in 10 Sekunden schaffen.
Bild 0-1: Screenshot des Processing-Fensters.
float phi=0.0;
float x=0.0;
float y=0.0;
void setup()
{
size(500,500);
frameRate(36);
}
void draw()
{
x = 250.0+200.0*cos(phi);
y = 250.0+200.0*sin(phi);
background(0,0,255);
stroke(0,0,0);
noFill();
ellipse(250,250,400,400);
fill(255,0,0);
noStroke();
ellipse((int)x,(int)y,100,100);
phi+=(2.0*PI)/360.0;
}
Code 0-1: Animation eines reoten Kreises.