デモ

import caurina.transitions.Tweener;

import caurina.transitions.properties.CurveModifiers;

CurveModifiers.init();

// フレームアクションでPapervision3D

import org.papervision3d.cameras.Camera3D;

import org.papervision3d.events.*;

import org.papervision3d.events.InteractiveScene3DEvent;

import org.papervision3d.objects.DisplayObject3D;

import org.papervision3d.objects.primitives.*;

import org.papervision3d.materials.WireframeMaterial;

import org.papervision3d.materials.utils.MaterialsList;

import org.papervision3d.view.BasicView;

import org.papervision3d.view.*

import org.papervision3d.materials.*

// 3D表示用のインスタンスを作ります

var world:BasicView = new BasicView(1000,1000,true,true);

addChild(world);

world.startRendering();

// テクスチャー(=マテリアル)を作ります

var material00 = new WireframeMaterial(0x0000FF);

material00.doubleSided = true;

var obj:Plane = new Plane(material00, 2000, 2000, 1, 1);

world.scene.addChild(obj);

obj.rotationX = 90;

obj.y = -100;

var material:BitmapAssetMaterial = new BitmapAssetMaterial(‘oi’)

material.doubleSided = true;

material.interactive = true; //イベント有効化

var cube:Cube = new Cube(new MaterialsList({all : material}),100, 100, 100, 1, 1, 1);

world.scene.addChild(cube);

var material02 = new ColorMaterial(0x0000FF);

material02.doubleSided = true;

material02.interactive = true; //イベント有効化

var cube02:Cube = new Cube(new MaterialsList({front: material02}), 100, 100, 100, 1, 1, 1);

//front, back, right, left, top, bottom & all.

world.scene.addChild(cube02);

cube02.x = -175;

var material03 = new WireframeMaterial(0x0000FF);

material03.doubleSided = true;

material03.interactive = true; //イベント有効化

var cube03:Cube = new Cube(new MaterialsList({all : material03}),100,100,100,1,1,1);

world.scene.addChild(cube03);

cube03.x = -350;

var material04 = new WireframeMaterial(0x0000FF);

material04.doubleSided = true;

material04.interactive = true; //イベント有効化

var cube04:Cube = new Cube(new MaterialsList({all : material04}),100,100,100,1,1,1);

world.scene.addChild(cube04);

cube04.x = 175;

addEventListener(Event.ENTER_FRAME, loop);

// エンターフレームでのアニメーションを設定します

function loop(e:Event) {

cube.rotationY += 2;

cube.rotationX += 2;

cube02.rotationX -= 1;

cube02.rotationY += 2;

cube03.rotationX += 2;

cube03.rotationY -= 2;

cube04.rotationX -= 3;

cube04.rotationY -= 2;

}

//CameraType.FREE

world.camera.target = null;

//world.camera.focus = 20;

world.camera.y = 500;

world.camera.x = 0;

world.camera.z = 0;

world.camera.rotationY = 0;

world.camera.rotationX = 90;

cube.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler);

function OVERHandler(e:Event):void{

Tweener.addTween(world.camera,{y:200,x:0,time:1});

}

cube.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,OUTHandler);

function OUTHandler(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:500,x:0,time:1});

}

cube02.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler02);

function OVERHandler02(e:Event):void{

//world.camera.target = cube02;

Tweener.addTween(world.camera,{y:200,x:-150,time:1});

}

cube02.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,OUTHandler02);

function OUTHandler02(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:500,x:0,time:1});

}

cube03.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler03);

function OVERHandler03(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:200,x:-300,time:1});

}

cube03.addEventListener(InteractiveScene3DEvent.OBJECT_OUT,OUTHandler03);

function OUTHandler03(e:Event):void{

//world.camera.target = cube03;

Tweener.addTween(world.camera,{y:500,x:0,time:1});

}

cube04.addEventListener(InteractiveScene3DEvent.OBJECT_OVER,OVERHandler04);

function OVERHandler04(e:Event):void{

}

コメントを残す

メールアドレスが公開されることはありません。 * が付いている欄は必須項目です