- /
-
timeless 80s
on 17 Oct 2024
- 34
- 276
- 0
- 4
- 1215
Cite your audio source here (if applicable): https://www.youtube.com/watch?v=9GMjH1nR0ds
drawframe(1);
Write your drawframe function below
%this is a remake of my 2023 animation called "timeless 80s"
%https://www.mathworks.com/matlabcentral/communitycontests/contests/6/entries/15779
function drawframe(f)
figure('Color','k');
%Creating the Disco ball
syms phi theta
r = 3;
x = r*sin(phi)*cos(theta);
y = r*sin(phi)*sin(theta);
z = r*cos(phi);
sp = fsurf(x,y,z+6,[0 pi f 2*pi+f], 'edgecolor', [192,192,192]/255)
hold on;
%Black Walls
[u v] = meshgrid(-10:1:10); % Generate x and y data
w = zeros(size(u, 2)); % Generate z data
c = [0 0 0]
p1 = surf(u, v, w-10, FaceC=c,EdgeC='m')
p2 = surf(w+10, u, v, FaceC=c,EdgeC='n')
p3 = surf(v, w+10, u, FaceC=c,EdgeC='n')
%Lights, many lights
if 48>=f
light("Style","local","Position",[8 8 -30+f*2], 'Color', 'g');
light("Style","local","Position",[8 8 30-f*2], 'Color', 'y');
light("Style","local","Position",[f 10 -5], 'Color', 'm');
light("Style","local","Position",[10 f -5], 'Color', 'm');
light("Style","local","Position",[30-f*2 -30+f*2 -5], 'Color', 'w');
else
light("Style","local","Position",[8 8 163-f*2], 'Color', 'g');
light("Style","local","Position",[8 8 -163+f*2], 'Color', 'y');
light("Style","local","Position",[97-f 10 -5], 'Color', 'm');
light("Style","local","Position",[10 97-f -5], 'Color', 'm');
light("Style","local","Position",[-163+f*2 163-f*2 -5], 'Color', 'w');
end
S = randi([-10, 10], 1, 20)
T = randi([-10, 10], 1, 20)
U = randi([-10, 10], 1, 20)
l2 = scatter3(U,T,S,"o",'MarkerFaceColor',[1, 1, 0],'MarkerEdgeColor','n', 'MarkerFaceAlpha',.3);
axis equal off
camzoom(2)
view([-37.5 20])
colormap(white);
end