利用ming库来写PHP的flash动画
http://ftp.magiclinux.org.cn/haulm/Source/php/php-ming-5.2.6-fastcgi_1mgc.src.rpmhttp://ftp.magiclinux.org.cn/haulm/Source/php/libming-0.4.2-1mgc.src.rpm<?
Ming_setScale(20.0);
srand(time());
$nb_stars = (!$nb_stars)?40:$nb_stars;
$rate = (!$rate)?24:$rate;
// Creates the star model and text shapes
$s = new SWFShape();
$s->setRightFill(rand()%64, rand()%64, rand()%64, rand()%64);
$s->movePenTo(-70, 35);
$s->drawLineTo(0, -70);
$s->drawLineTo(70, 35);
$s->drawLineTo(-70, 35);
$s->movePenTo(-70, -35);
$s->drawLineTo(70, -35);
$s->drawLineTo(0, 70);
$s->drawLineTo(-70, -35);
$f = new SWFFont('/usr/share/fonts/ttf/zh_CN/wqy-zenhei.ttf');
$t = new SWFShape();
$t->setRightFill(rand()%64, rand()%64, rand()%64, rand()%64);
$t->movePenTo(-($f->getWidth('MING')/2),-(($f->getAscent()+$f->getDescent())/2));
for($c=0;$c<strlen('MING');$c++){
$t->drawGlyph($f, substr('MING',$c,1));
$t->movePen($f->getWidth(substr('MING',$c,1)),0);
}
$tt = new SWFShape();
$tt->setRightFill(rand()%64, rand()%64, rand()%64, rand()%64);
$tt->movePenTo(-($f->getWidth('PHP')/2),-(($f->getAscent()+$f->getDescent())/2));
for($c=0;$c<strlen('PHP');$c++){
$tt->drawGlyph($f, substr('PHP',$c,1));
$tt->movePen($f->getWidth(substr('PHP',$c,1)),0);
}
$ttt = new SWFShape();
$ttt->setRightFill(rand()%64, rand()%64, rand()%64, rand()%64);
$ttt->movePenTo(-($f->getWidth('SWF')/2),-(($f->getAscent()+$f->getDescent())/2));
for($c=0;$c<strlen('SWF');$c++){
$ttt->drawGlyph($f, substr('SWF',$c,1));
$ttt->movePen($f->getWidth(substr('SWF',$c,1)),0);
}
// Creates sprites
$spriteCounter=0;
for($c=0; $c<$nb_stars; $c++) {
eval("\$p$c = new SWFSprite();");
if($spriteCounter==0){eval("\$i$c = \$p$c"."->add(\$s);");$spriteCounter++;}else{
if($spriteCounter==1){eval("\$i$c = \$p$c"."->add(\$t);");$spriteCounter++;}else{
if($spriteCounter==2){eval("\$i$c = \$p$c"."->add(\$tt);");$spriteCounter++;}else{
if($spriteCounter==3){eval("\$i$c = \$p$c"."->add(\$ttt);");$spriteCounter=0;}}}}
eval("\$i$c"."->setName('triangle$c');");
eval("\$p$c"."->nextFrame();");
}
// Creates the movie and the main sprite
$m = new SWFMovie();
$m->setRate($rate);
$m->setBackground(0, 0, 0);
$m->setDimension(640,480);
$mp = new SWFSprite();
// Adds each sprite to the main one
for($c=0; $c<$nb_stars; $c++) {
$sc=0.1+(rand()%85)/100;
$rot=rand()%10+1;
eval("\$i$c=\$mp"."->add(\$p$c);");
eval("\$i$c"."->addColor(rand()%256, rand()%256, rand()%256, rand()%192);");
eval("\$i$c"."->moveTo(-320+rand()%620, -240+rand()%460);");
eval("\$i$c"."->scaleTo($sc, $sc);");
// When a sprite is loaded, creates the actionscript code needed to make it
eval("\$i$c"."->addAction(new SWFAction('
o=0;
sc=$sc*100;
sensX=(Math.random()*2-1)*7;
sensY=(Math.random()*2-1)*7;
function doXform$c() {
o+=$rot;
triangle$c._xscale=$sc*100*Math.cos(o*Math.PI/180);
triangle$c._rotation=o;
if (triangle$c._x>320) {sensX=-sensX;};
if (triangle$c._x<-320) {sensX=-sensX;};
triangle$c._x+=sensX;
if (triangle$c._y>320) {sensY=-sensY;};
if (triangle$c._y<-320) {sensY=-sensY;};
triangle$c._y+=sensY;
}
'), SWFACTION_ONLOAD);");
// When one sprite is entered then call the doXform function
eval("\$i$c"."->addAction(new SWFAction('doXform$c();'), SWFACTION_ENTERFRAME);");
}
// Adds the main sprite to the movie
$i = $m->add($mp);
$i->setName("MainClip");
$i->moveTo(320, 240);
// Create the link button
$s = new SWFShape();
$s->setRightFill(0,0,0,1);
$s->drawLine(640,0);
$s->drawLine(0,480);
$s->drawLine(-640,0);
$s->drawLine(0,-480);
$b = new SWFButton();
$b->addShape($s,SWFBUTTON_OVER | SWFBUTTON_DOWN | SWFBUTTON_OUT | SWFBUTTON_HIT);
$b->setAction(new SWFAction("getURL('skewing-source.php','_top');"));
$i=$m->add($b);
// Creates the actionscript code to make the main sprite rotate
$i->addAction(new SWFAction('o=0; function DoRotation() {o+=0.5;_root.MainClip._rotation=o;}'), SWFACTION_ONLOAD);
$i->addAction(new SWFAction('DoRotation();'), SWFACTION_ENTERFRAME);
$mp->nextFrame();
$m->nextFrame();
$m->save("skewing.swf");
$revitalizer=rand();
print "<OBJECT classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://active.macromedia.com/flash2/cabs/swflash.cab#version=4,0,0,0\" ID=objects WIDTH=640 HEIGHT=480>
<PARAM NAME=movie VALUE=\"skewing.swf?$revitalizer\">
<EMBED src=\"skewing.swf?$revitalizer\" WIDTH=640 HEIGHT=480 TYPE=\"application/x-shockwave-flash\" PLUGINSPAGE=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\">
</OBJECT>
";
?> 不知道为什么,我的没有出来
页:
[1]