Polyspiral: Difference between revisions
Content added Content deleted
(Polyspiral in FreeBASIC) |
(Added Processing implementation) |
||
Line 1,969: | Line 1,969: | ||
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span> |
<span style="color: #008080;">end</span> <span style="color: #008080;">if</span> |
||
<!--</lang>--> |
<!--</lang>--> |
||
=={{header|Processing}}== |
|||
{{trans|C}} |
|||
<lang java> |
|||
//Aamrun, 2nd July 2022 |
|||
int incr = 0, angle, i, length; |
|||
float x,y,x1,y1; |
|||
double factor = PI/180; |
|||
void setup() { |
|||
size(1000, 1000); |
|||
stroke(255); |
|||
} |
|||
void draw() { |
|||
background(51); |
|||
incr = (incr + 5)%360; |
|||
x = width/2; |
|||
y = height/2; |
|||
length = 5; |
|||
angle = incr; |
|||
for(i=1;i<=150;i++){ |
|||
x1 = x + (float)(length*Math.cos(factor*angle)); |
|||
y1 = y + (float)(length*Math.sin(factor*angle)); |
|||
line(x,y,x1,y1); |
|||
length += 3; |
|||
angle = (angle + incr)%360; |
|||
x = x1; |
|||
y = y1; |
|||
} |
|||
} |
|||
</lang> |
|||
=={{header|Python}}== |
=={{header|Python}}== |