C语言动画程序源码
- 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
- 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
- 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。
C语言动画程序
#include <>
#include <>
#include <>
#include <>
#define pi
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 y,int x1,int y1);
char buf();
main()
{
double m=;
double xo=,yo=,a1=,t1=pi;
double xc=xo+m*a1,yc=yo;
double a2=,a3,a4=,a5=,a6=,a7=;
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=,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(10,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(); mybutton(500,10,"EXIT",1,7); mouseshow(); exit(0); }
if(buf()==56)
for(i=0;i<10000;i++){
switch (buf()){
case 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);
run:
drawjijia(xo,yo,1);
drawjijia(xc,yc,1);
drawjijia(xo1,yo1,1);
drawjijia(xc1,yc1,1);
setwritemode(1);
do{
for(i=0;i<;i+=
{
t2=i;
a3=ca3mm1(a1*cos(t1)+a2*cos(t2*pi/,a1*sin(t1)+a2*sin(t2*pi/);
t3=ca3fm1(a1*cos(t1)+a2*cos(t2*pi/,a1*sin(t1)+a2*sin(t2*pi/);
a4=a3;
t4=t3;
t5=ca5fm2(a6,a5,a4,t4,0);
t6=ca6fm2(a4,t4,a5,t5);
t7=;
l1=xc1-xc-2*m*a7*cos(t7*pi/180);
nt=(asin(l1/2/(n/2))*180/pi);
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,LIGHTGRAY);
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,L IGHTGRAY);
drawline1(xc1,yc1,a6,t6,m,LIGHTGRAY);
drawline1(xc1,yc1,a7,t7,m,LIGHTGRAY);
for(j=-1;j<20;j++)
{ drawline(xc+m*a7*cos(t7*pi/180),(yc-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/180)),n ,nt,,GREEN);
drawline1(xc1-m*a7*cos(t7*pi/180),(yc1-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/180)), n,nt,,DARKGRAY);
}
delay(300);
drawline(xo,yo,a2,t2,m,LIGHTGRAY);
drawline(xo+m*a2*cos(t2*pi/,yo-m*a2*sin(t2*pi/,a5,t5,m,LIGHTGRAY);
drawline(xc,yc,a6,t6,m,LIGHTGRAY);
drawline(xc,yc,a7,t7,m,LIGHTGRAY);
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,L IGHTGRAY);
drawline1(xc1,yc1,a6,t6,m,LIGHTGRAY);
drawline1(xc1,yc1,a7,t7,m,LIGHTGRAY);
for(j=-1;j<20;j++)
{ drawline(xc+m*a7*cos(t7*pi/180),(yc-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/180)),n ,nt,,GREEN);
drawline1(xc1-m*a7*cos(t7*pi/180),(yc1-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/180)), n,nt,,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); }
if(buf()==56)
for(k=0;k<10000;k++){
switch (buf()){
case 18:{