PicLens in Flash with Papervision3D 2.0: Part II

Tuesday, June 17, 2008

This time (see Piclens to Flash with Papervision3D 2.0) public code (PicLens.as), I had to revise some parts of code, thus aligning the latest releases of Papervision3D 2.0 Great White and I made some adjustments and additions. I entered in this demo also a number of Knob, knobs, runtime to change some parameters.

Simulation of motion PicLens

To close as possible to the horizontal movement of PicLens original, I used a small way by including an "invisible" DisplayObject3D target for the room:

Actionscript:
  1. ; __fooTarget = new DisplayObject3D ();
  2. ...
  3. = __fooTarget; __bv. cameraAsCamera3D. __fooTarget = target;

In practice room always tip the DisplayObject3D place behind the series of immmagini. When the camera moves (with a movement accelerated / inertial) also DisplayObject3D the following, but with a slight delay. This allowed me to make the effect of motion smooth and quite similar to that achieved on PicLens original:

Actionscript:
  1. += ( ( __slider. Value - __bv. cameraAsCamera3D . x ) / 10 ) / 2 . 2 ; __bv. cameraAsCamera3D. x + = ((__slider. Value - __bv. cameraAsCamera3D. x) / 10) / 2. 2;
  2. __slider. Value - __fooTarget. x ) / 5 ) / 2 . 2 ; __fooTarget. x + = ((__slider. Value - __fooTarget. x) / 5) / 2. 2;

I have not used any Tween, but a more simple and efficient function:

CODE:
  1. /accelerazione ) /inerzia; Position + = ((posizionefinale - position) / acceleration) / inertia;

In the demo you can change some parameters: focus, zoom and targets. This is the position of DisplayObject3D compared to 99 pictures! By changing this position you will notice changes in movement of the scene.
Focus and Zoom are property of Papervision3D.

Interaction

Just click on the pictures ... ;)

Related Post

13 comments to: "PicLens in Flash with Papervision3D 2.0: Part II"

  1. getAvatar 1.0 Thursday, 03 July, 2008 at 17:24
    Oliver Semrau said:

    Projekt: Het groente en fruit lab ...

    Für die Fondation Louis Bonduelle kindgerechtes Informationsportal wurde ein auf der Basis von Adobe Flash produziert. Aufgabe war es, den Kindern und die Vorteile von geheimen Superkräfte Früchten spielerisch näher Gemüse und zu bringen. Zusamme ...

  2. getAvatar 1.0 Monday, September 15th, 2008 at 19:16
    MairoN001 said:

    Hello, I analyzed the example of your style gallery piclens and I must say that I liked very much, not even to your level but I am studying several days and I banged my head on how to pass a filter to a single img.
    You place a piece of my code to better explain

    INSIDE STAGE DELI WHERE HAVE THE GRID WITH IMG POST:

      photo1.addEventListener (InteractiveScene3DEvent.OBJECT_OVER, fnc_ObjRlOver) 

    and then I created the following function

      fnc_ObjRlOver function (e: InteractiveScene3DEvent): void ( 
      new Tween (e.displayObject3D, 'z', Strong.easeOut, e.displayObject3D.z, -10, 1, true); 
      e.sprite.filters = [new GlowFilter (0xffffff, 0.60, 10,10,2,1)]; 
      ) 

    In this way I would like to rollOver the individual IMG lights ....
    just so that the filter is assigned to all img but if I put e.displayObject3D me by mistake

    Looking around at an example I found that Papervision uses InteractiveSceneManager to assign a filter for an event rid of mice ... Over on how to set it in your example?
    as I continue to give mistake?

    Thank you very much

    Answer Quote
  3. getAvatar 1.0 Monday, September 15th, 2008 at 21:50
    Giovambattista Fazioli said:

    @ MairoN001: You did so good! You just add a line when you create objects. In practice, when the object initializes temporary photo1 in the loop of creation, before addEventLister() add:

      photo1.useOwnContainer = true; 

    In the fnc_ObjRlOver use instead:

      e.displayObject3D.filters = [new GlowFilter (0xffffff, 0.6, 10,10,2,1)]; 

    and everything will work! : P

    Answer Quote
  4. getAvatar 1.0 Tuesday 16 September, 2008 at 15:33
    MairoN001 said:

    Thank you very much for your answer is fine except that entering "useOwnContainer"
    Click the disability is.

    I saw working around the r577 but not the 578 +

    The release that I use is the Great White of 09 September 9th, 2008.

    clear from documents where I find a solution in the meantime you will be grateful if sapresti tell me something more about it.

    Anyway, thanks again for your reply.

    Answer Quote
  5. getAvatar 1.0 Tuesday 16 September, 2008 at 16:20
    MairoN001 said:

    Ok I have found half a solution now does not click but the Double Click =)
    place my temporary solution so should it be useful to qualkun'altro can easily read.
    From what I saw around on papervision to apply filters to the primitive must use the viewport layers. Place the Code is perhaps easier to understand ;)
    THE PACKAGE:

      org.papervision3d.view.layer.ViewportLayer import; 

    IN CLASS:

      var private layer: ViewportLayer; 

    THE FUNCTION: initObjects

      var photo1: Plane = new Plane (__matarray [i], THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, 0, 0); 
      __BasicVw.scene.addChild (Photo1); 
      layer = __BasicVw.viewport.getChildLayer (photo1, true); 
      photo1.addEventListener (InteractiveScene3DEvent.OBJECT_OVER, fnc_ObjRlOver) 
    

    THE FUNCTION: fnc_ObjRlOver

      e.displayObject3D.container.filters = [new GlowFilter (0xffffff, 0.60, 10,10,2,1)]; 

    I hope that this code can be useful to other perk the place I lost 3 days to find out how to put a filter on a plane in PVS3D this solution works with the click but not the Double try to understand why and if I discover the place ... To time thanks to the council without the incentive who knows how long I would have lost yet XD

    Answer Quote
  6. getAvatar 1.0 Tuesday 16 September, 2008 at 17:22
    Giovambattista Fazioli said:

    @ MairoN001: excellent reporting! We will see what comes out :) You still have installed the latest version of Papervision3D? Why have officially released the 2.0, remove from the beta branch.

    Answer Quote
  7. getAvatar 1.0 Tuesday 16 September, 2008 at 17:46
    MairoN001 said:

    Tortoise and use every day all riuppo ;)

    Answer Quote
  8. getAvatar 1.0 Tuesday 16 September, 2008 at 17:52
    Giovambattista Fazioli said:

    @ MairoN001: perfect! It was exactly what I wanted to know! I also use Tortoise SVN :) and before I start to develop a good "Update" : P

    Answer Quote
  9. getAvatar 1.0 Tuesday 16 September, 2008 at 22:35
    MairoN001 said:

    I must say that Tortoise is a really useful software and I know that for a couple of days you torturero with questions relating to the gallery =)

    By continuing to analyze the gallery I could not help but note that in departing Img the cycle 4 .. I think it is due to qualke cycle internal Papervision3D or wrong? sapresti tell me why?

    THK u

    Answer Quote
  10. getAvatar 1.0 Wednesday, September 17, 2008 at 14:06
    Giovambattista Fazioli said:

    @ MairoN001: Where exactly did you see this cliclo for 4?

    Answer Quote
  11. getAvatar 1.0 Wednesday, September 17, 2008 at 15:29
    MairoN001 said:

    Function: initObject
    cycle:

      for (var i = 0; i <__thnumber; i + +) 

    the cycle proceeds on a regular basis but plans begin with "ID4" rather than "0"
    I am running a trace into this for

      trace ( "PLANE ID =" + __bv.scene.getChildByName (String (i))) 

    After the photo assigned to plans
    the first 4 tracks are null o_0 "

    Answer Quote
  12. getAvatar 1.0 Wednesday, September 17, 2008 at 15:44
    MairoN001 said:

    Other advice for those who want to work on the gallery follow the example of piclens:
    when you Click on a img you enlarge the photo, but if it had been previously clicked another those not selected should return to its original, so as to always see only the selected larger, from then on I had qualke problem I checked for that and studied how to create the plane and made available in order to recreate the gioketto forward and backward pictures, I had to create a click on the listener as an example:

    FUNCTION initObject

      e.displayObject3D.addEventListener (InteractiveScene3DEvent.OBJECT_CLICK, fnc_ObjClk) 

    FUNCTION: fnc_ObjClk

      var obj_select = e.displayObject3D.id; 
      var k: Number = 0; 
      var allThb = THUMBNAIL_NUMBER + 4 / / HACK FOR PLANE ON PV3D beginning at 4 
    
      for (k = 4; k <allThb k + +) / / THIS WAY IN THE FIRST 4 EMPTY THEM SKIP 
      ( 
           if (obj_select! = k) 
    	  ( 
    	  Any var: Plane __bv.scene.getChildByName = (String (k)) as Plane; 
    	  new Tween (Any, 'z', Strong.easeOut, Any.z, 0, 1, true); 
    	  ) 
      ) 
    

    I hope that can be useful =)

    Answer Quote
  13. getAvatar 1.0 Wednesday, September 17, 2008 at 16:59
    Giovambattista Fazioli said:

    @ MairoN001: for the cycle is due to deep levels associated with Papervision, nothing relevant to the end of the operation code : P

    Answer Quote

Leave a comment

TAG XHTML <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <a <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Use <pre> to enclose code