(PHP 5 <= 5.3.0, PECL ming SVN)

SWFDisplayItem::rotateToRotates the object in global coordinates


void SWFDisplayItem::rotateTo ( float $angle )

This function is EXPERIMENTAL. The behaviour of this function, its name, and surrounding documentation may change without notice in a future release of PHP. This function should be used at your own risk.

swfdisplayitem::rotateto() set the current object rotation to angle degrees in global coordinates.

The object may be a swfshape(), a swfbutton(), a swftext() or a swfsprite() object. It must have been added using the swfmovie::add().

Return Values

No value is returned.


This example bring three rotating string from the background to the foreground. Pretty nice.

Example #1 swfdisplayitem::rotateto() example

=  "ming!";

$f = new SWFFont("Bauhaus 93.fdb");

$m = new SWFMovie();

// functions with huge numbers of arbitrary
// arguments are always a good idea!  Really!

function text($r$g$b$a$rot$x$y$scale$string

$t = new SWFText();

// we can add properties just like a normal PHP var,
  // as long as the names aren't already used.
  // e.g., we can't set $i->scale, because that's a function

$i $m->add($t);
$i->rot $rot;

// but the changes are local to the function, so we have to
  // return the changed object.  kinda weird..

return $i;

$oldrot $i->rot;
$i->rot 19*$i->rot/20;
$i->= (19*$i->1200)/20;
$i->= (19*$i->800)/20;
$i->= (19*$i->1.0)/20;



// see?  it sure paid off in legibility:

$i1 text(0xff0x330x330xff90012008000.03$thetext);
$i2 text(0x000x330xff0x7f, -56012008000.04$thetext);
$i3 text(0xff0xff0xff0x9f18012008000.001$thetext);

for (
$i=1$i<=100; ++$i) {
$i1 step($i1);
$i2 step($i2);
$i3 step($i3);


header('Content-type: application/x-shockwave-flash');

See Also

add a note add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top