• Remix
  • Share
  • New Entry

on 20 Nov 2023
  • 8
  • 15
  • 0
  • 0
  • 685
drawframe(1);
Warning: Error updating Text.

String scalar or character vector must have valid interpreter syntax:
^
Write your drawframe function below
function drawframe(f)
persistent r
n=15;
if isempty(r)
r=randn(n,2).*[.01 .01];
end
if 1==rem(f,4)
cla
rr = rand*0.005;
rectangle('Position',[.5-(.3+rr)/2 .6 .3+rr .3+rr],'Curvature',[1 1],'FaceColor',[.8+rand*.1 0 0],'EdgeColor','none')
hold on
x = cosd(linspace(180, 0, n))*0.3+.5;
y = abs(linspace(-1, 1, n))*0.2+.4;
dwn = randperm(n,4+randi(4));
for i=1:n
m='v'; extra = 0;
if any(i==dwn)
m = '^';
extra = rand/40;
end
text(x(i)+r(i,1),y(i)+r(i,2)+extra,m,'Color','w','fontsize',8+abs(x(i)-0.5)*12,'hor','center');
end
set(gca,'color',hsv2rgb([randi([0 10])/360 .3 1]), 'XColor','none','YColor','none')
rectangle('Position',[0 0 1 .3],'FaceColor',hsv2rgb([(randi([0 10])+336)/360 .7 .9]),'EdgeColor','none')
axis equal
axis([0 1 0 1])
end
end
Animation
Remix Tree