#!/usr/bin/perl -w
use strict;

use SWF qw(:ALL);
use SWF::Constants qw(:Fill);

SWF::setScale(1.0);

my $p = new SWF::Morph();

my $g1 = new SWF::Gradient();
$g1->addEntry(0.0, 0, 0, 0);
$g1->addEntry(0.16, 0xff, 0xff, 0xff);
$g1->addEntry(0.32, 0, 0, 0);
$g1->addEntry(0.48, 0xff, 0xff, 0xff);
$g1->addEntry(0.64, 0, 0, 0);
$g1->addEntry(0.80, 0xff, 0xff, 0xff);
$g1->addEntry(1.00, 0, 0, 0);

my $s1 = $p->getShape1();
my $f1 = $s1->addFill($g1, SWFFILL_RADIAL_GRADIENT);
$f1->scaleTo(0.005);
$s1->setLeftFill($f1);
$s1->movePenTo(-160, -120);
$s1->drawLine(320, 0);
$s1->drawLine(0, 240);
$s1->drawLine(-320, 0);
$s1->drawLine(0, -240);

my $g2 = new SWF::Gradient();
$g2->addEntry(0.0, 0, 0, 0);
$g2->addEntry(0.16, 0xff, 0, 0);
$g2->addEntry(0.32, 0, 0, 0);
$g2->addEntry(0.48, 0, 0xff, 0);
$g2->addEntry(0.64, 0, 0, 0);
$g2->addEntry(0.80, 0, 0, 0xff);
$g2->addEntry(1.00, 0, 0, 0);

my $s2 = $p->getShape2();
my $f2 = $s2->addFill($g2, SWFFILL_RADIAL_GRADIENT);
$f2->scaleTo(0.008);
$f2->skewXTo(-0.5);
$s2->setLeftFill($f2);
$s2->movePenTo(-160, -120);
$s2->drawLine(320, 0);
$s2->drawLine(0, 240);
$s2->drawLine(-320, 0);
$s2->drawLine(0, -240);

my $m = new SWF::Movie();
$m->setDimension(320, 240);
my $i = $m->add($p);
$i->moveTo(160, 120);

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

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