

我还不太会用图形函数 希望 大家能帮帮我
还是把程序贴出来吧 要不 苍穹大哥会怒的
#include <graphics.h>
#include <math.h>
#include <stdlib.h>
#define PI  3.14
#define LINECOLOR   7
#define ESC 283
typedef struct
{
    int x ;
    int y ;
}SITE;
typedef struct
{
    SITE s0 ;
    SITE s1 ;
    SITE s2 ;
    SITE s3 ;
}RECTSITE;
int Init() ;
int drawProcess() ;
int moveRectangle(RECTSITE rectSite) ;
int End() ;
int screenMaxx2, screenMaxy2 ;
main()
{
    Init();
    drawProcess();
    End();
}
int Init()
{
    int gd = DETECT, gm = 0 ;
initgraph(&gd, &gm, "") ;
    screenMaxx2 = getmaxx()/2 ;
    screenMaxy2 = getmaxy()/2 ;
}
/*
        Len0
    s0-------s1
    |        |
    |        |Len1
    |        |
    |        |
    s3-------s2
*/
int drawProcess()
{
    RECTSITE rectSite ;
    int moveCenterX, moveCenterY ;
    int i ;
    float LenR, Len0, Len1 ;
    float startr, r ;
    Len0 = 50 ;
    Len1 = 80 ;
    LenR = sqrt(Len0*Len0+Len1*Len1) ;
    startr = atan(Len1/Len0) ;
    moveCenterX = screenMaxx2 ;
    moveCenterY = screenMaxy2 ;
    rectSite.s0.x = moveCenterX ;
    rectSite.s0.y = moveCenterY ;
    while(!kbhit())
    {
        for(r = 0;r <= PI*2;r+=0.0314)
        {
            rectSite.s1.x = Len0*sin(r)+moveCenterX ;
            rectSite.s2.x = LenR*sin(r-startr)+moveCenterX ;
            rectSite.s3.x = Len1*sin(r-PI/2)+moveCenterX ;
            rectSite.s1.y = Len0*cos(r)+moveCenterY ;
            rectSite.s2.y = LenR*cos(r-startr)+moveCenterY ;
            rectSite.s3.y = Len1*cos(r-PI/2)+moveCenterY ;
            setcolor(LINECOLOR) ;
            moveRectangle(rectSite) ;
delay(1000) ;
            setcolor(0) ;
            moveRectangle(rectSite) ;
            if(kbhit())
            {
                if(bioskey(0) == ESC)
                 return 0 ;
            }
        }
    }
}
int moveRectangle(RECTSITE rectSite)
{
    line(rectSite.s0.x, rectSite.s0.y, rectSite.s1.x, rectSite.s1.y) ;
    line(rectSite.s1.x, rectSite.s1.y, rectSite.s2.x, rectSite.s2.y) ;
    line(rectSite.s2.x, rectSite.s2.y, rectSite.s3.x, rectSite.s3.y) ;
    line(rectSite.s3.x, rectSite.s3.y, rectSite.s0.x, rectSite.s0.y) ;
}
int End()
{
    setcolor(4) ;
    outtextxy(screenMaxx2, screenMaxy2, "END!") ;
    getch() ;
    closegraph() ;
}