#!/usr/bin/perl -w

#use lib("/aodv/bin/lib/site_perl");

use SWF qw(:ALL);

SWF::setVersion(4);

$m = new SWF::Movie();

$m->setDimension(400, 300);

### Morph 1 ###
$morph = new SWF::Morph();

$s1 = $morph->getShape1();
$s1->setLine(40, 0x00, 0x00, 0x00);
$s1->setLeftFill(0,200,200);
$s1->drawLine(100, 0);
$s1->drawLine(0, 200);
$s1->drawLine(-100, 0);
$s1->drawLine(-100, 0);
$s1->drawLine(0, -200);
$s1->drawLine(100, 0);
$s1->setLeftFill();

$s2 = $morph->getShape2();	
$s2->setLine(100, 0xff, 0x99, 0x00);
$s2->setLeftFill(255,0,0);
$s2->drawCurve(60, -50, 40, 40);
$s2->drawCurve(50,50, -100,60);
$s2->drawCurve(-50,30, 0,40);
$s2->drawCurve(0,-50, -50,-10);
$s2->drawCurve(-100,-30,50,-80);
$s2->drawCurve(40, -60, 60, 60);
$s2->setLeftFill();

$morph_inst = $m->add($morph);
$morph_inst->move(200,80);

for($i=0; $i<=1; $i+=0.05){
	#a hash for the lazy coders
	$morph_inst{$i} = $m->add($morph);
	$morph_inst{$i}->setRatio($i);
	$morph_inst{$i}->move(20*$i*20,20);
	$morph_inst{$i}->scaleTo(0.1);
}

for($i=0; $i<=1; $i+=0.05){  
	$morph_inst->setRatio($i);
	$m->nextFrame;  
}
for($i=0; $i<=1; $i+=0.05){  
	$morph_inst->setRatio(1-$i); 
	$morph_inst{$i}->remove; 
	$m->nextFrame;  
}

#print('Content-type: application/x-shockwave-flash\n\n');
#$m->output();
$m->save("$0.swf");
