• Remix
  • Share
  • New Entry

  • Greg

  • /
  • Christmas Tree

on 15 Nov 2023
  • 18
  • 43
  • 0
  • 0
  • 278
drawframe(1);
Current plot held
Write your drawframe function below
function drawframe(f)
persistent t u
if f<2
n=203;
x=linspace(0,6*pi,n);
s=linspace(1,0,n);
y=sin(x).*s;
r=1:2:n;
hold
plot(y,x,'g',-y,x,'g');
c=repmat((1:6)',17,1);
colormap(prism(6));
t=scatter(y(r),x(r),81,c,'fi','h');
u=scatter(-y(r),x(r),81,c,'fi','h');
end
t.CData=circshift(t.CData,1,1);
u.CData=circshift(u.CData,-1,1);
end
Animation
Remix Tree