• /
• # timeless 80s

on 30 Nov 2023
• 22
• 125
• 0
• 5
• 1908
function drawframe(f)
figure('Color','k');
%Creating the Disco ball
syms phi theta
r = 4;
x = r*sin(phi)*cos(theta);
y = r*sin(phi)*sin(theta);
z = r*cos(phi);
sp = fsurf(x,y,z,[0 pi f/2 2*pi+f/2], 'edgecolor', [192,192,192]/255)
hold on;
%Add the cylindrical lights
r = linspace(0,6*pi) ;
th = linspace(0,6*pi) ;
[R,T] = meshgrid(r,th) ;
M = R.*cos(T) ;
N = R.*sin(T) ;
O = -R ;
s = surf(M/8-2,N/7+2,O+10,'EdgeColor','n','FaceAlpha',.3)
g = surf(M/8-1,N/7+1,O+10,'EdgeColor','n','FaceAlpha',.3)
dir1 = [0 1 0];
dir2 = [1 0 0];
%Animating the cylindrical lights/moving them
if f<4
rotate(s,dir1,45)
rotate(g,dir1,-25)
elseif f<8
rotate(s,dir1,-45)
elseif f<12
rotate(s,dir2,35)
rotate(g,dir2,-25)
elseif f<16
rotate(s,dir2,-30)
elseif f<20
rotate(s,dir1,-25)
elseif f<24
rotate(s,dir1,35)
elseif f<28
rotate(s,dir1,-40)
rotate(g,dir1, 30)
elseif f<32
rotate(s,dir2,25)
elseif f<36
rotate(s,dir1,45)
elseif f<40
rotate(s,dir1,-15)
elseif f<44
rotate(s,dir2,-25)
rotate(g,dir2,25)
elseif f<48
rotate(s,dir2,35)
end
%creating some random circles = colorful (l1) and golden (l2)
S = randi([-10, 10], 1, 20)
T = randi([-10, 10], 1, 20)
U = randi([-10, 10], 1, 20)
V = randi([500, 2000], 1, 20)
K = randi([30, 100], 1, 20)
c = [0 1 0; 1 0 0; 0.5 0.5 0.5; 0.6 0 1; 1 0 1; 0 1 0; 1 0 0; 0.5 0.5 0.5; 0.6 0 1; 1 0 1;
0 1 0; 1 0 0; 0.5 0.5 0.5; 0.6 0 1; 1 0 1; 0 1 0; 1 0 0; 0.5 0.5 0.5; 0.6 0 1; 1 0 1];
l1 = scatter3(S,T,U,V,c,'filled','MarkerFaceAlpha',.5)
l2 = scatter3(U,T,S,K,"o",'filled','MarkerFaceColor',[255, 215, 0]/255,'MarkerEdgeColor','n', 'MarkerFaceAlpha',.3);
axis equal off
xlim([-4.5,4.5])
ylim([-4.5,4.5])
zlim([-4.5,4.5])
colormap(white);
view([65,15]);
%Placing some beautiful lights on the sphere and
%making them move while we cry on the dance floor and immortalize moments :'-)
%I'm not from the 70s or 80s but I love music from that times especially ABBA and Roxette!
if 24>=f
light("Style","local","Position",[-10 -10 f], 'Color', 'g');
light("Style","infinite","Position",[-10 -30 -f], 'Color', 'r');
light("Style","local","Position",[10 f*2 5], 'Color', 'w');
light("Style","infinite","Position",[f f*2 0], 'Color', 'm');
else
light("Style","local","Position",[-10 -10 49-f], 'Color', 'g');
light("Style","infinite","Position",[-10 -30 -f], 'Color', 'r');
light("Style","local","Position",[10 97-f*2 5], 'Color', 'w');
light("Style","infinite","Position",[49-f 97-f*2 0], 'Color', 'm');
end
end
Jr