昨日、一昨日ってホントに今更ながら Papervision3D をさわり始めたのでちょっとサンプルを作成しました。(Away 3D はちょいと前にいじった事があるのですが。。。)
よくありそうな感じでPlaneを2枚重ねて、
パタパタするってだけのヤツです。
ちなみに両面に BitmapAssetMaterial を使ってるので、
ライブラリに画像を2枚、同じサイズで入れて下さい。
じゃないと、動かないス。
今日思いついて、設計10分&制作2時間の簡易的なお手製クラスなので、
条件分岐とかはかなり軟弱な作りになっていますので、悪しからず。。。。
あと、click時の連打に対応出来てませんです。
- DocumentClass -
package {
import flash.display.Sprite;
import flash.display.Stage;
import flash.display.StageAlign;
import flash.display.StageQuality;
import flash.display.StageScaleMode;
public class PlaneRotationDocument extends Sprite {
private var pr3d:PlaneRotation3D;
public function PlaneRotationDocument() {
stage.quality = StageQuality.MEDIUM;
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
init();
};
private function init():void {
pr3d = new PlaneRotation3D( "FrontImage", "BackImage", stage.stageWidth, stage.stageHeight );
pr3d.initialize();
addChild( pr3d );
};
};
};
して、このクラスを同階層に置いておけば動きますヨ。
pr3d = new PlaneRotation3D( “FrontImage”, “BackImage”, stage.stageWidth, stage.stageHeight );
の第3引数と、第4引数は画像の幅のにしたほうがいいっぽいです。
この場合は、「FrontImage」ってリンケージ指定した画像データと、同じサイズの「BackImage」というリンケージ指定している画像データがライブラリにある感じです。
さわり初めて分かったのですが、こーいったライブラリ作ってる人は、すげーでありますね。
クラス構造見てるだけで、勉強になります。
あざすー
–
PlaneRotation3D.as
–
—
追記:09.04.09 – 14:27
time 使用時にバグ発見したので修正しますたです。
click 使用時にマウスを指カーソルに変更したい場合の追加をしましたです。
/**
* control mouse visual
* useHandlCursor
*
* @param flg Boolean
*/
public var handCursor:Boolean = false;
public function set setHandCursor( flg:Boolean ):void {
handCursor = flg;
viewport.interactive = handCursor;
viewport.containerSprite.buttonMode = handCursor;
};
ってのが追記されてますので、使う時は、
pr3d.initialize();
pr3d.setHandCursor( true );
addChild( pr3d );
とかって感じでおねがいしますです。
–
PlaneRotation3D.as version 02
–
COMMENT
0 Comment