• Remix
  • Share
  • New Entry

on 20 Nov 2023
  • 12
  • 22
  • 0
  • 1
  • 1964
drawframe(1);
Write your drawframe function below
function drawframe(f)
a=randn(1000, 3300, 3);
b=zeros(1000, 3300, 3);
sX=240;
sL=300;
sY=400;
b(sY+(0:200),sX+[0:60,240:300],1)=1;
for idx=60:150
y=idx+340;
b(y:y+60,sX+idx,1)=1;
y=-idx+550;
b(y:y+60,sX+90+idx,1)=1;
end
for idx=0:140
y=floor(-1.8*idx+600);
b(y:y+110,sX+sL+30+idx,1)=1;
y=floor(1.8*idx+348);
b(y:y+110,sX+sL+30+140+idx,1)=1;
end
b(sY+(0:40),sX+2*(sL+10)+(0:260),1)=1;
b(sY+(0:200),sX+2*(sL+10)+(100:160), 1)=1;
b(sY+(0:200),sX+3*(sL+10)+[0:60, 200:260],1)=1;
b(sY+(80:120),sX+3*(sL+10)+(0:260),1)=1;
gap = sX+4*(sL+10);
b(sY+(0:200), gap+[0:60,240:300],1)=1;
for idx = 60:150
y = -idx+598;
b(y:y+60, gap+idx, 1) = 1;
y = idx+390;
b(y:y+60, gap+90+idx, 1) = 1;
end
% O
gap = sX+5*(sL+16);
b(sY+(40:160), gap+[0:60, 200:260], 1) = 1;
b(sY+[0:40 160:200], gap+(40:220), 1) = 1;
for idx = 0:40
y1 = floor((1600-idx^2)^0.5);
y2 = 40-floor((1600-idx^2)^0.5);
b(sY+y2+(0:40), gap+40-idx, 1) = 1;
b(sY+y2+(0:40), gap+220+idx, 1) = 1;
b(sY+160+(0:y1), gap+40-idx, 1) = 1;
b(sY+160+(0:y1), gap+220+idx, 1) = 1;
end
% R
gap = sX+6*(sL+14);
b(sY+(0:200), gap+(0:60), 1) = 1;
b(sY+(40:80), gap+(200:260), 1) = 1;
b(sY+[0:40 80:120], gap+(0:220), 1) = 1;
for idx = 0:40
y1 = floor((1600-idx^2)^0.5);
y2 = 40-floor((1600-idx^2)^0.5);
b(sY+(y2:40), gap+220+idx, 1) = 1;
b(sY+80+(0:y1), gap+220+idx, 1) = 1;
end
for idx = 0:80
y = idx+120;
b(sY+y, gap+100+idx+(0:80), 1) = 1;
end
% K
gap = sX+7*(sL+14);
b(sY+(0:200), gap+(0:60), 1) = 1;
for idx = 0:200
y = floor(-0.7*idx+120);
b(sY+y+(-50:0), gap+60+idx, 1) = 1;
if idx>10
y = floor(0.9*idx+85);
b(sY+y+(-50:0), gap+80+idx, 1) = 1;
end
end
% S
gap = sX+8*(sL+10);
b(sY+(1:40), gap+(41:260), 1) = 1;
b(sY+(81:120), gap+(41:220), 1) = 1;
b(sY+(161:200), gap+(1:220), 1) = 1;
b(sY+(41:80), gap+(1:60), 1) = 1;
b(sY+(121:160), gap+(201:260), 1) = 1;
for idx = 0:40
y1 = floor((1600-idx^2)^0.5);
y2 = 40-floor((1600-idx^2)^0.5);
b(sY+(y2:40), gap+40-idx, 1) = 1;
b(sY+80+(1:y1), gap+40-idx, 1) = 1;
b(sY+80+(y2:40), gap+220+idx, 1) = 1;
b(sY+160+(0:y1), gap+220+idx, 1) = 1;
end
b([1:400, 600:1000], :, 1) = 0;
frameNum = mod(f,49);
b = ((48-frameNum).*a + frameNum.*b)/48;
imagesc(b)
axis equal
axis off
end
Animation
Remix Tree