- /
-
Screensaver '95
on 30 Oct 2024
- 29
- 150
- 0
- 2
- 1790
Cite your audio source here (if applicable):
drawframe(1);
Write your drawframe function below
function drawframe(f)
L = 0.5; % side length
F = 4; % frame length
nP = 96; % # Frames
W = pi/(nP/2); Y = pi/(nP/3);
S = @(a) sin(a); C = @(a) cos(a);
Rt = @(a) [C(a),-S(a),0;S(a),C(a),0;0,0,1]*[C(a),0,S(a);0,1,0;-S(a),0,C(a)]*[C(a),-S(a),0;S(a),C(a),0;0,0,1];
G = figure(1);
f2 = [-1 -1 -1;1 -1 -1;1 1 -1;-1 1 -1;-1 -1 1;1 -1 1;1 1 1;-1 1 1];
f3 = [0 0 -1;0 1 0;0 0 1;0 -1 0;-1 0 0;1 0 0];
tx = @(r,s,p) (r*s' + p')';
A1 = [1,2,3,4;4,8,7,3;5,8,7,6;1,5,6,2;1,5,8,4;6,7,3,2];
B1 = [1,5,4;4,5,3;3,5,2;2,5,1;3,4,6;6,3,2;2,6,1;1,4,6];
C1 = [6,3,8;7,2,4;3,8,1;2,7,5;3,8,1;4,2,5;1,3,6;7,4,5]; C1a = [7 3 2 6 4 1 5 8];
C2 = [4,5,2;1,8,6;5,4,7;8,1,5;5,2,7;6,8,3;7,2,4;1,6,3]; C2a = [1 5 8 4 6 7 3 2];
m = 'rgcmybrg';
q1 = 'EdgeColor'; q2 = 'MarkerFaceColor'; q3 = 'MarkerSize';
xl = F*1.4*[-1,1];
nCk = 9;
clf; hold on
t = f+15;
I = mod(t,nP);
w = I*W;
R = Rt(w);
P = [S(w), 0, S(w*2)]*F;
u = mod(t,32)*Y;
fb = f2*L/2*S(u); fc = f3*L*C(u);
tb = tx(R,fb,P); tc = tx(R,fc,P);
for j = 1:6
A = A1(j,:);
fill3(tb(A,1),tb(A,2),tb(A,3),m(j),q1,m(j));
end
axis equal;
xlim(xl);ylim(xl);zlim(xl);
CA = G.CurrentAxes;
CA.XTick=[];CA.YTick=[];CA.ZTick=[];
Q = 'none'; CA.XColor=Q;CA.YColor=Q;CA.ZColor=Q;
CA.Position = [0 0 1 1]; CA.Color=[0 0 0];
view(0,0);
U = ceil(t/16);
u2 = mod(ceil((t+1)/16),2);
if u2 == 1 % swap colors
m2 = 'cmrgbycm'; m3 = 'brgymrgc';
else
m2 = m; m3 = m;
end
switch U
case {2,3}
for k = 1:nCk
K = (nCk+1-k)/nCk;
tc = tx(R,fc*K,P);
mk = 4 + 12*K*(abs(C(u))+1);
for j = 1:6
plot3(tc(j,1),tc(j,2),tc(j,3),[m2(j),'o'], q2, m2(j), q3, mk);
end
end
case {6,7}
tc = tx(R,fc*1.5,P); te = tx(R,fb*.9,P);
for j = 1:8
A = B1(j,:); A = [A, A(1)]; AA = C1(j,:); Ap = C1a(j);
if U == 7
AA = C2(j,:); Ap = C2a(j);
end
PP = te(Ap,:);
for k = 1:3
td = [PP; te(AA(k),:); tc(A(k),:)]; fill3(td(:,1),td(:,2),td(:,3),m3(A(k)),q1,Q);
td(3,:) = tc(A(k+1),:); fill3(td(:,1),td(:,2),td(:,3),m3(A(k+1)),q1,Q);
end
end
otherwise
for j = 1:8
A = B1(j,:);
fill3(tc(A,1),tc(A,2),tc(A,3),m3(j),q1,m3(j));
end
end
end
Movie
Audio
This submission does not have audio.