SWFDisplayItem->rotateTo()とは? わかりやすく解説

Weblio 辞書 > コンピュータ > PHP関数リファレンス > SWFDisplayItem->rotateTo()の意味・解説 

SWFDisplayItem->rotateTo()

(PHP 5)
SWFDisplayItem->rotateTo() — グローバル座標で回転させる

説明

class SWFDisplayItem {
void rotateTo ( float angle )
}
警告
この関数は、 実験的 なものです。この関数の動作・ 名前・その他ドキュメントに書かれている事項は、予告なく、将来的な PHP のリリースにおいて変更される可能性があります。 この関数は自己責任で使用してください。

swfdisplayitem->rotateto() は、 グローバル座標で、現在のオブジェクトを 現在の角度から ddegrees 度回転させます。
オブジェクトは、swfshape()swfbutton()swftext()swfsprite() のいずれかとなります。 これは、swfmovie->add() で追加されたものでなければなりません。

返り値

値を返しません。

この例は、背景から前面まで 3 つの回転する文字列を表示します。 かなりよくできています。 例 1239. swfdisplayitem->rotateto() の例
<?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);

// たくさんの任意引数をとる関数というのは
// 常に良い考えです! 本当です!

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);

  // その名前がすでに使われていない限りは、通常の PHP 変数と
  // 同様にプロパティを追加することが可能です。
  // 例: $i->scale は設定できません。なぜならそれは関数名だからです。

  $i = $m->add($t);
  $i->x = $x;
  $i->y = $y;
  $i->rot = $rot;
  $i->s = $scale;
  $i->rotateTo($rot);
  $i->scale($scale, $scale);

  // しかし、変更内容はこの関数内で閉じています。そのため、
  // 変更したオブジェクトを関数から返す必要があります。ちょっと面倒くさい……。

  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;
}

// どうです? 読みやすいでしょう。

$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();
?>


参考

SWFDisplayItem->rotate()




英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「SWFDisplayItem->rotateTo()」の関連用語

SWFDisplayItem->rotateTo()のお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



SWFDisplayItem->rotateTo()のページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
PHP Documentation GroupPHP Documentation Group
Copyright © 1997 - 2024 by the PHP Documentation Group.

©2024 GRAS Group, Inc.RSS