資源描述:
《C語言動畫程序源碼》由會員上傳分享,免費(fèi)在線閱讀,更多相關(guān)內(nèi)容在行業(yè)資料-天天文庫。
1、C語言動畫程序#include#include#include#include#definepi3.1415926535doubleca3mm1(doublem1,doublem2);doubleca3fm1(doublecosine,doublesine);doubleca5fm2(doublea6m,doublea5m,doublea4m,doublea4f,intshang);doubleca6fm2(doublea4m,doublea4f,doublea
2、5m,doublea5f);charinbox(intx,inty,intx1,inty1);charbuf();main(){doublem=3.0;doublexo=100.0,yo=200.0,a1=30.0,t1=pi;doublexc=xo+m*a1,yc=yo;doublea2=8.0,a3,a4=25.0,a5=30.0,a6=20.0,a7=35.0;doublet2,t3,t4,t5,t6,t7;doublexo1=xo+m*150,yo1=yo;doublexc1=xo1-m*a1,yc1=yo1;doublei
3、,j,k;doublel1;doublen=116.1,nt;initscreen();setfillstyle(SOLID_FILL,DARKGRAY);bar(0,0,640,480);mybutton(10,10,"BEGIN",1,0);mybutton(500,10,"EXIT",1,0);line(0,69,640,69);mouseinit();changemousecross();setmousexy(320,20);mouseshow();setmousearea(0,0,640,60);do{if(inbox(1
4、0,10,70,26)&&button()==1){mousehide();mybutton(10,10,"BEGIN",0,0);mouseshow();mousehold();mousehide();mybutton(10,10,"BEGIN",1,7);mouseshow();break;}if(inbox(500,10,555,26)&&button()==1){mousehide();mybutton(500,10,"EXIT",0,0);mouseshow();mousehold();mousehide();mybutt
5、on(500,10,"EXIT",1,7);mouseshow();exit(0);}if(buf()==56)for(i=0;i<10000;i++){switch(buf()){case18:{mousehide();mybutton(500,10,"EXIT",0,0);mouseshow();delay(4000);mousehide();mybutton(500,10,"EXIT",1,7);mouseshow();exit(0);}case48:{mousehide();mybutton(10,10,"BEGIN",0,
6、0);mouseshow();delay(4000);mousehide();mybutton(10,10,"BEGIN",1,7);mouseshow();gotorun;}default:break;}}}while(1);run:drawjijia(xo,yo,1);drawjijia(xc,yc,1);drawjijia(xo1,yo1,1);drawjijia(xc1,yc1,1);setwritemode(1);do{for(i=0;i<360.0;i+=1.0){t2=i;a3=ca3mm1(a1*cos(t1)+a2
7、*cos(t2*pi/180.0),a1*sin(t1)+a2*sin(t2*pi/180.0));t3=ca3fm1(a1*cos(t1)+a2*cos(t2*pi/180.0),a1*sin(t1)+a2*sin(t2*pi/180.0));a4=a3;t4=t3;t5=ca5fm2(a6,a5,a4,t4,0);t6=ca6fm2(a4,t4,a5,t5);t7=t6-90.0;l1=xc1-xc-2*m*a7*cos(t7*pi/180);nt=(asin(l1/2/(n/2))*180/pi)-90.0;drawline(
8、xo,yo,a2,t2,m,LIGHTGRAY);drawline(xo+m*a2*cos(t2*pi/180),yo-m*a2*sin(t2*pi/180),a5,t5,m,LIGHTGRAY);drawline(xc,yc,a6,