MATLAB GIF版 烟花程序
根据slandarer 大神编写的2023版烟花MATLAB程序,本人做了两个工作:
1、把slandarer 大神编写的2023版烟花程序稍微改写并做了比较详细的注解,以便大家学习;
2、把slandarer 大神编写的2023版烟花程序改编成GIF版本,生成了GIF动画.
感谢slandarer 的原创工作及无私的分享!
程序运行产生的GIF图
链接:
代码详解
去博客设置页面,选择一款你喜欢的代码片高亮样式,下面展示同样高亮的 代码片
.
function Fireworks_gif2023
% @authorship : slandarer,@adapted gif version:武成汉都
% 本程序经MATLAB R2021a运行通过
%############################
% 坐标区域初始化及修饰
fig=gcf;hold on;ax=gca;
set(ax,'XLim',[0,20],'YLim',[0,20],'XColor','none',...
'YColor','none','Color',[0,0,0]);
%'XColor','none':不显示X轴刻度线及刻度值
%'Color',[0,0,0]:轴范围的背景色设置为黑色,显示夜空
%############################
%===============================
%此部分控制坐标区布局,可以去掉
outerpos = ax.OuterPosition;
ti = ax.TightInset;
left = outerpos(1) + 0.5*ti(1); bottom = outerpos(2) + 0.5*ti(2);
ax_width = outerpos(3) - ti(1); ax_height = outerpos(4) - ti(2);
ax.Position = [left bottom ax_width ax_height];
%==================================
text(ax,8,5,'新年愉快!','Color','red','FontSize',28);
text(ax,15,0.5,'@author:slandarer,武成汉都','Color','white'