Papervision 3D 2.0 / Great White Example
December 26th, 2007
If you haven’t heard from the whole Flash community Papervision 3D 2.0 is out w/ textures, more interactive features and new coding conventions like BasicRenderEngine Class. I was working on a Coverflow thing for a client a week ago that I abandoned and just moded Doug McCune. But when I was going to do it myself I was using the Great White Trunk.
Here is what I came up with:
[as]
package
{
import caurina.transitions.Tweener;
import flash.display.*;
import flash.events.Event;
import org.papervision3d.cameras.*;
import org.papervision3d.materials.*;
import org.papervision3d.objects.*;
import org.papervision3d.objects.primitives.*;
import org.papervision3d.render.BasicRenderEngine;
import org.papervision3d.scenes.*;
import org.papervision3d.view.Viewport3D;;
public class PV3DTest extends Sprite
{
[Embed(source="images/one.jpg")]
private var Pic:Class;
public var scene:Scene3D;
public var camera:Camera3D;
public var viewport:Viewport3D;
public var renderer:BasicRenderEngine;
private var photoContainer:Plane;
public function PV3DTest()
{
stage.scaleMode = StageScaleMode.NO_SCALE;
stage.align = StageAlign.TOP_LEFT;
init();
}
private function init():void
{
scene = new Scene3D()
camera = new Camera3D();
camera.focus = 500;
camera.zoom = 3;
renderer = new BasicRenderEngine();
viewport = new Viewport3D(stage.stageWidth, stage.stageHeight, false, false, true, true);
viewport.addEventListener(Event.ADDED_TO_STAGE, init3d);
addChild(viewport);
}
private function init3d(e:Event = null):void
{
var data:Bitmap;
var photoMat:BitmapMaterial;
data = new Pic() as Bitmap;
photoMat = new BitmapMaterial(data.bitmapData);
photoContainer = new Plane(photoMat, 220, 210, 6, 6);
camera.target = photoContainer;
//photoContainer.yaw(45);
scene.addChild(photoContainer);
renderer.renderScene(scene, camera, viewport);
addEventListener(Event.ENTER_FRAME, render);
}
private function render(evt:Event):void
{
Tweener.addTween(photoContainer, {rotationY: 45, transition:”linear”, time:.5});
Tweener.addTween(viewport, {x: 300, transition:”linear”, time:.5});
renderer.renderScene(scene, camera, viewport);
}
}
}
[/as]
Last 5 posts in as3
- HOWTO Create a Facebook App using FlexBuilder - June 24th, 2009
- Guitar Synth for Flash - February 27th, 2009
- Abstract Thermometer AIR app - January 22nd, 2009
- Roman Numeral/Arabic Convertion AIR App - Johnny V Now Available - December 25th, 2008
- How to convert Roman Numerals and Arabic numbers in ActionScript 3 - December 17th, 2008
Last 5 posts in flash
- HOWTO Create a Facebook App using FlexBuilder - June 24th, 2009
- Roman Numeral/Arabic Convertion AIR App - Johnny V Now Available - December 25th, 2008
- How to convert Roman Numerals and Arabic numbers in ActionScript 3 - December 17th, 2008
- Flash Player 10 Pure Flash Keyboard using SampleDataEvent - September 3rd, 2008
- Using Flash Player 10 to produce Dynamic Musical Notes - May 20th, 2008
Last 5 posts in Flex
- HOWTO Create a Facebook App using FlexBuilder - June 24th, 2009
- Adobe Evangelist Daniel Dura visits Travelocity - April 15th, 2008
- Yahoo Maps ActionScript 3.0 Released - February 11th, 2008
- Tidbit #3 - testing additions to your code - Control Variable - November 28th, 2007
- Flash/Flex Tidbit #1 - October 18th, 2007
Last 5 posts in papervision3D
- How to make a Rotating Cube in Papervision 3d - October 20th, 2007
Entry Filed under: Flex, as3, flash, papervision3D
1 Comment Add your own
1. Hadrien Vuillon | March 30th, 2009 at 11:16 am
Hi,
Did you manage to use the doug mc cune coverflow script for papervision 2.0 ? I am still fighting to update the code, to use a scene3D + viewport + basirenderer instead of the MovieScene3d.
Could you help me ?
Thanks in advance, Hadrien from France.
Leave a Comment
Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">
Trackback this post | Subscribe to the comments via RSS Feed