
#include <mingpp.h>

int main()
{
  Ming_init();
  Ming_setScale(1.0);

  SWFMorph *p = new SWFMorph();

  SWFGradient *g = new SWFGradient();
  g->addEntry(0.0, 0, 0, 0);
  g->addEntry(0.16, 0xff, 0xff, 0xff);
  g->addEntry(0.32, 0, 0, 0);
  g->addEntry(0.48, 0xff, 0xff, 0xff);
  g->addEntry(0.64, 0, 0, 0);
  g->addEntry(0.80, 0xff, 0xff, 0xff);
  g->addEntry(1.00, 0, 0, 0);

  SWFShape *s = p->getShape1();
  SWFFill *f = s->addGradientFill(g, SWFFILL_RADIAL_GRADIENT);
  f->scaleTo(0.005);
  s->setLeftFill(f);
  s->movePenTo(-160, -120);
  s->drawLine(320, 0);
  s->drawLine(0, 240);
  s->drawLine(-320, 0);
  s->drawLine(0, -240);

  g = new SWFGradient();
  g->addEntry(0.0, 0, 0, 0);
  g->addEntry(0.16, 0xff, 0, 0);
  g->addEntry(0.32, 0, 0, 0);
  g->addEntry(0.48, 0, 0xff, 0);
  g->addEntry(0.64, 0, 0, 0);
  g->addEntry(0.80, 0, 0, 0xff);
  g->addEntry(1.00, 0, 0, 0);

  s = p->getShape2();
  f = s->addGradientFill(g, SWFFILL_RADIAL_GRADIENT);
  f->scaleTo(0.008);
  f->skewXTo(-0.5);
  s->setLeftFill(f);
  s->movePenTo(-160, -120);
  s->drawLine(320, 0);
  s->drawLine(0, 240);
  s->drawLine(-320, 0);
  s->drawLine(0, -240);

  SWFMovie *m = new SWFMovie();
  m->setDimension(320, 240);
  SWFDisplayItem *i = m->add(p);
  i->moveTo(160, 120);

  for(int n=0; n<=100; ++n)
  {
    i->setRatio(n/100.0);
    m->nextFrame();
  }

  m->save("test.swf");

  exit(0);
}
