• Remix
  • Share
  • New Entry

on 9 Nov 2023
  • 11
  • 49
  • 2
  • 0
  • 360
drawframe(1);
Write your drawframe function below
function drawframe(f)
% Background plot
figure
axis([0 1 0 1]);
axis equal;
axis off
% Falling string
s = 'MATLAB';
% define the frames
frames = 48;
t = 1:frames; % define frame vector
% compute x
x = -0.2:0.5/frames:0.3;
x = t/frames * .5 - 0.2;
% compute y
y = 1 - 0.5 * ((t * 10)/frames).^8;
y = .5 + y / 10^8;
% compute rotation
a = (y - .5) * 180;
% draw the letters
for i=1:length(s)
index = i * 4 + f;
if index <= 48
text( x(index) + .08 * i, y(index), s(i), ...
'Rotation', a(index), ...
'FontSize', 24, ...
'Color', [47, 126, 178]/255);
end
end
end
Animation
Remix Tree