FIVe3D: special effects on a cube! Pending Flash 10

Friday, May 16, 2008

Most 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):

Loading Flash Player ...

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!

ActionScript
  1. / *
  2. ** @ Name: initCube ()
  3. * /
  4. initCube ( ) : void { protected function initCube (): void (
  5. ; __cube = new Sprite3D ();
  6. ; __cube. rotationX = 40;
  7. 40 ; __cube. rotationY = - 40;
  8. = false ; __cube. mouseChildren = false;
  9. = [ ( new BlurFilter ( 2 , 2 , BitmapFilterQuality . HIGH ) ) ] ; __cube. filters = [(new BlurFilter (2, 2, BitmapFilterQuality. HIGH))];
  10. ( __cube ) ; __scene. addChild (__cube);
  11. 0 , - 150 , 0 , 0 , 0 ) ; createFace (0, 0, - 150, 0, 0, 0);
  12. 0 , 0 , 0 , - 90 , 0 ) ; createFace (150, 0, 0, 0, - 90, 0);
  13. 0 , 150 , 0 , 180 , 0 ) ; createFace (0, 0, 150, 0, 180, 0);
  14. 150 , 0 , 0 , 0 , 90 , 0 ) ; createFace (- 150, 0, 0, 0, 90, 0);
  15. 150 , 0 , - 90 , 0 , 0 ) ; createFace (0, - 150, 0, - 90, 0, 0);
  16. 150 , 0 , 90 , 0 , 0 ) ; createFace (0, 150, 0, 90, 0, 0);
  17. )

__cube is added to the scene __scene and within __cube added the "faces":

ActionScript
  1. / *
  2. ** @ Name: createFace ()
  3. * /
  4. createFace ( x : Number , y : Number , z : Number , protected function createFace (x: Number, y: Number, z: Number,
  5. , rotationy : Number , rotationz : Number ) : void { rotationx: Number, rotationy: Number, rotationz: Number): void (
  6. Sprite3D = new Sprite3D ( ) ; var face: Sprite3D = new Sprite3D ();
  7. beginFill ( 0xff0000 ) ; face. graphics3D. beginFill (0xff0000);
  8. drawRect ( - 150 , - 150 , 300 , 300 ) ; face. graphics3D. drawRect (- 150, - 150, 300, 300);
  9. endFill ( ) ; face. graphics3D. endFill ();
  10. = x ; face. x = x;
  11. = y ; face. y = y;
  12. face. z = z;
  13. face. rotationX = rotationx;
  14. face. rotationY = rotationy;
  15. face. rotationZ = rotationz;
  16. ; face. singleSided = true;
  17. ; face. flatShaded = true;
  18. ( face ) ; __cube. addChild (face);
  19. )

The scene, of course, is the classic one, with the added use of the parameter ambientLightIntensity

ActionScript
  1. / *
  2. ** @ Name: initScene ()
  3. * /
  4. initScene ( ) : void { protected function initScene (): void (
  5. ; __scene = new Scene3D ();
  6. = stage . stageWidth / 2 ; __scene. x = Stage. stageWidth / 2;
  7. = stage . stageHeight / 2 ; __scene. y = Stage. stageHeight / 2;
  8. ; __scene. viewDistance = 400;
  9. ; __scene. ambientLightIntensity = 1;
  10. __scene ) ; addChild (__scene);
  11. )

Related Post

Was this article helpful?: Per nientePocoAbbastanzaMoltoMoltissimo
Loading ... Loading ...

2 comments to "FIVe3D: special effects on a cube! Pending Flash 10 "

  1. getAvatar 1.0
    09 lug, 2008 groggit.com:

    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 ...

  2. getAvatar 1.0
    02 ott, 2008 XOS:

    Hello everyone,
    Have you seen this incredible 3D engine for Flash Player?

    http://www.sophie3d.com

Leave a comment

TAG XHTML PERMISSIONS: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> INSERTION CODE:
 <pre></pre>         // blocco generico [code][/code]       // blocco generico [as][/as]           // Actionscript [css][/css]         // CSS Style Sheet [html][/html]       // HTML [js][/js]           // Javascript [objc][/objc]       // Objective-C [php][/php]         // PHP [sql][/sql]         // SQL