PicLens 2.0 in Flash with Papervision3D: Part II

This time (see PicLens in Flash with Papervision3D 2.0 ) public code ( PicLens.as ), I had to revise some parts of code, align it with the latest release of Papervision3D 2.0 Great White and I made ​​some adjustments and additions. I have included in this demo also a number of Knob, knobs, to change certain runtime parameters.

Simulation of motion PicLens

To get as close as possible to the horizontal movement of PicLens original, I used a little trickery by inserting a "not visible" DisplayObject3D target for the room:

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

In practice, the camera always points to the DisplayObject3D Image gallery behind the series. When the camera moves (with an accelerated motion / inertia) also DisplayObject3D follows, but with a slight delay. This allowed me to make the effect of motion of the soft and very similar to that performed on the original PicLens:

1
2
x + = ( ( __slider . Value - __bv . cameraAsCamera3D . x ) / 10 ) / 2.2 ; __bv. cameraAsCamera3D. x + = ((__slider. Value - __bv. cameraAsCamera3D. x) / 10) / 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 simpler and more powerful function:

1
position + = ((posizionefinale - position) / acceleration) / inertia;

In the demo you can change some parameters: focus, zoom and target. This is the position of the DisplayObject3D than 99 images! By changing this position, you will notice changes in the movement of the whole scene.
Focus and zoom are environment properties Papervision3D.

Interaction

Try clicking on the images ... ;)

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

  1. July 3, 2008 Oliver Semrau :

    Projekt: Het groente en fruit lab ...

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

  2. September 15, 2008 MairoN001:

    Hello I tested your example of the style gallery PicLens and I must say I loved it, your levels are not yet but I am studying several days and I slam my head on how to pass a filter to a single img.
    You place a piece of my code to better explain

    DELI IN CYCLE WHERE YOU HAVE THE GRID WITH INSERT IMG:

    1
    ( InteractiveScene3DEvent . OBJECT_OVER , fnc_ObjRlOver ) photo1. addEventListener (InteractiveScene3DEvent. OBJECT_OVER, fnc_ObjRlOver)

    and then I create the following function

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

    In this way I would like to rollover the lights ... single IMG.
    just so the filter is assigned to all but if I put img e.displayObject3D me error

    an example of looking around I found that Papervision uses InteractiveSceneManager to assign a filter to an event you would know ... Over advise me on how to set it in your example?
    as it continues to give me error?

    Thank you very much

  3. September 15, 2008 Giovambattista Fazioli :

    @ MairoN001: You did everything right! Just add a line when creating objects. aggiungi: In practice, when the temporary object initialized photo1 , in the loop of creation, before addEventLister() add:

      photo1.useOwnContainer = true; 

    In the event fnc_ObjRlOver use something like:

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

    and everything will work! : P

  4. September 16, 2008 MairoN001:

    Thanks so much for the answer that works perfectly only with "useOwnContainer"
    Click will disable.

    I've seen around that works on r577 but not on the 578 +

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

    I will see if I can find a solution to document in the meantime I would be grateful if you could you tell me more about it.

    Anyway thanks again for the answer.

  5. September 16, 2008 MairoN001:

    Ok I found a solution now works half the click but not the Double Click =)
    place my temporary solution so if it should be useful to qualkun'altro safely read.
    From what I've seen around in papervision to apply filters to the primitives must use viewport layers. Maybe you put the code easier to understand ;)
    THE PACKAGE:

      org.papervision3d.view.layer.ViewportLayer imports; 

    IN CLASS:

      private var layer: ViewportLayer; 

    THE FUNCTION: initObjects

    1
    2
    3
    4
    Plane= new Plane ( __matarray [ i ] , THUMBNAIL_WIDTH , THUMBNAIL_HEIGHT , 0 , 0 ) ; var photo1: Plane = new Plane (__matarray [i], THUMBNAIL_WIDTH, THUMBNAIL_HEIGHT, 0, 0);
    addChild ( photo1 ) ; __BasicVw. Scenes. AddChild (photo1);
    getChildLayer ( photo1 , true ) ; layer = __BasicVw. viewport. getChildLayer (photo1, true);
    ( InteractiveScene3DEvent . OBJECT_OVER , fnc_ObjRlOver ) photo1. addEventListener (InteractiveScene3DEvent. OBJECT_OVER, fnc_ObjRlOver)

    THE FUNCTION: fnc_ObjRlOver

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

    I hope 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 with this solution works but not the click the Double try to understand why and if I discover the place ... again and again thanks for the advice without that incentive who knows how long I lost again XD

  6. September 16, 2008 Giovambattista Fazioli :

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

  7. September 16, 2008 MairoN001:

    Tortoise and use every day throughout riuppo ;)

  8. September 16, 2008 Giovambattista Fazioli :

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

  9. September 16, 2008 MairoN001:

    I must say that tortoise is a software very useful and I know that for a couple of days I will torture you with questions related to the gallery =)

    Continuing to analyze the gallery I could not help but notice that in the cycle start at the Img 4 .. I think it is due to inner loop qualke to Papervision3D is not it? could you tell me why?

    thk u

  10. September 17, 2008 Giovambattista Fazioli :

    @ MairoN001: where exactly you saw this Click Submit for from 4?

  11. September 17, 2008 MairoN001:

    Function: initObject
    cycle:

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

    the cycle moves on a regular basis but plans begin with "ID4" instead of "0"
    I noticed in doing this for a trace

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

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

  12. September 17, 2008 MairoN001:

    Another tip for those who always wanted to work on the gallery following the example of PicLens:
    at the time when you clik on a photo will enlarge the img, but if it had been previously clicked another unselected should return to its original position, so as to see more and larger only one selected, from here on I had a problem qualke so I checked and studied how to create their plane and made available to recreate the photos back and forth gioketto I had to create a listener clicks on the attachment as shown:

    FUNCTION initObject :

    1
    addEventListener ( InteractiveScene3DEvent . OBJECT_CLICK , fnc_ObjClk ) and. displayObject3D. addEventListener (InteractiveScene3DEvent. OBJECT_CLICK, fnc_ObjClk)

    FUNCTION: fnc_ObjClk

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    displayObject3D . id ; var = and obj_select. displayObject3D. id;
    Number = 0 ; var k: Number = 0;
    4 ; // HACK PER PLANE SU PV3D CHE PARTONO DA 4 allThb THUMBNAIL_NUMBER var = + 4 / / HACK FOR PLANE ON PV3D starting from 4

    k= 4 ; k & lt ; allThb ; k ++ ) // IN QUESTO MODO I PRIMI 4 VUOTI LI SALTA for (k = 4, k & lt; allThb k + +) / / THIS WAY IN THE FIRST 4 EMPTY SKIP THEM
    {
    obj_select ! = k ) if (obj_select! = k)
    {
    Plane = __bv . scene . getChildByName ( String ( k ) ) as Plane ; Any var: = Plane __bv. scenes. getChildByName ( String (k)) as Plane;
    Any , 'z' , Strong . easeOut , Any . z , 0 , 1 , true ) ; new Tween (Any, 'z', Strong. easeOut, Any. z, 0, 1, true);
    }
    }

    I hope it can be helpful =)

  13. September 17, 2008 Giovambattista Fazioli :

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

  14. March 8, 2009 デフラグツール. | Kots blog:

    PicLens [...] in Flash with Papervision3D 2.0: Part II http://www.undolog.com/2008/06/17/piclens-in-flash-con-papervision3d-20-parte-ii/ [... ]

Leave a comment

XHTML TAG PERMIT: <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 [cc_actionscript][/cc_actionscript] // Actionscript [cc_actionscript3][/cc_actionscript3] // Actionscript 3 [cc_css][/cc_css] // CSS Style Sheet [cc_html][/cc_html] // HTML [cc_js][/cc_js] // Javascript [cc_objc][/cc_objc] // Objective-C [cc_php][/cc_objc] // PHP [cc_sql][/cc_sql] // SQL