Sorry for putting this up so late. This code is only used to arrange the items on the stage. Much work and re-working will need to be done to even start to achieve the effect of the ecodazoo website. Anyways, perhaps this will get someones brain moving in the right direction and help lead us in the path to re-creating this effect fully. As soon as I get some free time I will post a version that is a true popup book in papervision.
If anyone gets a chance sooner to do some cool things with the code please shoot me an email or a blog post and I would love to share it, with myself and with everyone else. ![]()
Don't forget the other code you will need to compile:
2) Tweener
-
package {
-
import caurina.transitions.Tweener;
-
import org.papervision3d.cameras.FreeCamera3D;
-
import org.papervision3d.core.data.qTree.QuadTree;
-
import org.papervision3d.objects.DisplayObject3D;
-
import com.foomonger.utils.Later;
-
import flash.display.*;
-
import flash.events.Event;
-
import flash.events.MouseEvent;
-
import org.papervision3d.cameras.Camera3D;
-
import org.papervision3d.materials.ColorMaterial;
-
import org.papervision3d.materials.MovieMaterial;
-
import org.papervision3d.objects.primitives.Cube;
-
import org.papervision3d.objects.primitives.Plane;
-
import org.papervision3d.render.BasicRenderEngine;
-
import org.papervision3d.scenes.Scene3D;
-
import org.papervision3d.view.Viewport3D;
-
public class Main extends Sprite
-
{
-
private var __camera :FreeCamera3D;
-
private var __scene :Scene3D;
-
private var __viewport :Viewport3D;
-
private var __renderer :BasicRenderEngine;
-
private var __width :Number;
-
private var __height :Number;
-
private var __background :Shape;
-
protected var __wallLeft
isplayObject; -
protected var __wallRight
isplayObject; -
protected var __wallBack
isplayObject; -
protected var __floor :DisplayObject;
-
protected var __tree
isplayObject; -
protected var __monster :DisplayObject;
-
protected var __moveMatWallLeft :MovieMaterial;
-
protected var __moveMatRightWall :MovieMaterial;
-
protected var __moveMatWallBack :MovieMaterial;
-
protected var __moveMatFloor :MovieMaterial;
-
protected var __moveMatTree :MovieMaterial;
-
protected var __moveMatMonster :MovieMaterial;
-
protected var __plane_wallLeft
lane; -
protected var __plane_rightWall
lane; -
protected var __plane_wallBack
lane; -
protected var __floorPlane :Plane;
-
protected var __treePlane
lane; -
protected var __monsterPlane
lane; -
protected var __rotation :Number;
-
public function Main():void
-
{
-
init();
-
}
-
protected function init():void
-
{
-
__rotation = 0;
-
setDefaultWidthHeight();
-
createChildren();
-
initPapervision();
-
initMaterials();
-
initObjects();
-
initEvents();
-
}
-
protected function setDefaultWidthHeight():void
-
{
-
__width = 1000;
-
__height = 600;
-
}
-
protected function initPapervision():void
-
{
-
__scene = new Scene3D();
-
__camera = new FreeCamera3D();
-
__camera.zoom = 11;
-
__camera.z = -2000;
-
__camera.y = 20;
-
__viewport = new Viewport3D(__width,__height,false,true,true);
-
__renderer = new BasicRenderEngine();
-
addChild(__viewport);
-
}
-
protected function initMaterials():void
-
{
-
__moveMatRightWall = new MovieMaterial(__wallRight, true)
-
__moveMatWallLeft = new MovieMaterial(__wallLeft, true);
-
__moveMatWallBack = new MovieMaterial(__wallBack)
-
__moveMatFloor = new MovieMaterial(__floor);
-
__moveMatTree = new MovieMaterial(__tree, true );
-
__moveMatMonster = new MovieMaterial(__monster, true);
-
__moveMatRightWall.doubleSided = true;
-
__moveMatWallLeft.doubleSided = true;
-
__moveMatWallBack.doubleSided = true;
-
__moveMatTree.doubleSided = true;
-
__moveMatFloor.doubleSided = true;
-
__moveMatTree.doubleSided = true;
-
__moveMatMonster.doubleSided = true;
-
}
-
protected function initObjects():void
-
{
-
__monsterPlane = new Plane(__moveMatMonster, 184, 237, 4, 4);
-
__plane_rightWall = new Plane(__moveMatRightWall, 386, 239, 4,4)
-
__plane_wallBack = new Plane(__moveMatWallBack, 734, 240, 4,4);
-
__plane_wallLeft = new Plane(__moveMatWallLeft,386,239,4,4)
-
__floorPlane = new Plane(__moveMatFloor, 800, 800, 14,14);
-
__treePlane = new Plane(__moveMatTree, 79, 112, 4, 4);
-
__scene.addChild(__floorPlane);
-
__scene.addChild(__plane_wallBack);
-
__scene.addChild(__treePlane);
-
__scene.addChild(__plane_wallLeft);
-
__scene.addChild(__plane_rightWall);
-
__scene.addChild(__monsterPlane);
-
__floorPlane.y = -120;
-
__treePlane.y = -69;
-
__floorPlane.pitch(90);
-
__monsterPlane.z = -300;
-
__monsterPlane.x = 150;
-
__monsterPlane.y = -10;
-
__plane_wallBack.z += 340
-
__treePlane.z = 300;
-
__treePlane.x = -220;
-
__plane_wallLeft.x = -155;
-
__plane_rightWall.x = 155;
-
__plane_wallLeft.rotationY = -35;
-
__plane_rightWall.rotationY = 35
-
}
-
protected function initEvents():void
-
{
-
this.addEventListener(Event.ENTER_FRAME,render);
-
}
-
protected function render(e:Event):void
-
{
-
__renderer.renderScene(__scene, __camera, __viewport, true);
-
var moveXAmount:Number = (mouseX - 1000 / 2) * 4
-
var moveYAmount:Number = (mouseY - 600 / 2) * 2
-
if (moveYAmount <0)
-
{
-
moveYAmount = 0;
-
}
-
__camera.x = moveXAmount;
-
__camera.y = moveYAmount;
-
__camera.lookAt(__floorPlane)
-
}
-
protected function createChildren():void
-
{
-
//Movieclips with Export for AS in Library
-
__wallBack = new Wall_back();
-
__wallLeft = new Wall_left();
-
__wallRight = new Wall_right();
-
__floor = new Floor();
-
__tree = new Tree();
-
__monster = new Monster();
-
}
-
}
-
}


Recent Comments