- /
-
Fractal colorful star
on 16 Oct 2021
- 44
- 156
- 0
- 0
- 251
figure('color','k','render','painters')
axis equal off
for i=0:20:360
rotate(0,0,i,7)
end
function rotate(x1,y1,t,d)
x2=x1+sind(t)*d;
y2=y1+cosd(t)*d;
if d~=0
line([x1 x2],[y1 y2],'color',rand(3,1),'LineWidth',2);
rotate(x2,y2,t+20,d-1);
rotate(x2,y2,t-20,d-1);
end
end