• Remix
  • Share
  • New Entry

on 17 Nov 2023
  • 9
  • 19
  • 0
  • 1
  • 275
drawframe(5);
colors = 25×3
0.1111 0 0 0.2222 0 0 0.3333 0 0 0.4444 0 0 0.5556 0 0 0.6667 0 0 0.7778 0 0 0.8889 0 0 1.0000 0 0 1.0000 0.1111 0
Remix ideas
  • Change the circles to squares or another shape
  • Do something more interesting with color
  • Reverse the direction of movement
Write your drawframe function below
function drawframe(f)
set(gca,'Position',[0 0 1 1]) % Enlarge axes
set(gcf,'Color','k') % Set fig color to black
r = (49-f) + -45:10:200; % Radii of circles
r(r<2) = 2; % Remove small and negative radii
th = linspace(0,2*pi,300).';
x = r.*cos(th); % x values of all circles
y = r.*sin(th); % y values of all circles
colors = hot(25) % RGB color matrix
h = plot(x,y,'LineWidth',3); % Plot circles
axis equal
for i = 1:numel(h)
h(i).Color = colors(i,:); % Assign color to each line
end
xlim([-100 100])
ylim([-100 100])
axis off
end
Animation
Remix Tree