• Remix
  • Share
  • New Entry

on 14 Nov 2023
  • 12
  • 40
  • 1
  • 0
  • 425
drawframe(48);
Write your drawframe function below
function drawframe(f)
cla
axis([-2 2 -2 2]);
axis equal;
t=0:0.01:2*pi;
sigmoid = 1 / (1 + exp(-0.2*(f - 24)));
% Face
x=1 * cos(t);
y=1 * sin(t) + 0.5;
fill(x,y,'y');
hold on;
x = 0.4 * cos(t);
y = -0.5 - sigmoid * 0.4 * sin(t) + 0.6;
fill(x, y, 'k');
% Eyes
x_eye = 0.2 * cos(t);
y_eye = 0.2 * sin(t) + 0.9;
fill(x_eye - 0.3, y_eye, 'w'); % Left eye, white part
fill(x_eye + 0.3, y_eye, 'w'); % Right eye, white part
x_eye = 0.1 * cos(t);
y_eye = 0.1 * sin(t) + 0.9;
fill(x_eye - 0.3, y_eye, 'k'); %Left eye, black part
fill(x_eye + 0.3, y_eye, 'k');
axis off
hold off
end
Animation
Remix Tree