• Remix
  • Share
  • New Entry

on 30 Nov 2023
  • 9
  • 33
  • 0
  • 1
  • 401
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 = 'GRAVITY';
% 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 + 4*i , ...
'Color', [mod(47*i,255), mod(126*i,255), mod(178*i,255)]/255);
end
end
end
Animation
Remix Tree