代码简简单单,其他的工作就交给三角函数和电脑吧。
动画截图:
float sita;
float x;
void setup()
{
fullScreen();
background(0);
sita = 0.0;
frameRate(20);
strokeWeight(0.8);
}
void draw()
{
noFill();
stroke(
255 * random(0,1),
255 * random(0,1),
255 * random(0,1),50
);
translate(width/2,height/2);
x = 300 * tan(sita);
ellipse(x,0,2*x,2*x);
sita += 0.1;
if (sita >= TWO_PI / 2)
{
sita = 0;
background(0);
}