#!/usr/bin/perl -w

# ming paint example
# demonstrates line, curve and cubic-curve painting
#
# Author: Peter Liscovius
# 2002

use SWF("Shape");
SWF::setVersion(4);

$m = new SWF::Movie;
$m->setDimension(300,300);
$m->setRate(30);


for($i=0;$i<=30;$i++){
	my $s= new SWF::Shape;
	$s->setLine(1,$i*10,150-$i*10,0);
	
	$s->movePenTo(150,0);
	$s->drawLineTo(50+$i*5,40);
	
	($tox,$toy)=(50,50);
	($dx1,$dy1)=(-50+$i*10,100);
	($dx2,$dy2)=(200-$i*10,-100);
	$s->movePenTo($tox,$toy);
	#$s->drawLine($dx1,$dy1);
	#$s->drawLine($dx2,$dy2);
	#$s->movePenTo($tox,$toy);
	$s->drawCurve($dx1,$dy1,$dx2,$dy2);
	$s_n=$m->add($s);
	$s_n->move(0,10);
	#$m->nextFrame;
}

for($i=0;$i<30;$i++){
	($tox,$toy)=(0,0);
	($bdx,$bdy)=(0-$i*10,-100+$i*10);
	($cdx,$cdy)=(50+$i*20,150-$i*10);
	($ddx,$ddy)=(0-$i*10,-50);
	my $s= new SWF::Shape;
	$s->setLine(1,$i*10,150-$i*10,0);
	#$s->setRightFill($i*10,150-$i*10,0);
	#$s->movePenTo($tox,$toy);
	#$s->drawLine($bdx,$bdy);
	#$s->drawLine($cdx,$cdy);
	#$s->drawLine($ddx,$ddy);
	$s->movePenTo($tox,$toy);
	$s->drawCubic($bdx,$bdy,$cdx,$cdy,$ddx,$ddy);
	$s_n=$m->add($s);
	$s_n->move(120,160);
	$m->nextFrame;
}


#$m->add(new SWF::Action("stop();"));
$m->nextFrame;

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