MATLAB爱好者论坛-LabFans.com

MATLAB爱好者论坛-LabFans.com (https://www.labfans.com/bbs/index.php)
-   MATLAB论坛 (https://www.labfans.com/bbs/forumdisplay.php?f=6)
-   -   【文章】仿真动画软件设计作品--模拟台球比赛 (https://www.labfans.com/bbs/showthread.php?t=953)

yesman 2007-12-11 16:28

【文章】仿真动画软件设计作品--模拟台球比赛
 
axis([-1.6,12.6,-1.6,10.7])
hold on
fill([-2,13,13,-2],[-2,-2,11,11],[0,1,0]);
fill([-1,12,12,-1],[-1,-1,10,10],[0,0.5,0]);
ball1=line(0,5,'color','r','marker','.','erasemode','xor','markersize',60);
ball2=line(8,9,'color','g','marker','.','erasemode','xor','markersize',60);
ball3=line(-1,-1,'color','g','marker','.','erasemode','xor','markersize',80);
ball4=line(12,-1,'color','g','marker','.','erasemode','xor','markersize',80);
ball3=line(-1,10,'color','g','marker','.','erasemode','xor','markersize',80);
ball4=line(12,10,'color','g','marker','.','erasemode','xor','markersize',80);
title('完全非弹碰在模拟台球比赛的应用', 'color','r','fontsize',15);
pause(1)
t=0;dt=0.005;
while t<7.2
t=t+dt;
y=1/2*t+5;
set(ball1,'xdata',t,'ydata',y)
drawnow;
end
while t<8.8
t=t+dt;
y=1/2*t+5;
set(ball2,'xdata',t,'ydata',y)
drawnow;
end
while t<11.5
t=t+dt;
y=-1/2*t+14.3;
set(ball2,'xdata',t,'ydata',y)
drawnow;
end
while t>-0.5
t=t-dt;
y=1/2*t+2.90;
set(ball2,'xdata',t,'ydata',y)
drawnow;
end
while t<6
t=t+dt;
y=-1/2*t+2.40;
set(ball2,'xdata',t,'ydata',y)
drawnow;
end
while t<11.5
t=t+dt;
y=1/2*t-3.0;
set(ball2,'xdata',t,'ydata',y)
drawnow;
end
while t>-2
t=t-dt;
y=-t*7.65/12.9+9.57;
set(ball2,'xdata',t,'ydata',y)
drawnow;
end
text(2,5,'好!进球了啊!!!恭喜!','fontsize',16,'color','r');

2006年4月11日发表在《麓瑜园》
(注:本文转自转自《麓瑜园》,版权归原作者所有!在此仅作交流讨论之用,如需转载请注明原作者!)

tqr591513792 2008-01-03 13:24

这个程序应该在我那板块也要
 
希望可以借鉴

暮流 2009-04-14 10:54

回复: 【文章】仿真动画软件设计作品--模拟台球比赛
 
不错啊,效果很好,可以学习


所有时间均为北京时间。现在的时间是 06:31

Powered by vBulletin
版权所有 ©2000 - 2025,Jelsoft Enterprises Ltd.