• Remix
  • Share
  • New Entry

on 11 Oct 2024
  • 15
  • 149
  • 0
  • 2
  • 709
% Music: https://pixabay.com/music/beats-lofi-chill-medium-version-159456/
drawframe(1)
function drawframe(f)
% Clear the figure and set up the plot
clf; hold on
axis equal
axis off
box on
colormap autumn
% Compute the oak leaf shape
base_t = 0:0.01:pi;
base_x = .01*cos(base_t).^9.*cos(5*base_t).^10 + sin(2*base_t)/4.*(1 - sin(10*base_t).^2/2).*(1 - (cos(base_t).*cos(3*base_t)).^8);
base_y = sin(base_t).*(1 - sin(10*base_t).^2/5.*(.5 + sin(2*base_t).^2)) - .5;
% Draw a bunch of randomly placed, scaled, and colored leaves
for i = 1:100
% Generate random scaling factor for leaf size (between 0.5 and 1.5)
scale_factor = 0.5 + rand();
x = base_x * scale_factor;
y = base_y * scale_factor;
% Randomly perturb the shape slightly to add more uniqueness
x = x + (rand(size(x)) - 0.5) * 0.02; % Small random perturbation in x
y = y + (rand(size(y)) - 0.5) * 0.02; % Small random perturbation in y
% Random position and rotation
x_shift = rand() * 5;
y_shift = rand() * 5 - f * 0.05; % Shift leaves down over time
rotation_angle = rand() * 360;
% Random color (autumn-like colors)
leaf_color = [0.5 + 0.5*rand(), 0.25 + 0.5*rand(), 0]; % Shades of orange/brown
% Draw the leaf with random position, rotation, and color
leaf = fill(x_shift + x, y_shift + y, leaf_color, 'FaceAlpha', 0.7, 'LineWidth', 1);
rotate(leaf, [0 0 1], rotation_angle);
end
% Style
hold off
drawnow
end
Movie
Audio
Remix Tree