FIVe3D: special effects on a cube! Pending Flash 10
Friday, May 16, 2008Most likely, when it launches the new version of Adobe Flash, 3D libraries with a "low level" as FIVe3D will make a bad end! However, before you trash, here's an example of what can be achieved (with the latest release 2.1):
The code of the demo above is quite articulate, so I do not propose entirely online. Insert, however, some interesting pieces of code.
Update: For the source click here
Container 3D
The first thing is the ability to create (as happens with Papervision3D and under normal operations with the MovieClip in Flash) of containers of 3D objects. To realize the cube, in fact, I created a container object __cube and to this I added the faces of the cube!
- / *
- ** @ Name: initCube ()
- * /
- initCube ( ) : void { protected function initCube (): void (
- ; __cube = new Sprite3D ();
- ; __cube. rotationX = 40;
- 40 ; __cube. rotationY = - 40;
- = false ; __cube. mouseChildren = false;
- = [ ( new BlurFilter ( 2 , 2 , BitmapFilterQuality . HIGH ) ) ] ; __cube. filters = [(new BlurFilter (2, 2, BitmapFilterQuality. HIGH))];
- ( __cube ) ; __scene. addChild (__cube);
- 0 , - 150 , 0 , 0 , 0 ) ; createFace (0, 0, - 150, 0, 0, 0);
- 0 , 0 , 0 , - 90 , 0 ) ; createFace (150, 0, 0, 0, - 90, 0);
- 0 , 150 , 0 , 180 , 0 ) ; createFace (0, 0, 150, 0, 180, 0);
- 150 , 0 , 0 , 0 , 90 , 0 ) ; createFace (- 150, 0, 0, 0, 90, 0);
- 150 , 0 , - 90 , 0 , 0 ) ; createFace (0, - 150, 0, - 90, 0, 0);
- 150 , 0 , 90 , 0 , 0 ) ; createFace (0, 150, 0, 90, 0, 0);
- )
__cube is added to the scene __scene and within __cube added the "faces":
- / *
- ** @ Name: createFace ()
- * /
- Sprite3D = new Sprite3D ( ) ; var face: Sprite3D = new Sprite3D ();
- beginFill ( 0xff0000 ) ; face. graphics3D. beginFill (0xff0000);
- drawRect ( - 150 , - 150 , 300 , 300 ) ; face. graphics3D. drawRect (- 150, - 150, 300, 300);
- endFill ( ) ; face. graphics3D. endFill ();
- = x ; face. x = x;
- = y ; face. y = y;
- face. z = z;
- face. rotationX = rotationx;
- face. rotationY = rotationy;
- face. rotationZ = rotationz;
- ; face. singleSided = true;
- ; face. flatShaded = true;
- ( face ) ; __cube. addChild (face);
- )
The scene, of course, is the classic one, with the added use of the parameter ambientLightIntensity
- / *
- ** @ Name: initScene ()
- * /
- initScene ( ) : void { protected function initScene (): void (
- ; __scene = new Scene3D ();
- = stage . stageWidth / 2 ; __scene. x = Stage. stageWidth / 2;
- = stage . stageHeight / 2 ; __scene. y = Stage. stageHeight / 2;
- ; __scene. viewDistance = 400;
- ; __scene. ambientLightIntensity = 1;
- __scene ) ; addChild (__scene);
- )













FIVe3D: special effects on a cube! Pending Flash 10 ...
Most likely, when it launches the new version of Adobe Flash, 3D libraries with a "low level" as FIVe3D make a bad end! However, before you trash, here's an example of what can be achieved (with the latest release 2 ...
Hello everyone,
Have you seen this incredible 3D engine for Flash Player?
http://www.sophie3d.com