• Remix
  • Share
  • New Entry

on 21 Nov 2023
  • 17
  • 21
  • 0
  • 1
  • 961
drawframe(1);
Write your drawframe function below
function drawframe(f)
persistent P0 Po P1Hdl P2Hdl P3Hdl PoHdl
if f==1
ax=gca;hold on
ax.Position=[0,0,1,1];
ax.DataAspectRatio=[1 1 1];
ax.XLim=[0,1];
ax.YLim=[0,1];
ax.XColor='none';
ax.YColor='none';
P0=[0.08 0.28;0.36 0.65;0.91 0.23;0.92 0.63];
P1=P0(1:3,:); P2=P1(1:2,:); P3=P2(1,:); Po=P3;
plot(P0(:,1),P0(:,2),'Color',[0,0,0,.7],'LineWidth',3,'Marker','o','MarkerSize',7,'MarkerFaceColor',[0,0,0])
cprop={'LineWidth',3,'Marker','o','MarkerSize',7,'MarkerFaceColor',[1,1,1]};
PoHdl=plot(Po(:,1),Po(:,2),'Color',[.8,0,0,.5],'LineWidth',3);
P1Hdl=plot(P1(:,1),P1(:,2),'Color',[0,0,.8,.6],cprop{:});
P2Hdl=plot(P2(:,1),P2(:,2),'Color',[0,0,.8,.6],cprop{:});
P3Hdl=plot(P3(:,1),P3(:,2),'Color',[0,0,.8,.6],cprop{:});
end
P1=P0(1:3,:)+f.*(P0(2:4,:)-P0(1:3,:))./48;
P2=P1(1:2,:)+f.*(P1(2:3,:)-P1(1:2,:))./48;
P3=P2(1,:)+f.*(P2(2,:)-P2(1,:))./48;
Po=[Po;P3];
P1Hdl.XData=P1(:,1); P1Hdl.YData=P1(:,2);
P2Hdl.XData=P2(:,1); P2Hdl.YData=P2(:,2);
P3Hdl.XData=P3(:,1); P3Hdl.YData=P3(:,2);
PoHdl.XData=Po(:,1); PoHdl.YData=Po(:,2);
end
Animation
Remix Tree