#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include "GrWin.h"

/* サカナを動かす */

int main()
{
  float x, y, size, d;
  int c;

  GWopen(0);
  GWindow(0.0, 0.0, 200.0, 200.0);

  size=10.0; /* 基本的なサイズ */
  x=200.0; y=50.0; /* 登場位置 */

  c=16; /* 体の色 (16:青) */

  /* ループはじまり */
  while( x > 10.0 ) {

    /* アタマ */
    GWxpie(x-size, y-size, x+size, y+size, 0.85, 0.3, c);

    /* 白目と黒目を入れる */
    GWscircle(x+size*0.4,  y-size*0.3,  x+size*0.8,  y+size*0.3, 19);
    GWscircle(x+size*0.45, y-size*0.25, x+size*0.75, y+size*0.25, 0);

    /* 胴骨 */
    for( d=0.0; d<0.8; d+=0.1 ) {
      GWxarc(x+size+(size*d), y-size, x+size*2.0+(size*d), y+size, 0.3,  0.4, 2);
    };
  
    /* しっぽ */
    GWxpie(x+size*0.8, y-size, x+size*2.6, y+size, 0.85, 0.3, c);

   x-=2.0;
   GWsleep(80);
   GWclear(-1);
   
  };

  return 0;
}

