#!/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 $b = new SWF::Bitmap("../common/alphafill.jpg");
my $width = $b->getWidth();
my $height = $b->getHeight();

my $s1 = $p->getShape1();
my $f1 = $s1->addFill($b, SWFFILL_TILED_BITMAP);
$f1->moveTo(-$width/2, -$height/4);
$f1->scaleTo(1.0, 0.5);
$s1->setLeftFill($f1);
$s1->movePenTo(-$width/2, -$height/4);
$s1->drawLine($width, 0);
$s1->drawLine(0, $height/2);
$s1->drawLine(-$width, 0);
$s1->drawLine(0, -$height/2);

my $s2 = $p->getShape2();
my $f2 = $s2->addFill($b, SWFFILL_TILED_BITMAP);

# these two have no effect!
$f2->moveTo(-$width/4, -$height/2);
$f2->scaleTo(0.5, 1.0);

$s2->setLeftFill($f2);
$s2->movePenTo(-$width/4, -$height/2);
$s2->drawLine($width/2, 0);
$s2->drawLine(0, $height);
$s2->drawLine(-$width/2, 0);
$s2->drawLine(0, -$height);

my $m = new SWF::Movie();
$m->setDimension($width, $height);
my $i = $m->add($p);
$i->moveTo($width/2, $height/2);

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

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

