#!/usr/bin/perl
use Flash;
use CGI;
my $q = new CGI;
print $q->header(-type=>'application/x-shockwave-flash');
my $axis = $q->param('axis');
my $text = $q->param('text');
openswf("-",300,300,30);
# --- set field of view
ortho2(-100,100,-100,100);
# --- let's start some sound right away
#sound_rate(22000);
#define_sound(2,"lightsabre.wav");
#sound_compression(3);
#start_sound(2);
# --- just to init colors
mul_colour(1,1,1,1);
add_colour(0,0,0,0);
# --- define an image
my $bitmapid = nextid();
define_bitmap($bitmapid,"perlflash.gif");
my $nid = rect_image($bitmapid);
push_matrix;
translate(0,0,-100);
scale(0.2,0.2,0.2);
place_object($nid,00);
pop_matrix;
# --- let's place some string also
# (be sure the libswf.a bin/ is set via SWFBIN and SWFFONTPATH to
# find the required fonts)
my $fontid = nextid();
define_font($fontid,"Mod");
font_size(25);
font_slant(10);
my $textid = nextid();
define_text($textid,$text,1);
push_matrix;
#scale(-1,-1,-1);
translate(0,0,0);
pop_matrix;
#show_frame;
for($i=0; $i<360; $i++) {
my $p = $i/(30-1);
remove_object(40);
push_matrix;
# change the colour
add_colour($q->param('r')/255,$q->param('g')/255,$q->param('b')/255,$q->param('a')/255);
# do the rotation thang
rotate(60*$p,'x') if ($q->param('x'));
rotate(60*$p,'z') if ($q->param('z'));
rotate(60*$p,'y') if ($q->param('y'));
place_object($textid,40);
pop_matrix;
show_frame;
}
closeswf;
#open IN, "$filename";
#while (<IN>) { print; }
#close IN;
#unlink $filename;
exit 0;
syntax highlighted by Code2HTML, v. 0.8.12