// 星空蝌蚪手动圆涂抹动画.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <graphics.h>
#include <conio.h>
#include<time.h>
#include<stdlib.h>
void main()
{
initgraph(600, 600);
int l,m,n; ///////////////星空
getch();
while (!kbhit())
{
l=rand()%600;
m=rand()%600;
n=RGB(rand()%256,rand()%256,rand()%256);
////////RGB,RED<GREEN<BLUE
putpixel(l,m,n);////////////////////////////////////
Sleep(2);
}
getch();
getch();
srand( (unsigned)time( NULL ) );////随机种子/////////////////随机蝌蚪
int a,b,c,d;
while(!kbhit())
{
a=rand()%600;
b=rand()%600;
c=RGB(rand()%256,rand()%256,rand()%256,rand()%256);
d=RGB(rand()%256,rand()%256,rand()%256,rand()%256);
setcolor(d);////////////////所有线的颜色
//setlinestyle(PS_SOLID,NULL,2);//////////
setfillstyle(c);
fillcircle(a,b,10);
rectangle(a,b,a+30,b+30);
line(a,b,a+100,b+100);
putpixel(b,a,c);Sleep(5);}
getch();
for(int i=0;i<=600;i=i+20)
{
setcolor(GREEN);///////////////////////八喜临门
setfillstyle(YELLOW);
fillcircle(300,i,20);
Sleep(5);
setcolor(MAGENTA);
setfillstyle(BLUE);
fillcircle(300,i,20);
Sleep(5);
setcolor(BLUE);
setfillstyle(RED);
fillcircle(i,300,20);
Sleep(5);
setcolor(GREEN);
setfillstyle(YELLOW);
fillcircle(i,300,20);
Sleep(5);
setcolor(BLUE);
setfillstyle(YELLOW);
fillcircle(600-i,300,20);
Sleep(5);
setcolor(GREEN);
setfillstyle(GREEN);
fillcircle(600-i,300,20);
Sleep(5);
setcolor(BLUE);
setfillstyle(CYAN);
fillcircle(300,600-i,20);
Sleep(5);
setcolor(GREEN);
setfillstyle(RED);
fillcircle(300,600-i,20);
Sleep(5);
setcolor(BLUE);
setfillstyle(CYAN);
fillcircle(i,i,20);
Sleep(5);
setcolor(GREEN);
setfillstyle(MAGENTA);
fillcircle(i,i,20);
Sleep(5);
setcolor(BLUE);
setfillstyle(CYAN);
fillcircle(600-i,600-i,20);
Sleep(5);
setcolor(GREEN);
setfillstyle(WHITE);
fillcircle(600-i,600-i,20);
Sleep(5);
setcolor(BLUE);
setfillstyle(CYAN);
fillcircle(600-i,i,20);
Sleep(5);
setcolor(GREEN);
setfillstyle(LIGHTGRAY);
fillcircle(600-i,i,20);
Sleep(5);
setcolor(BLUE);
setfillstyle(CYAN);
fillcircle(i,600-i,20);
Sleep(5);
setcolor(GREEN);
setfillstyle(BROWN);
fillcircle(i,600-i,20);
Sleep(5);}
int x=200;////////////////手动圆
int y=200;
int z=400;
int s=400;
setlinestyle(PS_SOLID,NULL,10);
setcolor(BLUE);
setfillstyle(GREEN);
fillcircle(x,y,60);
setcolor(GREEN);
setfillstyle(YELLOW);
fillcircle(z,s,60);;
char t=0;
while(t!=27)
{
t=getch();
setcolor(BLACK);
setfillstyle(BLACK);
fillcircle(x,y,60);
//setcolor(BLUE);
//setfillstyle(GREEN);
//fillcircle(x,y,60);//
//setcolor(GREEN);
//setfillstyle(BLACK);
//fillcircle(z,s,60);
setcolor(BLACK);
setfillstyle(BLACK);
fillcircle(z,s,60);
switch(t)
{
case'a':x-=10;break;
case'd':x+=10;break;
case'w':y-=10;break;
case's':y+=10;break;
case'j':z-=10;break;
case'l':z+=10;break;
case'i':s-=10;break;
case'k':s+=10;break;
case'27':break;
}
setcolor(BLUE);
setfillstyle(GREEN);
fillcircle(x,y,60);
//rectangle(x,y,x+30,y+40);
setcolor(GREEN);
setfillstyle(YELLOW);
fillcircle(z,s,60);
Sleep(10);
int l,m,n;
for(l=0;l<500;l++)
{
l=rand()%600;
m=rand()%600;
n=RGB(rand()%256,rand()%256,rand()%256);
////////RGB,RED<GREEN<BLUE
putpixel(l,m,n);
Sleep(2);
}
Sleep(5);
}
closegraph();
}