• Remix
  • Share
  • New Entry

on 7 Nov 2023
  • 4
  • 26
  • 0
  • 1
  • 316
drawframe(12);
Write your drawframe function below
function drawframe(f)
% Define the polygon vertices
vertices = [1 0; 0.809 0.588; 0.309 0.951; -0.309 0.951];
num_frames = 48;
% Create a figure
figure;
% Calculate the new positions of the vertices
new_vertices = vertices * [
cos(2*pi*(f-1)/num_frames) -sin(2*pi*(f-1)/num_frames);
sin(2*pi*(f-1)/num_frames) cos(2*pi*(f-1)/num_frames)
];
% Plot the polygon
plot(new_vertices(:,1), new_vertices(:,2), 'o-', 'LineWidth', 1);
axis([-1.2 1.2 -1.2 1.2]);
axis off;
drawnow;
end
Animation
Remix Tree