- /
-
Sea Weed, in gentle current...
on 17 Nov 2023
- 13
- 126
- 0
- 2
- 1238
drawframe(1);
Write your drawframe function below
function drawframe(f)
seaweed(4)
% Try in a for-loop for k values greater, or at least equal, to 7 (here is used: seaweed(4)) ...
% That, is beutifull... animation has timed-out for posting...
function seaweed(k)
figure('Position',[60+2*f,60-2*f,600,600]);
crta([0,0],90,k,k);
axis equal
axis off
function crta(tck,ugao,prstiter,r)
sir=5*(prstiter/r);
duz1=5*prstiter;
ug1=ugao+15+(f/15);
ug2=ugao+7-f/15;
ug3=ugao-7+f/15;
ug4=ugao-15-f/15;
a1=duz1*sind(ug1)+tck(2);
b1=duz1*cosd(ug1)+tck(1);
c2=duz1*sind(ug2)+tck(2);
a2=duz1*cosd(ug2)+tck(1);
b3=duz1*sind(ug3)+tck(2);
c3=duz1*cosd(ug3)+tck(1);
d4=duz1*sind(ug4)+tck(2);
e4=duz1*cosd(ug4)+tck(1);
uga1=ug2-5+f/5;
ugb2=ug3+5-f/5;
uga2=duz1/2*sind(uga1)+c2+f/20;
ugb3=duz1/2*cosd(uga1)+a2-f/20;
ugc2=duz1/2*sind(ugb2)+b3+f/20;
ugda1=duz1/2*cosd(ugb2)+c3-f/20;
boja=[1-(prstiter/r) 1-0.5*(prstiter/r) 0];
p1=plot([tck(1),b1],[tck(2),a1],'LineWidth',sir,'Color',boja);
hold on
s2=plot([tck(1),a2],[tck(2),c2],'LineWidth',sir,'Color',boja);
s3=plot([tck(1),c3],[tck(2),b3],'LineWidth',sir,'Color',boja);
s4=plot([tck(1),e4],[tck(2),d4],'LineWidth',sir,'Color',boja);
s5=plot([a2,ugb3],[c2,uga2],'LineWidth',sir,'Color',boja);
s6=plot([c3,ugda1],[b3,ugc2],'LineWidth',sir,'Color',boja);
s1.Color(4)=0.95;
s2.Color(4)=0.95;
s3.Color(4)=0.95;
s4.Color(4)=0.95;
s5.Color(4)=0.95;
s6.Color(4)=0.95;
if prstiter-1>0
crta([b1,a1],ug1,prstiter-1,r);
crta([ugb3,uga2],uga1,prstiter-1,r);
crta([ugda1,ugc2],ugb2,prstiter-1,r);
crta([e4,d4],ug4,prstiter-1,r);
end
end
end
end