Papervision3D Spiral Carousel Example

Here is another Papervision3D example. This time I am extending a 3D carousel on the Y axis to create a spiral. There are 100 planes and the spiral rotates around 5 times. The Y of your mouse controls the Y of the spiral and the X position of the mouse controls the rotation. This could probably be useful for some type of list and it is at least somewhat different than the typical carousel.

[AS]import org.papervision3d.scenes.*;
import org.papervision3d.cameras.*;
import org.papervision3d.objects.*;
import org.papervision3d.materials.*;

// Create the container sprite
var con:Sprite = new Sprite();
con.x = stage.stageWidth * 0.5;
con.y = stage.stageHeight * 0.5;
addChild(con);

// Setup the scene
var scene:Scene3D = new Scene3D(con);
var cam:Camera3D = new Camera3D();
cam.zoom = 4;

// Create camera center
var pc:Plane = new Plane();
pc.visible = false;
cam.target = pc;

// Spiral properties
var num:int = 100;
var numOfRotations:Number = 5;
var anglePer:Number = ((Math.PI*2) * numOfRotations) / num;
var yPos:Number = 0;

// Create the planes
var pa:Array = new Array();
for(var i:uint=0; i {
var cm:BitmapAssetMaterial = new BitmapAssetMaterial("air");
cm.oneSide = false;
var p:Plane = new Plane(cm, 100, 100);
p.x = Math.cos(i * anglePer) * 550;
p.z = Math.sin(i * anglePer) * 550;
p.y = yPos += 50;
p.rotationY = (-i*anglePer) * (180/Math.PI) + 270;
scene.addChild(p);
}

// Create the render loop
addEventListener(Event.ENTER_FRAME, render);

var angle:Number = 0;

function render(e:Event):void
{
var dist:Number = ((stage.mouseY) - stage.stageHeight * 0.5) * -0.1;
var dist2:Number = ((stage.mouseX) - stage.stageWidth * 0.5) * 0.0005;
angle += dist2;
cam.x = Math.cos(angle) * 1000;
cam.z = Math.sin(angle) * 1000;
cam.y += dist;
if(cam.y < 369) cam.y = 369;
if(cam.y > 4755) cam.y = 4755;
pc.y = cam.y;
scene.renderCamera(cam);
}
[/as]


Commentary

  1. phys_pucca says:

    Wow, Lee! Incredible!
    Very nice. I will try to do this in FlashDevelop.
    Thank you. :)

  2. Otto says:

    Beautiful, incredible, and creative! I would love to see this being used as a search engine presentation, each little square has a picture preview of the website. Or a You Tube search with built-in player. Maybe even an eBay product search. The possibilities are endless! All in all, just brilliant!

  3. Kono says:

    Very nice, thank you.
    Haha, i saw the new logo of Air!

  4. Bill says:

    nice work, thanks for sharing.

  5. Sorin says:

    I don’n know if I place my post in the right place but I can’t acess your site.I recive a lot of error like this
    “VerifyError: Error #1014: Class flash.events::FullScreenEvent could not be found.
    at fl.video::FLVPlayback$iinit()
    at flash.display::Sprite/flash.display:Sprite::constructChildren()
    at flash.display::Sprite$iinit()
    at flash.display::MovieClip$iinit()
    at fotb_fla::MainTimeline$iinit()”

    and mach more.
    Any solution?
    Thanks

  6. JBOY says:

    I will send out my christmas wishlist like this… :o )

  7. You are really gone wild with these PV3D Examples ! :O

    Can it be nicer?

  8. Ncatdesigner says:

    Cool!

  9. KL says:

    Very Nice Indeed.

  10. lee says:

    Yeah Thanksgiving week is always a little boring for me so I have plenty of time to noodle around.

  11. Rackdoll says:

    Looking good Lee!
    Keep it up!

  12. LutinCapuche says:

    Splendide ! Thanks for sharing.

  13. Todd Lajoie says:

    I love it. Makes the Helix mod to the original carousel look antiquated!!!!

    (BTW, still waiting for my copy of CS3 before I get too into the PV3D stuff too much, but I’m DYING to get to work!!!)

  14. Rain says:

    This one is pretty sweet! I am starting to get into and work with Papervision3D, so learning from these examples is great!

  15. Dean Mellis says:

    Lee,
    One thing I noticed was that to get the Air logos to properly align to their shapes, you had to move the following lines of code above the for loop they’re currently in:
    var cm:BitmapAssetMaterial = new BitmapAssetMaterial(“air”);
    cm.oneSide = false;

    That’s lines 32 and 33.

  16. Sinistar says:

    Yes, Dean Mellis is right: the code is wrong.
    Thanks anyway, cool example!

  17. john says:

    Hi Lee!
    Could you explain how to use MovieMaterial class?
    I just coldn’t make it work…

  18. Andrew says:

    Wow!

    Actually, you could use it to visualise a DNA helix…

    You may have a new market there Lee,

    Thanks

  19. lee says:

    Hmmm, just a coincidence? :)

  20. Titus says:

    Lee,
    Awesome man! I want to say thanks for all your tutorials and excellent inspirations like this. Will you be offering source code for this so I can create some cool stuff as well?
    Thanks again and God Bless,
    Titus

  21. trioptic says:

    elegant in it’s simplicity. great work, thanks for making it look so easy, ha.

  22. Tim says:

    Hi Lee,

    Awesome example, I was just looking over it for fun. One request, can you try to not use “magic numbers” in future examples? I am not sure what a lot of those numbers are in some of the expressions your writing.

    For an intermediate coder like me I would love to see these magic numbers stored into a descriptively named variable, or perhaps just some comments would be helpful as well.

    Thanks. Keep up the great work!!
    Tim

  23. Frederik Heyninck says:

    Hey Lee
    How is it possible to load an external image or swf into the carrousel?

  24. It is really amazing! I was trying your code, but he keep throwing to me this exception
    1046: Type was not found or was not a compile-time constant: Event.
    I am looking for a way to solve this…

  25. How am I supposed to find stuff on here?

  26. xdoit says:

    Francesco De Collibus

    OK…you can show the solved?

  27. bushwa says:

    your an inspiration, keep it up.

  28. animatingsoul says:

    buddy, am sorry, i could get a look of ur work.. if possible just guide me yaar

  29. Zanemx says:

    nice….I think paperVision is a great as3 tool. Check out my site. I have put a few things together using as3 and the paperVision lib

  30. Sean says:

    It would really be cool to see like a website built out of this effect. I can think of some pretty sweet ideas. A space theme would also be amazing with it make nebulas and such for a navigation.
    Great Job though I like this a lot.

  31. Marc Pelland says:

    Really nice work !

  32. raju says:

    a lot of thanx to u, because you r helping to me in the learning period, i learned from ur photogalleries, templates….etc.

  33. sam says:

    Hi Lee,

    This is a great script, thanks for sharing. I’ve modified it to take in a dynamic array of images using PHP remoting to make a scalable image gallery. I’ll credit your stuff in the source…

    Cheers,

    Sam

  34. aurelien says:

    great stuff!

    I am having a lot of fun with this example

    I was wondering if it is possible to put the camera inside the spiral and therefore rotate on itself instead of rotating around the spiral.

    Best,

    Aurel

  35. Dave says:

    This is cool, but it’d look even better if you combined it with your Depth of Field demo!

  36. Nik says:

    Hi Lee..Am a very beginner to paper vision 3d and AS3. I tried lots and I failed…How i canconvert this spiral into z axis..I mean look from the top…? Can you please help me?

  37. suyash says:

    Hi,
    I want to add some basic interactivity to my spiral.
    Like when I click on a thumb(read as plane),the camera should seamlessly tween to bring it into focus.
    Can you suggest how can I do that.
    Thanks in advance.

  1. Spiral Carousel XML linked here

    [... Here is another Papervision3D example. This time I am extending a 3D carousel on the Y axis to create a spiral. There are 100 planes and the spiral rotates around ...]

  2. [... Here is another Papervision3D example. This time I am extending a 3D carousel on the Y axis to create a spiral. There are 100 planes and the spiral rotates around ...]

  3. [... Here is another Papervision3D example. This time I am extending a 3D carousel on the Y axis to create a spiral. There are 100 planes and the spiral rotates around ...]

  4. [... Here is another Papervision3D example. This time I am extending a 3D carousel on the Y axis to create a spiral. There are 100 planes and the spiral rotates around ...]

  5. [... Here is another Papervision3D example. This time I am extending a 3D carousel on the Y axis to create a spiral. There are 100 planes and the spiral rotates around ...]

Leave a Comment