• Remix
  • Share
  • New Entry

on 22 Oct 2024
  • 60
  • 429
  • 0
  • 4
  • 1983
Cite your audio source here (if applicable): 一支榴莲 - 海底.wav
for i = 1:90, drawframe(i); end
Write your drawframe function below
function drawframe(f)
persistent M V R T D rT dH N
if f == 1
V=[ -.016,.822; -.074,.809; -.114,.781; -.147,.738; -.149,.687; -.150,.630;
-.157,.554; -.166,.482; -.176,.425; -.208,.368; -.237,.298; -.284,.216;
-.317,.143; -.338,.091; -.362,.037;-.382,-.006;-.420,-.051;-.460,-.084;
-.477,-.110;-.430,-.103;-.387,-.084;-.352,-.065;-.317,-.060;-.300,-.082;
-.331,-.139;-.359,-.201;-.385,-.262;-.415,-.342;-.451,-.418;-.494,-.510;
-.533,-.599;-.569,-.675;-.607,-.753;-.647,-.829;-.689,-.932;-.699,-.988;
-.639,-.905;-.581,-.809;-.534,-.717;-.489,-.642;-.442,-.543;-.393,-.447;
-.339,-.362;-.295,-.296;-.251,-.251;-.206,-.241;-.183,-.281;-.175,-.350;
-.156,-.434;-.136,-.521;-.128,-.594;-.103,-.677;-.083,-.739;-.067,-.813;-.039,-.852];
V=[0,.82;V;V(end:-1:1,:).*[-1,1];0,.82];
V=V-mean(V,1);
F=1:size(V,1);
Y=V(:,2);
Y=(Y-min(Y))./(max(Y)-min(Y));
N=60;
R=sin(linspace(pi/4,5*pi/6,N))./1.2;
R=[R',R'];R(1,:)=[1,1];
R(5,:)=[2,.6];
R(10,:)=[3.7,.4];
R(15,:)=[1.8,.6];
T=[zeros(N,1),ones(N,1)];
M=zeros(N,2);
D=M;
rT=@(Mat,t)Mat*[cos(t),sin(t);-sin(t),cos(t)];
C=[68,231,197;211,102,88;38,52,95]./255;
C1=C(2,:)+Y.*(C(1,:)-C(2,:));
C2=C(3,:)+Y.*(C(1,:)-C(3,:));
hold on
set(gca,'Color','k','DataAspectRatio',[1,1,1],'Position',[0,0,1,1],'YTick',[]);
axis([-5,5,-5,5])
FV='FaceVertexCData';
FC={FV,C1,'FaceAlpha',.7};
dH(1)=patch('Faces',F,'Vertices',V-[2,0],FV,C1,'FaceColor','interp','EdgeColor','none','FaceAlpha',.95);
for i=2:N
dH(i)=patch('Faces',F,'Vertices',V.*R(i,:)-[2,i./2.5-.3],FV,C2,'FaceColor','interp','EdgeColor','none',FC{3:4});
end
set(dH(5),FC{:})
set(dH(10),FC{:})
set(dH(15),FC{:})
for i=N:-1:1,uistack(dH(i),'top');end
for i=1:N
M(i,:)=mean(get(dH(i),'Vertices'),1);
end
D=diff(M(:,2));
else
t=f/96*4*pi;r=10*(1-cos(t));
Pos=[r*cos(t).*2*((f>48)-.5),-r*sin(t).*1.5] + [2,0];
Dir=Pos-M(1,:);
Dir=Dir./norm(Dir);
T=(T(1:end,:)+[Dir;T(1:end-1,:)])./2;
T=T./(vecnorm(T')');
theta=atan2(T(:,2),T(:,1))-pi/2;
M(1,:)=M(1,:)+(Pos-M(1,:))./80;
M(2:end,:)=M(1,:)+[cumsum(D.*T(2:end,1)),cumsum(D.*T(2:end,2))];
for ii=1:N
set(dH(ii),'Vertices',rT(V.*R(ii,:),theta(ii))+M(ii,:))
end
end
end
Movie
Audio
Remix Tree