• Remix
  • Share
  • New Entry

on 19 Nov 2023
  • 6
  • 8
  • 0
  • 0
  • 881
drawframe(1);
Write your drawframe function below
function drawframe(f)
[x, y] = meshgrid(-5:0.1:5, -5:0.1:5);
numClouds = 7;
cloudAltitude = 8; %
rng(1,"twister");
for i = 1:numClouds
cloudSize = rand * 1 + 1;
[cloudX, cloudY, cloudZ] = sphere(20);
cloudX = cloudX * cloudSize + rand * 10 - 5;
cloudY = cloudY * cloudSize + rand * 10 - 5;
cloudZ = cloudZ * cloudSize + cloudAltitude;
surf(cloudX, cloudY, cloudZ, 'FaceColor', [0.8 0.8 0.8], 'EdgeColor', 'none');
hold on
end
mountain = peaks(x, y);
ocean = zeros(size(mountain));
ocean_color = rand(size(ocean, 1), size(ocean, 2), 3);
surf(x, y, mountain, 'FaceColor', 'interp', 'EdgeColor', 'none');
hold on;
colormap(copper)
surf(x, y, ocean, ocean_color, 'EdgeColor', 'none');
rng(1,"twister");
numBirds = 10;
birdAltitude = 5;
birdX = rand(1, numBirds) * 10 - 5 ;
birdY = rand(1, numBirds) * 10 - 5 ;
birdZ = ones(1, numBirds) * birdAltitude;
scatter3(birdX+f/50, birdY+f/50, birdZ+f/75, 5, 'kv', 'filled');
axis([-5 5 -5 5 0 10])
view(30, 30);
axis off
end
Animation
Remix Tree