当前位置: 代码迷 >> C语言 >> (在线等)老师要的作业。谁帮我做一个会动的动画。只要一个物体会动就行了
  详细解决方案

(在线等)老师要的作业。谁帮我做一个会动的动画。只要一个物体会动就行了

热度:282   发布时间:2005-01-18 23:40:00.0
换成什么呢。。还是不动哦
----------------解决方案--------------------------------------------------------
看见我更新的帖子么?改用它
----------------解决方案--------------------------------------------------------
不动哦~~  就一个圆在中间。。
是我的机子有问题?
----------------解决方案--------------------------------------------------------
能看见圆说明有BGI啊
怎么会不动呢?

你机子网速快吗?重新下载个TC看看
----------------解决方案--------------------------------------------------------
快点哦~~我拨号上网很贵的哦~~~
而且我很累了,最好马上能解决你的问题,这样我也睡的塌实
----------------解决方案--------------------------------------------------------
好了。。。你睡吧。。
谢谢哦
----------------解决方案--------------------------------------------------------
哦哦~不要误认为我不耐烦了~~~

是不是真的行了啊,我会帮你继续修正的~~~
----------------解决方案--------------------------------------------------------
#include <graphics.h>
#include <stdio.h>
#include <stdlib.h>
#include <alloc.h>
#include <math.h>
main()
{void * ptr;
int gd=DETECT,gm;
float i;
initgraph(&gd,&gm,"d:\\tc");
setactivepage(1);
setcolor(RED);
setfillstyle(1,14);
fillellipse(10,10,10,10);
ptr=malloc(imagesize(0,0,20,20));
getimage(0,0,20,20,ptr);
randomize();
setactivepage(0);
for(i=0;i<3000;i++)
putpixel(random(640),random(480),random(15));
for(i=0;i<6.28*4;i=i+0.005)
{putimage(300+8*(cos(i)+i*sin(i)),240+6*(sin(i)-i*cos(i)),ptr,COPY_PUT);
putimage(300+8*(cos(i)+(i)*sin(i)),240+6*(sin(i)-(i)*cos(i)),ptr,COPY_PUT);
if(kbhit()) break;
delay(100);
}
getch();
closegraph();
}

这个程序我刚在windows编程中发表的。
----------------解决方案--------------------------------------------------------
好厉害啊,看什么书学的?

能说一下吗?
----------------解决方案--------------------------------------------------------

如上面那个不符合要求,那就用用这个: #define PI 3.1415926 #define step 10 #define R 10 #include<time.h> #include<stdlib.h> #include<graphics.h> #include<conio.h> #include<dos.h> main() { int gdriver=DETECT,gmode; static int startx=5; static int starty=100; int maxx,l=1,n=1; double dalta=20,angle; int size; void *image; initgraph(&gdriver,&gmode,""); cleardevice(); setbkcolor(1); size=imagesize(startx,starty,startx+60,starty+60); image=(unsigned char *)malloc(size); maxx=getmaxx(); while(!kbhit()) { if(l==1) { n++; angle=-1*(n*step)/PI*180/R; if((int)(-1*angle)%360<dalta) angle-=dalta; if(n>(maxx-70)/step) l=0; } if(l==0) { --n; angle=-1*(n*step)/R/PI*180; if((int)(-1*angle)%360<dalta) angle-=dalta; if(n==1)l=1; } rectangle(startx+n*step,starty,startx+n*step+60,starty+40); pieslice(startx+n*step+15,starty+50,angle,angle-dalta,10); pieslice(startx+n*step+45,starty+50,angle,angle-dalta,10); setcolor(GREEN); setfillstyle(SOLID_FILL,GREEN); circle(startx+n*step+15,starty+50,10); circle(startx+n*step+45,starty+50,10); circle(startx+n*step+15,starty+50,3); circle(startx+n*step+45,starty+50,3); getimage(startx+n*step,starty,startx+n*step+60,starty+60,image); delay(100); putimage(startx+n*step,starty,image,XOR_PUT); } free(image); delay(5000); closegraph();

}


----------------解决方案--------------------------------------------------------
  相关解决方案