C语言动画程序源码.doc

上传人:scccc 文档编号:11493231 上传时间:2021-08-09 格式:DOC 页数:11 大小:16.98KB
返回 下载 相关 举报
C语言动画程序源码.doc_第1页
第1页 / 共11页
C语言动画程序源码.doc_第2页
第2页 / 共11页
C语言动画程序源码.doc_第3页
第3页 / 共11页
C语言动画程序源码.doc_第4页
第4页 / 共11页
C语言动画程序源码.doc_第5页
第5页 / 共11页
点击查看更多>>
资源描述

《C语言动画程序源码.doc》由会员分享,可在线阅读,更多相关《C语言动画程序源码.doc(11页珍藏版)》请在三一文库上搜索。

1、 C语言动画程序 #include #include #include #include #define pi 3.1415926535 double ca3mm1(double m1,double m2); double ca3fm1(double cosine,double sine); double ca5fm2(double a6m,double a5m,double a4m,double a4f,int shang); double ca6fm2(double a4m ,double a4f,double a5m , double a5f); char inbox(int x,int

2、 y,int x1,int y1); char buf(); main() double m=3.0; double xo=100.0,yo=200.0,a1=30.0,t1=pi; double xc=xo+m*a1,yc=yo; double a2=8.0,a3,a4=25.0,a5=30.0,a6=20.0,a7=35.0; double t2,t3,t4,t5,t6,t7; double xo1=xo+m*150,yo1=yo; double xc1=xo1-m*a1,yc1=yo1; double i,j,k; double l1; double n=116.1,nt; initsc

3、reen(); 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(10,10,70,26)&button()=1) mousehide(); mybutton(10,10,BEGIN,0,0

4、); 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(); mybutton(500,10,EXIT,1,7); mouseshow(); exit(0); if(buf()=56) for(i=0;i10000;i+) switch (buf() c

5、ase 18: mousehide(); mybutton(500,10,EXIT,0,0); mouseshow(); delay(4000); mousehide(); mybutton(500,10,EXIT,1,7); mouseshow(); exit(0); case 48: mousehide(); mybutton(10,10,BEGIN,0,0); mouseshow(); delay(4000); mousehide(); mybutton(10,10,BEGIN,1,7); mouseshow(); goto run; default:break; while(1); r

6、un: drawjijia(xo,yo,1); drawjijia(xc,yc,1); drawjijia(xo1,yo1,1); drawjijia(xc1,yc1,1); setwritemode(1); do for(i=0;i360.0;i+=1.0) t2=i; a3=ca3mm1(a1*cos(t1)+a2*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=

7、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(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,t6,m,LIGHTGRAY); drawline(xc,yc,a7,t7,m,LIGHTG

8、RAY); drawline1(xo1,yo1,a2,t2,m,LIGHTGRAY); drawline1(xo1+m*a2*cos(180-t2)*pi/180),yo1-m*a2*sin(180-t2)*pi/180),a5,t5,m,LIGHTGRAY); drawline1(xc1,yc1,a6,t6,m,LIGHTGRAY); drawline1(xc1,yc1,a7,t7,m,LIGHTGRAY); for(j=-1;j20;j+) drawline(xc+m*a7*cos(t7*pi/180),(yc-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/180),

9、n,nt,1.0,GREEN); drawline1(xc1-m*a7*cos(t7*pi/180),(yc1-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/180),n,nt,1.0,DARKGRAY); delay(300); drawline(xo,yo,a2,t2,m,LIGHTGRAY); drawline(xo+m*a2*cos(t2*pi/180.0),yo-m*a2*sin(t2*pi/180.0),a5,t5,m,LIGHTGRAY); drawline(xc,yc,a6,t6,m,LIGHTGRAY); drawline(xc,yc,a7,t7,m,L

10、IGHTGRAY); drawline1(xo1,yo1,a2,t2,m,LIGHTGRAY); drawline1(xo1+m*a2*cos(180-t2)*pi/180),yo1-m*a2*sin(180-t2)*pi/180),a5,t5,m,LIGHTGRAY); drawline1(xc1,yc1,a6,t6,m,LIGHTGRAY); drawline1(xc1,yc1,a7,t7,m,LIGHTGRAY); for(j=-1;j20;j+) drawline(xc+m*a7*cos(t7*pi/180),(yc-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/

11、180),n,nt,1.0,GREEN); drawline1(xc1-m*a7*cos(t7*pi/180),(yc1-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/180),n,nt,1.0,DARKGRAY); setwritemode(0); if(inbox(500,10,555,26)&button()=1) mousehide(); mybutton(500,10,EXIT,0,0); mouseshow(); mousehold(); mousehide(); mybutton(500,10,EXIT,1,7); mouseshow(); exit(0);

12、 if(buf()=56) for(k=0;k 0 & cosine 0) temp = atan(sine / cosine) * 180 / pi; if (sine 0 & cosine 0) temp = (atan(sine / cosine) + pi) * 180 / pi; if (sine 0 & cosine 0) temp = (atan(sine / cosine) + pi) * 180 / pi; if (sine 0) temp = (atan(sine / cosine) + 2 * pi) * 180 / pi; return(temp); double ca

13、5fm2(double a6m,double a5m,double a4m,double a4f,int shang) double temp,sine1,cosine1; cosine1 = (a6m *a6m - a4m *a4m - a5m*a5m) / (2 * a4m * a5m); sine1 = sqrt(1 - cosine1 *cosine1); if (shang=0) sine1 = sine1*(-1); if (sine1 0 & cosine1 0) temp = a4f + (atan(sine1 / cosine1) * 180 / pi); if (sine1

14、 0 & cosine1 0) temp = a4f + (atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 0 & cosine1 0) temp = a4f + (atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 0) temp = a4f + (atan(sine1 / cosine1) + 2 * pi) * 180 / pi); return(temp); double ca6fm2(double a4m ,double a4f,double a5m , double a5f) d

15、ouble temp,sine1,cosine1; sine1 = a4m * sin(a4f * pi / 180) + a5m * sin(a5f * pi / 180); cosine1 = a4m * cos(a4f * pi / 180) + a5m * cos(a5f * pi / 180); if (sine1 0 & cosine1 0) temp = (atan(sine1 / cosine1) * 180 / pi); if (sine1 0 & cosine1 0) temp = (atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 0 & cosine1 0) temp = (atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 0) temp = (atan(sine1 / cosine1) + 2 * pi) * 180 / pi); return(temp); initscreen() int gd=DETECT,gm; registerbgidriver(EGAVGA_driver); initgraph(&gd,&gm,); (注:专业文档是经验性极强的领域,无法思考和涵盖全面,素材和资料部分来自网络,供参考。可复制、编制,期待你的好评与关注)

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 社会民生


经营许可证编号:宁ICP备18001539号-1