- /
-
a car in driving
on 11 Nov 2023
- 6
- 20
- 1
- 0
- 877
drawframe(1);
Write your drawframe function below
function drawframe(f)
cla
t=f/40;
a=0.3+t;
b=0.7+t;
patch('Faces',[1 2 3 4],'Vertices',[0+t 0; 1+t 0; 0.9+t 0.3; 0.1+t 0.3],'FaceColor','k');
patch('Faces',[1 2 3 4],'Vertices',[0.25+t 0.3; 0.75+t 0.3; 0.7+t 0.5; 0.3+t 0.5],'FaceColor','k');
patch('Faces',[1 2 3 4],'Vertices',[0.35+t 0.35; 0.48+t 0.35; 0.48+t 0.45; 0.37+t 0.45],'FaceColor','w');
patch('Faces',[1 2 3 4],'Vertices',[0.52+t 0.35; 0.65+t 0.35; 0.63+t 0.45; 0.52+t 0.45],'FaceColor','w');
hold on
plot(a, 0,'wo','markersize',23,'linewidth',5)
plot(b, 0,'wo','markersize',23,'linewidth',5)
plot(a, 0,'ko','markersize',20,'linewidth',2,'MarkerFaceColor','k')
plot(b, 0,'ko','markersize',20,'linewidth',2,'MarkerFaceColor','k')
plot(a, 0,'wo','markersize',10,'linewidth',2,'MarkerFaceColor','w')
plot(b, 0,'wo','markersize',10,'linewidth',2,'MarkerFaceColor','w')
plot([0 3],[-0.2 -0.2],'-','color',[0.7 0.7 0.7],'linewidth',20)
xlim([0 3])
ylim([-1 1])
axis off
end