- /
-
rotating RGB
on 29 Nov 2023
- 9
- 192
- 1
- 2
- 732
drawframe(1);
Write your drawframe function below
function drawframe(f)
% i gotta figure out how to make the colors add so if the red and blue
% circles overlap i get magenta, etc. :/
close
circ = @(cx, cy, r) [cx + r * sind(0:1:360);
cy + r * cosd(0:1:360)];
rt = @(th) [cosd(th) -sind(th);
sind(th) cosd(th)];
c1 = (circ(2.5,0,2)'*rt(180*f/48))';
c2 = (circ(2.5,0,2)'*rt(180*f/24))';
c3 = (circ(2.5,0,2)'*rt(180*f/12))';
fa = 0.7*sind(f*180/48)^2 + 0.05;
patch(c1(1,:), c1(2,:), [1 0 0], 'FaceAlpha', fa, 'EdgeAlpha', 0)
patch(-c1(1,:), -c1(2,:), [1 0 0], 'FaceAlpha', fa, 'EdgeAlpha', 0)
patch(c2(1,:), c2(2,:), [0 1 0], 'FaceAlpha', fa, 'EdgeAlpha', 0)
patch(-c2(1,:), -c2(2,:), [0 1 0], 'FaceAlpha', fa, 'EdgeAlpha', 0)
patch(c3(1,:), c3(2,:), [0 0 1], 'FaceAlpha', fa, 'EdgeAlpha', 0)
patch(-c3(1,:), -c3(2,:), [0 0 1], 'FaceAlpha', fa, 'EdgeAlpha', 0)
xlim([-5 5]); ylim([-5 5]);
xticks([]); xticklabels([]);
yticks([]); yticklabels([]);
end