- /
-
NOOO!!! Matzilla hit us!!
on 19 Nov 2023
- 18
- 57
- 0
- 3
- 780
drawframe(1);
Write your drawframe function below
%well, I made this just by changing (again) my previous code. The
%process is the same:
% 1. We make layers of the blue sky;
% 2. We add emojis up and down (it's funny to control the movement of them)
% 3. We make layers of green mountains;
function drawframe(f)
c=1200;
d=700;
n=800;
m=.37;
hold on;
%Making the sky:
for i=15:-1:13
y=i/11*d;
a=20*m^(i-1);
u=c*(1-(i-1)/8);
x=linspace(0,c,n);
p=y/d*4*pi;
t=x*2*pi/u;
q=sin(f/4+.3*t)+sin(f/8+.2*t);
r=y+q+cumsum(sqrt(a)*randn(1,n));+3.2^(i-1);
v=[
x' r';
c 0;
0 0];
fill(v(:,1),v(:,2),i/18*[.7 .7 .7],'EdgeColor','n');
end
%Using emojis and moving them with our parameter "f" as well:
ht=text(380-(f*5),670-(f*5),'🛩','color','black','FontSize',40);
if f>=38
ht=text(50,500,'🔥','color','r','FontSize',80);
end
hc=text(10+f*2,660,'☁','color','w','FontSize',20);
ic=text(450+f*4,780,'☁','color','w','FontSize',30);
kc=text(850+f*3.5,610,'☁','color','w','FontSize',50);
%Making the mountains
for i=9:-1:4
y=i/11*d;
a=170*m^(i-1);
u=c*(1-(i-1)/8);
x=linspace(0,c,n);
p=y/d*4*pi;
t=x*2*pi/u;
q=sin(f/2+.3*t)+sin(f/8+.2*t);
r=y+q+cumsum(sqrt(a)*randn(1,n));+3.2^(i-1); %unlike the previous code,
%here there is a random/noisy component to make it look like grass/earth
v=[
x' r';
c 0;
0 0];
fill(v(:,1),v(:,2),i/18*[216 171 100]/255,'EdgeColor','n');
end
%final adjustments for plotting.
axis off;
ylim([200,n])
end