• Remix
  • Share
  • New Entry

  • Safin

  • /
  • Solar System Close View

on 14 Oct 2024
  • 75
  • 335
  • 0
  • 0
  • 556
Cite your audio source here (if applicable):
drawframe(1);
Write your drawframe function below
function drawframe(f)
clf;
hold on;
axis equal;
axis([-1.5 1.5 -1.5 1.5]);
% Sun at the center
plot(0, 0, 'yo', 'MarkerSize', 30, 'MarkerFaceColor', 'yellow');
% Parameters for planets
numPlanets = 5;
radii = linspace(0.3, 1.2, numPlanets);
speeds = ones(1, numPlanets);
colors = lines(numPlanets);
% Animate planets
for i = 1:numPlanets
angle = 2 * pi * (f / 96);
x = radii(i) * cos(angle);
y = radii(i) * sin(angle);
plot(x, y, 'o', 'MarkerSize', 10, 'MarkerFaceColor', colors(i, :));
theta = linspace(0, 2*pi, 100);
plot(radii(i) * cos(theta), radii(i) * sin(theta), '--', 'Color', [0.8, 0.8, 0.8]);
end
set(gca, 'Color', 'k', 'XColor', 'none', 'YColor', 'none');
hold off;
end
Movie
Audio
Remix Tree