- /
-
Summer and Autumn Leaves
on 20 Oct 2024
- 10
- 83
- 0
- 0
- 846
Cite your audio source here (if applicable): Autumn SKY - Piano Lofi Lidérc
drawframe(1);
Write your drawframe function below
function drawframe(f)
% Leaf Shape
t=0:0.01:1.1*pi;
scaling_factor_leaf = 1/0.9;
x = scaling_factor_leaf.*(0.01*cos(t).^9.*cos(5*t).^10 + sin(2*t)/4.*(1-sin(10*t).^2/2).*(1-(cos(t).*cos(3*t)).^8));
y = scaling_factor_leaf.*(sin(t).*(1-sin(10*t).^2/5.*(0.5+sin(2*t).^2))-0.5);
plot3(0, 0, 0);
hold on
Line_Width = 1.2;
for i = 1:20
rotate(fill(rand()*5+x,rand()*5+y,rand(),'LineWidth', Line_Width), [0 0 1], rand()*360)
end
% Tree Truck
[x_Truck, y_Truck, z_Truck] = cylinder(0.3, 150); % unit cylinder
plot3(x_Truck, y_Truck, z_Truck*4, 'Color', [0.4, 0.2, 0.1]);
% Tree Canopy
[x_Canopy, y_Canopy, z_Canopy] = sphere(300); % unit sphere.
x = 1.5*x_Canopy*2; % Scale x
y = 1.5*y_Canopy*2; % Scale y
z = z_Canopy*2 + 6; % Scale z
plot3(x, y, z, 'Color', [0.75, 0.25, 0]);
% Ground
[x, z] = meshgrid(-4:0.02:8.5);
plot3(x-0.1, z-0.1, zeros(size(x, 1))-0.1, 'Color', [0.8 0.6 0.4]) % Plot the surface
summer_and_autumn = [summer(10); autumn(10)];
colormap(summer_and_autumn(1:15, :))
view([120, 1, 120])
axis equal
axis off
hold off
drawnow
end