- /
-
RedWell (Don't stare at it)
on 17 Nov 2023
- 9
- 20
- 0
- 1
- 275
drawframe(5);
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
