• Remix
  • Share
  • New Entry

  • Jr

  • /
  • flying away from Matzilla!

on 19 Nov 2023
  • 20
  • 25
  • 1
  • 0
  • 789
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*[.1 .7 1],'EdgeColor','n');
end
%Using emojis and moving them with our parameter "f" as well:
if 24>=f
ht=text(380+f,670+f,'🛩','color','black','FontSize',60);
else
ht=text(405+(25-f),695+(25-f),'🛩','color','black','FontSize',60);
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*[.1 .8 0],'EdgeColor','n');
end
%final adjustments for plotting.
axis off;
ylim([200,n])
end
Animation
Remix Tree