• Remix
  • Share
  • New Entry

on 12 Nov 2023
  • 18
  • 71
  • 0
  • 2
  • 482
function drawframe(ff)
% get a clean frame
figure
% draw the gosts
f=0.1;
t=0:f^2:2*pi;
r=pi/4;
p=r*t+r;
c=eye(3);
for a=2:2:6
patch([t/4+a,a+r*(1+cos(t/2)),a],[-f*cos(3*(a+t))-r,r*sin(t/2),-1],c(a/2,:));
patch(a+f*cos(t)'+r./[1,0.65],f*(2+sin(t)').*[1,1],'k','EdgeColor','w','LineWidth',pi)
end
% covering the gosts
rectangle('Position', [-1 -1 4*ff/24+1 2], 'FaceColor', 'k', 'EdgeColor', 'none')
% draw pacman while toggling the mouth opening
mouth = mod(ff, 5) * 10;
theta = linspace(40-mouth, 320+mouth, 100);
x = [0, cosd(theta), 0];
y = [0, sind(theta), 0];
patch(x+4*ff/24, y, 'y');
% configure the axis
xlim([-1 9])
axis equal off
set(gcf,'color','k')
end
Animation
Remix Tree