- /
-
2/2 - Sunset
on 23 Oct 2024
- 21
- 205
- 0
- 1
- 318
Cite your audio source here (if applicable):
drawframe(1);
Write your drawframe function below
%1 - Dawn
%This animation combines some things I like:
%1. The song "Sunset" by The Midnight;
%2. 'synthwave" by Adam Danz (2022):
%https://www.mathworks.com/matlabcentral/communitycontests/contests/5/entries/10510
%3. The scenery matches the lyrics of the song: dawn/sunset + car leaving
function drawframe(f)
% Set up axes
c=[.2 .1 .2]
axes(Color=c,CameraP=[0,2,-7],CameraT=[0,1,8],Pr='p')
hold
% Rocky surface
% This is an inverted super-gaussian + noise
% www.mathworks.com/matlabcentral/answers/575647#answer_475645
x=meshgrid(-9:.7:9);
s=-2.2*exp(-(x.^2/4).^2)+2.1;
surf(x,s.*rand(26),x',FaceC=c,EdgeC='k')
% Set equal aspect ratio
axis equal
% Sun
t=0:.1:6;
fill3(2.5*cos(t),2.5*sin(t)+1-(f/60),0*t+9,'y')
%Car
text(.25,1,-3+(f/700),'🚘','color','black','FontSize',90,Col=c);
% Add lighting
light(Po=[0,9,30],Col='y')
camlight
end