• Remix
  • Share
  • New Entry

  • Harish

  • /
  • Mathworks Logo animation

on 10 Oct 2024
  • 39
  • 278
  • 0
  • 0
  • 908
Cite your audio source here (if applicable):
drawframe(1);
Write your drawframe function below
function drawframe(f)
N = 100;
L = 160 * membrane(1, N);
numFrames = 96;
persistent fig ax s
if isempty(fig)
fig = figure('Color', 'black');
ax = axes('Parent', fig);
s = surface(L);
s.EdgeColor = 'none';
% Set axis limits
ax.XLim = [1 201];
ax.YLim = [1 201];
ax.ZLim = [-53.4 160];
ax.CameraPosition = [-10 -20 -20];
ax.CameraTarget = [77.4/2 60.2/2 63.9/2];
ax.CameraUpVector = [0 0 1];
ax.CameraViewAngle = 36.7;
ax.Position = [0 0 1 1];
ax.DataAspectRatio = [1 1 .9];
% Lighting setup
l1 = light;
l1.Position = [160 400 80];
l1.Style = 'local';
l1.Color = [0 0.8 0.8];
l2 = light;
l2.Position = [.5 -1 .4];
l2.Color = [0.8 0.8 0];
% Surface properties
s.FaceColor = [0.9 0.2 0.2];
s.FaceLighting = 'gouraud';
s.AmbientStrength = 0.3;
s.DiffuseStrength = 0.6;
s.BackFaceLighting = 'lit';
s.SpecularStrength = 1;
s.SpecularColorReflectance = 1;
s.SpecularExponent = 7;
axis off;
end
% Interpolating the Z values from 0 to actual values and back
Z = zeros(size(L)); % Start with zeros
finalZ = L; % Final Z values (the actual values of the logo)
% Calculate interpolation factor based on the frame number
if f <= numFrames / 2
alpha = f / (numFrames / 2); % Progression from 0 to 1
else
alpha = (numFrames - f) / (numFrames / 2); % Progression from 1 to 0
end
% Update Z data for the surface based on the interpolation factor
Z = alpha * finalZ;
% Update the surface Z data
s.ZData = Z;
% Adjust view
view(3);
drawnow;
end
Movie
Audio
Remix Tree