Difference between revisions of "Swf.pl"

From Organic Design wiki
(Colours)
(restructure)
Line 1: Line 1:
 
use SWF::Builder;
 
use SWF::Builder;
  
my $swf= SWF::Builder->new(
+
# We may use a dedicated child for serving SWF requests
FrameRate => 50,
+
sub swfd {
FrameSize => [0, 0, 400, 400],
+
}
BackgroundColor => 'cccccc'
 
);
 
  
# Red triangle
+
# Compile a SWF interface for this peer
my $shape = $swf->new_shape
+
sub swfCompile {
->fillstyle('009900')
+
my $output = '';
->linestyle(1, '000000')
+
 
->moveto(0,-11)
+
my $swf= SWF::Builder->new(
->lineto(10,6)
+
FrameRate => 50,
->lineto(-10,6)
+
FrameSize => [0, 0, 640, 480],
->lineto(0,-11);
+
BackgroundColor => 'cccccc'
my $instance = $shape->place;
+
);
for ( my $x = 0; $x < 400; $x++ ) { $instance->rotate(15)->moveto( $x, 200 ) }
+
 
$swf->save( "$::peer.swf" );
+
# Red triangle
 +
my $shape = $swf->new_shape
 +
->fillstyle('ffffff')
 +
->linestyle(1, '000000')
 +
->moveto(0,-11)
 +
->lineto(10,6)
 +
->lineto(-10,6)
 +
->lineto(0,-11);
 +
my $instance = $shape->place;
 +
 
 +
for ( my $x = 0; $x < 400; $x++ ) { $instance->rotate(15)->moveto( $x, 200 ) }
 +
 
 +
$swf->save( my $file = "$::peer.swf" );
 +
my @stat = stat( $file );
 +
$output .= logAdd "SWF Instance compiled: $file ($stat[7] bytes)\n";
 +
return $output;
 +
}

Revision as of 00:12, 15 February 2006

use SWF::Builder;

  1. We may use a dedicated child for serving SWF requests

sub swfd { }

  1. Compile a SWF interface for this peer

sub swfCompile { my $output = ;

my $swf= SWF::Builder->new( FrameRate => 50, FrameSize => [0, 0, 640, 480], BackgroundColor => 'cccccc' );

# Red triangle my $shape = $swf->new_shape ->fillstyle('ffffff') ->linestyle(1, '000000') ->moveto(0,-11) ->lineto(10,6) ->lineto(-10,6) ->lineto(0,-11); my $instance = $shape->place;

for ( my $x = 0; $x < 400; $x++ ) { $instance->rotate(15)->moveto( $x, 200 ) }

$swf->save( my $file = "$::peer.swf" ); my @stat = stat( $file ); $output .= logAdd "SWF Instance compiled: $file ($stat[7] bytes)\n"; return $output; }