C語(yǔ)言動(dòng)畫程序源碼

上傳人:優(yōu)*** 文檔編號(hào):62449746 上傳時(shí)間:2022-03-14 格式:DOCX 頁(yè)數(shù):6 大?。?2.63KB
收藏 版權(quán)申訴 舉報(bào) 下載
C語(yǔ)言動(dòng)畫程序源碼_第1頁(yè)
第1頁(yè) / 共6頁(yè)
C語(yǔ)言動(dòng)畫程序源碼_第2頁(yè)
第2頁(yè) / 共6頁(yè)
C語(yǔ)言動(dòng)畫程序源碼_第3頁(yè)
第3頁(yè) / 共6頁(yè)

下載文檔到電腦,查找使用更方便

0 積分

下載資源

還剩頁(yè)未讀,繼續(xù)閱讀

資源描述:

《C語(yǔ)言動(dòng)畫程序源碼》由會(huì)員分享,可在線閱讀,更多相關(guān)《C語(yǔ)言動(dòng)畫程序源碼(6頁(yè)珍藏版)》請(qǐng)?jiān)谘b配圖網(wǎng)上搜索。

1、 C語(yǔ)言動(dòng)畫程序 #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

2、a4m ,double a4f,double a5m , double a5f); char inbox(int x,int 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,y

3、o1=yo; double xc1=xo1-m*a1,yc1=yo1; double i,j,k; double l1; double n=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,

4、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; } 整理為word格式 if(inbox(500,10,555,26)&&button()==1) {mousehide(); mybu

5、tton(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,"EXI

6、T",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); draw

7、jijia(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*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; 整理為word格式 t5=ca5fm2(

8、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,t

9、7,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,LIGHTGRAY); 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

10、*pi/180)-j*n*sin(nt*pi/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); } 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,

11、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,LIGHTGRAY); drawline1(xc1,yc1,a6,t6,m,LIGHTGRAY); drawline1(xc1,yc1,a7,t7,m,LIGHTGRAY); for(j=-1;j<20;j++) { drawli

12、ne(xc+m*a7*cos(t7*pi/180),(yc-m*a7*sin(t7*pi/180)-j*n*sin(nt*pi/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); mous

13、eshow(); mousehold(); mousehide(); mybutton(500,10,"EXIT",1,7); mouseshow(); exit(0); } if(buf()==56) for(k=0;k<10000;k++){ switch (buf()){ case 18:{ 整理為word格式 mousehide(); mybutton(500,10,"EXIT",0,0); mouseshow(); delay(4000); mousehide(); mybutton(500,10,"EXIT",1,7); mouse

14、show(); exit(0); } default:break; } } setwritemode(1); } }while(1); } drawline(double xo,double yo,double mo,double fujiao,double m,int color) { double x,y; x=(xo+m*mo*cos(fujiao*pi/180)); y=(yo-m*mo*sin(fujiao*pi/180)); setcolor(color); line (xo,yo,x,y); } drawli

15、ne1(double xo,double yo,double mo,double fujiao,double m,int color) { double x,y; x=(xo-m*mo*cos(fujiao*pi/180)); y=(yo-m*mo*sin(fujiao*pi/180)); setcolor(color); line (xo,yo,x,y); } drawjijia(double x,double y,int shang) { setcolor(RED); if (shang==1){ circle(x,y,3); line(

16、x-3.0,y+3.0,x-15.0,y+20.0); moveto(x-15,(int)(y+20)); lineto((int)(x+15),(int)(y+20)); moveto((int)(x+15),(int)(y+20)); lineto(x+3,y+3);} setcolor(RED); if (shang==0){ 整理為word格式 circle((int)x,(int)y,3); line (x-3,y-3,x-15,y-20); moveto(x-15,y-20); lineto(x+15,y-20); moveto(x

17、+15,y-20); lineto(x+3,y-3); } } double ca3mm1(double m1,double m2) { double temp; temp = sqrt(m1*m1 + m2*m2); return(temp); } double ca3fm1(double cosine,double sine) { float temp; if (sine > 0 && cosine > 0) temp = atan(sine / cosine) * 180 / pi; if (sine > 0 && cosine

18、 < 0) temp = (atan(sine / cosine) + pi) * 180 / pi; if (sine < 0 && cosine < 0) temp = (atan(sine / cosine) + pi) * 180 / pi; if (sine < 0 && cosine > 0) temp = (atan(sine / cosine) + 2 * pi) * 180 / pi; return(temp); } double ca5fm2(double a6m,double a5m,double a4m,double a4f,int sh

19、ang) { 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 > 0 && cosine1 < 0) temp =

20、 a4f + ((atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 < 0 && cosine1 < 0) temp = a4f + ((atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 < 0 && cosine1 > 0) temp = a4f + ((atan(sine1 / cosine1) + 2 * pi) * 180 / pi); return(temp); } 整理為word格式 double ca6fm2(double a4m ,doubl

21、e a4f,double a5m , double a5f) { double 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 && cosine

22、1 < 0) temp = ((atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 < 0 && cosine1 < 0) temp = ((atan(sine1 / cosine1) + pi) * 180 / pi); if (sine1 < 0 && cosine1 > 0) temp = ((atan(sine1 / cosine1) + 2 * pi) * 180 / pi); return(temp); } initscreen() { int gd=DETECT,gm; registerbgidriver(EGAVGA_driver); initgraph(&gd,&gm,""); } 友情提示:本資料代表個(gè)人觀點(diǎn),如有幫助請(qǐng)下載,謝謝您的瀏覽! 整理為word格式

展開閱讀全文
溫馨提示:
1: 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
2: 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
3.本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
5. 裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

相關(guān)資源

更多
正為您匹配相似的精品文檔
關(guān)于我們 - 網(wǎng)站聲明 - 網(wǎng)站地圖 - 資源地圖 - 友情鏈接 - 網(wǎng)站客服 - 聯(lián)系我們

copyright@ 2023-2025  zhuangpeitu.com 裝配圖網(wǎng)版權(quán)所有   聯(lián)系電話:18123376007

備案號(hào):ICP2024067431號(hào)-1 川公網(wǎng)安備51140202000466號(hào)


本站為文檔C2C交易模式,即用戶上傳的文檔直接被用戶下載,本站只是中間服務(wù)平臺(tái),本站所有文檔下載所得的收益歸上傳人(含作者)所有。裝配圖網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)上載內(nèi)容本身不做任何修改或編輯。若文檔所含內(nèi)容侵犯了您的版權(quán)或隱私,請(qǐng)立即通知裝配圖網(wǎng),我們立即給予刪除!