|
Post by David Drake on Feb 26, 2020 14:33:55 GMT -5
I created the code below as a solution for the Rosetta Code task "Sunflower fractal" ( rosettacode.org/wiki/Sunflower_fractal). It came with pretty much zero constraints, so I adapted code from several contributions and ended up with the product below. I look forward to seeing your suggestions. nomainwin UpperLeftX=1:UpperLeftY=1 WindowWidth=800:WindowHeight=600 open "Sunflower Fractal" for graphics_nf_nsb as #1 #1 "trapclose [q];down;fill darkred;flush;size 3"
c=1.618033988749895 seeds=8000 rd=gn=bl=int(rnd(1)*255)
for i=0 to seeds rd=rd+5:if rd>254 then rd=1 gn=gn+3:if gn>254 then gn=1 bl=bl+1:if bl>254 then bl=1 #1 "color ";rd;" ";gn;" ";bl #1 "backcolor ";rd;" ";gn;" ";bl r=(i^c)/seeds angle=2*3.14159*c*i x=r*sin(angle)+400 y=r*cos(angle)+280 #1 "place ";x;" ";y #1 "circlefilled ";i/seeds*5 scan next i wait
[q] close #1 end
|
|
|
Post by David Drake on Mar 2, 2020 7:00:35 GMT -5
Haven't received any feedback on this one. Unless there are some comments or corrections, I plan to post this to Rosetta Code later today.
|
|
|
Post by tsh73 on Mar 2, 2020 8:44:01 GMT -5
It looks really nice.
|
|