谁帮我做一个会动的动画。只要一个物体会动就行了
#include <stdio.h> #include <graphics.h>
void main() { int x,size,graphdriver,graphmode; void *buffer;
graphdriver=DETECT; initgraph(&graphdriver,&graphmode,"");
size=imagesize(0,0,40,40); buffer=(void *)malloc(size);
for(x=100;x<=400;x++) { getimage(x-20,250-20,x+20,250+20,buffer); circle(x,250,20); delay(0.02); putimage(x-20,250-20,buffer,0); } } 不知道这个是否能交差
这样吧 #include <stdio.h> #include <graphics.h>
void main() { int x,size,graphdriver,graphmode; void *buffer; int z,y;
graphdriver=DETECT; initgraph(&graphdriver,&graphmode,"");
size=imagesize(0,0,40,40); buffer=(void *)malloc(size);
for(x=100;x<=400;x++) { getimage(x-20,250-20,x+20,250+20,buffer); circle(x,250,20); for(z=0;z<=10000;z++) for(y=0;y<=100;y++); putimage(x-20,250-20,buffer,0); } closegraph(); }