RosettaCodeData/Task/Polyspiral/Zkl/polyspiral.zkl
2023-07-01 13:44:08 -04:00

19 lines
609 B
Text

w,h:=640,640;
bitmap:=PPM(w,h,0xFF|FF|FF); // White background
angleIncrement:=(3.0).toRad();
while(True){
r,angle:=0.0, 0.0;
ao,len,inc:=w/2, 2.5, angleIncrement+(130.0).toRad();
foreach c in (128){
s,a:=r + len, angle + inc;
x,y:=r.toRectangular(angle);
u,v:=r.toRectangular(a);
c=c.shiftLeft(21) + c.shiftLeft(10) + c*8; // convert c to a RGB
bitmap.line(ao+x,ao+y, ao+u,ao+v, c);
r,angle=s,a;
}
bitmap.writeJPGFile("polyspiral.zkl.jpg");
bitmap.fill(0xFF|FF|FF); // White background
angleIncrement=(angleIncrement + 0.05);
Atomic.sleep(3);
}