testswf   [plain text]


<?php

$LINEID=1;
$LINEDEPTH=50;
$LINESTEPS=30;

$CIRCLEID=2;
$CIRCLEDEPT=100;

/* stop playing */
function stop()
{
  swf_startdoaction();
  swf_actionStop();
  swf_enddoaction();
}

/* play stoping */
function play()
{
  swf_startdoaction();
  swf_actionPlay();
  swf_enddoaction();
}

/* 
 *	demonstrates:
 *		 defining and placing an object.
 *
 */
function flipline()
{
  global $LINESTEPS, $LINEID, $LINEDEPTH;

  swf_ortho2(-100.0,100.0,-100.0,100.0);
  swf_defineline($LINEID,-60.0,0.0,60.0,0.0,1.2);
  swf_mulcolor(1.0,1.0,1.0,1.0);
  swf_addcolor(0.0,0.0,0.0,0.0);
  for($i=0; $i<$LINESTEPS; $i++) {
	  $p = $i/($LINESTEPS-1.0);
	  swf_pushmatrix();
	  swf_rotate(60.0*$p,'z');
	  swf_translate(20.0+20.0*$p,0.0,0.0);
	  swf_rotate(120.0*$p,'z');
	  swf_placeobject($LINEID, $LINEDEPTH);
	  swf_popmatrix();
	  swf_showframe();
  }
  for($i=0; $i<$LINESTEPS; $i++) {
	  swf_removeobject($LINEDEPTH);
	  if(($i%4) == 0)
	    swf_showframe();
  }
  swf_showframe();
}

/* growblobs follows */

$NBLOBS=8;
$BLOBSTEPS=20;

/* 
 *	demonstrates:
 *		shape definition
 *		placing, and modifying objects.		
 *
 */
function growblobs()
{
  global $NBLOBS, $BLOBSTEPS, $CIRCLEDEPT, $CIRCLEID;

  swf_ortho2(-200.0,200.0,-200.0,200.0);

  swf_startshape($CIRCLEID);
  swf_shapefillsolid(0.0,0.0,0.0,1.0);
  swf_shapearc(0.0,0.0,300.0,0.0,360.0);
  swf_endshape();

  swf_mulcolor(1.0,1.0,1.0,1.0);
  $startframe = swf_getframe();
  for($j=0; $j<$NBLOBS; $j++) {
	  swf_setframe($startframe+2*$j);
	  for($i=0; $i<$BLOBSTEPS; $i++) {
      $p = $i/($BLOBSTEPS-1.0);
      swf_pushmatrix();
      swf_scale($p,$p,$p);
      swf_addcolor($p,$p,$p,0.0);
      if($i== 0)
  		  swf_placeobject($CIRCLEID,$CIRCLEDEPTH+$j);
      else
  		  swf_modifyobject($CIRCLEDEPTH+$j,MOD_COLOR|MOD_MATRIX);
      swf_popmatrix();
      swf_showframe();
	  }
	  swf_removeobject($CIRCLEDEPTH+$j);
  }
  swf_showframe();
}

swf_openfile("test.swf",400.0,400.0,20.0,1.0,1.0,1.0);
flipline();
growblobs();

//    trytext();
//    makebuttons();
//    stop();
swf_showframe();
swf_closefile();

//    swf_openfile("images.swf",400.0,400.0,20.0,1.0,1.0,1.0);
//    showimages();
//    brushstrokes();
//    symboltest();
//    stop();
//    swf_showframe();
//    swf_closefile();
//    fprintf(stderr,"wrote images.swf\n");
    exit(0);

?>