- /
-
When you realize you're late for diner because of this contest
on 15 Nov 2023
- 20
- 35
- 0
- 0
- 473
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;
c = [1, 1-f/60, 0];
fill(x,y,c);
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+f/600) * cos(t);
y_eye = (0.2+f/600) * 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+f/480) * cos(t);
y_eye = (0.1+f/480) * 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