- /
-
Swirly threads
on 8 Nov 2023
- 9
- 23
- 3
- 1
- 454
drawframe(1);
Write your drawframe function below
function drawframe(f)
cla
x = linspace(0,4*pi,200);
nLines = 12;
theta = 2*pi*(1:nLines)/nLines;
hgtRoot = hgtransform;
hgt = zeros(1,nLines);
for i = 1:nLines
hgt(i) = hgtransform(Parent=hgtRoot);
y = 1/3*x.*tan(x+i/2);
line(x,y,Parent=hgt(i),Color="red",LineWidth=2);
R = makehgtform('zrotate', theta(i));
set(hgt(i),Matrix=R)
end
axis equal
axis off
grid on
axis(12*[-1 1 -1 1])
alpha = interp1([0 48],[0 48*2*pi/nLines],f)
R = makehgtform('zrotate', alpha);
set(hgtRoot,Matrix=R)
set(gcf,Color="black")
end