mirror of
https://github.com/sigmasternchen/php-doc-en
synced 2025-03-20 19:08:54 +00:00

git-svn-id: https://svn.php.net/repository/phpdoc/en/trunk@78496 c90b9560-bf6c-de11-be94-00142212c4b1
138 lines
3.6 KiB
XML
138 lines
3.6 KiB
XML
<?xml version="1.0" encoding="iso-8859-1"?>
|
|
<!-- $Revision: 1.2 $ -->
|
|
<!-- splitted from ./en/functions/ming.xml, last change in rev 1.24 -->
|
|
<refentry id="function.swfdisplayitem.rotateto">
|
|
<refnamediv>
|
|
<refname>SWFDisplayItem->rotateTo</refname>
|
|
<refpurpose>Rotates the object in global coordinates.</refpurpose>
|
|
</refnamediv>
|
|
<refsect1>
|
|
<title>Description</title>
|
|
<methodsynopsis>
|
|
<type>void</type><methodname>swfdisplayitem->rotateto</methodname>
|
|
<methodparam><type>float</type><parameter>degrees</parameter></methodparam>
|
|
</methodsynopsis>
|
|
&warn.experimental.func;
|
|
<para>
|
|
<function>swfdisplayitem->rotateto</function> set the current object
|
|
rotation to <parameter>degrees</parameter> degrees in global coordinates.
|
|
</para>
|
|
<simpara>
|
|
The object may be a <function>swfshape</function>, a
|
|
<function>swfbutton</function>, a <function>swftext</function> or a
|
|
<function>swfsprite</function> object. It must have been added using
|
|
the <function>swfmovie->add</function>.
|
|
</simpara>
|
|
<para>
|
|
This example bring three rotating string from the background to the
|
|
foreground. Pretty nice.
|
|
<example>
|
|
<title><function>swfdisplayitem->rotateto</function> example</title>
|
|
<programlisting role="php">
|
|
<![CDATA[
|
|
<?php
|
|
$thetext = "ming!";
|
|
|
|
$f = new SWFFont("Bauhaus 93.fdb");
|
|
|
|
$m = new SWFMovie();
|
|
$m->setRate(24.0);
|
|
$m->setDimension(2400, 1600);
|
|
$m->setBackground(0xff, 0xff, 0xff);
|
|
|
|
// functions with huge numbers of arbitrary
|
|
// arguments are always a good idea! Really!
|
|
|
|
function text($r, $g, $b, $a, $rot, $x, $y, $scale, $string)
|
|
{
|
|
global $f, $m;
|
|
|
|
$t = new SWFText();
|
|
$t->setFont($f);
|
|
$t->setColor($r, $g, $b, $a);
|
|
$t->setHeight(960);
|
|
$t->moveTo(-($f->getWidth($string))/2, $f->getAscent()/2);
|
|
$t->addString($string);
|
|
|
|
// 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->x = $x;
|
|
$i->y = $y;
|
|
$i->rot = $rot;
|
|
$i->s = $scale;
|
|
$i->rotateTo($rot);
|
|
$i->scale($scale, $scale);
|
|
|
|
// but the changes are local to the function, so we have to
|
|
// return the changed object. kinda weird..
|
|
|
|
return $i;
|
|
}
|
|
|
|
function step($i)
|
|
{
|
|
$oldrot = $i->rot;
|
|
$i->rot = 19*$i->rot/20;
|
|
$i->x = (19*$i->x + 1200)/20;
|
|
$i->y = (19*$i->y + 800)/20;
|
|
$i->s = (19*$i->s + 1.0)/20;
|
|
|
|
$i->rotateTo($i->rot);
|
|
$i->scaleTo($i->s, $i->s);
|
|
$i->moveTo($i->x, $i->y);
|
|
|
|
return $i;
|
|
}
|
|
|
|
// see? it sure paid off in legibility:
|
|
|
|
$i1 = text(0xff, 0x33, 0x33, 0xff, 900, 1200, 800, 0.03, $thetext);
|
|
$i2 = text(0x00, 0x33, 0xff, 0x7f, -560, 1200, 800, 0.04, $thetext);
|
|
$i3 = text(0xff, 0xff, 0xff, 0x9f, 180, 1200, 800, 0.001, $thetext);
|
|
|
|
for($i=1; $i<=100; ++$i)
|
|
{
|
|
$i1 = step($i1);
|
|
$i2 = step($i2);
|
|
$i3 = step($i3);
|
|
|
|
$m->nextFrame();
|
|
}
|
|
|
|
header('Content-type: application/x-shockwave-flash');
|
|
$m->output();
|
|
?>
|
|
]]>
|
|
</programlisting>
|
|
</example>
|
|
</para>
|
|
<simpara>
|
|
See also
|
|
<function>swfdisplayitem->rotate</function>.
|
|
</simpara>
|
|
</refsect1>
|
|
</refentry>
|
|
|
|
<!-- Keep this comment at the end of the file
|
|
Local variables:
|
|
mode: sgml
|
|
sgml-omittag:t
|
|
sgml-shorttag:t
|
|
sgml-minimize-attributes:nil
|
|
sgml-always-quote-attributes:t
|
|
sgml-indent-step:1
|
|
sgml-indent-data:t
|
|
indent-tabs-mode:nil
|
|
sgml-parent-document:nil
|
|
sgml-default-dtd-file:"../../../../manual.ced"
|
|
sgml-exposed-tags:nil
|
|
sgml-local-catalogs:nil
|
|
sgml-local-ecat-files:nil
|
|
End:
|
|
vim600: syn=xml fen fdm=syntax fdl=2 si
|
|
vim: et tw=78 syn=sgml
|
|
vi: ts=1 sw=1
|
|
-->
|