Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- % 创建 MATLAB 徽标
- close all
- L = 160*membrane(1,100);
- f = figure;f.MenuBar='none';f.Color = 'black';
- dpi=1.25;scr=[1920 1080];res=[1600 1000];
- fig=gcf;fig.Position=[(scr-res)/2,res]/dpi;
- p=[-145.5 -229.7];
- t=[77.4 60.2];
- pt=norm(p-t);
- p1=-123;
- p2=t(2)-sqrt(pt^2-(p(1)-t(1))^2);
- %% Left
- ax1 = axes;
- s1 = surface(ax1,L);
- s1.EdgeColor = 'none';
- view(3)
- ax1.Clipping='off';
- ax1.XLim = [1 201];
- ax1.YLim = [1 201];
- ax1.ZLim = [-53.4 160];
- ax1.CameraPosition = [-145.5 -229.7 283.6];
- ax1.CameraTarget = [77.4 60.2 63.9];
- ax1.CameraUpVector = [0 0 1];
- ax1.CameraViewAngle = 36.7;
- ax1.Position = [0 0 0.5 1];
- ax1.DataAspectRatio = [1 1 .9];
- 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];
- s1.FaceColor = [0.9 0.2 0.2];
- s1.FaceLighting = 'gouraud';
- s1.AmbientStrength = 0.3;
- s1.DiffuseStrength = 0.6;
- s1.BackFaceLighting = 'lit';
- s1.SpecularStrength = 1;
- s1.SpecularColorReflectance = 1;
- s1.SpecularExponent = 7;
- axis off
- %% Right
- ax2 = axes;
- s2 = surface(ax2,L);
- s2.EdgeColor = 'none';
- view(3)
- ax2.Clipping='off';
- ax2.XLim = [1 201];
- ax2.YLim = [1 201];
- ax2.ZLim = [-53.4 160];
- ax2.CameraPosition = [p1 p2 283.6];
- ax2.CameraTarget = [77.4 60.2 63.9];
- ax2.CameraUpVector = [0 0 1];
- ax2.CameraViewAngle = 36.7;
- ax2.Position = [0.5 0 0.5 1];
- ax2.DataAspectRatio = [1 1 .9];
- 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];
- s2.FaceColor = [0.9 0.2 0.2];
- s2.FaceLighting = 'gouraud';
- s2.AmbientStrength = 0.3;
- s2.DiffuseStrength = 0.6;
- s2.BackFaceLighting = 'lit';
- s2.SpecularStrength = 1;
- s2.SpecularColorReflectance = 1;
- s2.SpecularExponent = 7;
- axis off
- %% 动画
- T=12;% 旋转一周时间
- fps=60; %帧率
- TT=3*T*fps; %总帧数
- da=360/T/fps;% 一帧旋转的角度
- mv = 0;% 是否录制视频,1录制,其它不录制
- if mv == 1
- v = VideoWriter('D:\Programs\MATLAB\MATLAB-logo-LR.mp4','MPEG-4');
- v.Quality = 100;v.FrameRate = 60;
- open(v);
- end
- for ii=1:TT
- rotate(s1,[0 0 1],da)
- rotate(s2,[0 0 1],da)
- pause(1/fps)
- drawnow
- if mv==1;F=getframe(fig);writeVideo(v,F);end
- end
- if mv == 1;close(v);end
Add Comment
Please, Sign In to add comment