AdvancED Flex 4 is now available to pre-order on Amazon.com. I had the privilege to work on this book with Elad Elrom and Shashank Tiwari. Once you get a copy please be sure to let us know what you think.
Charlie Schulze
Papervision2.com – Best resource for Papervision3d tutorials
AdvancED Flex 4 is now available to pre-order on Amazon.com. I had the privilege to work on this book with Elad Elrom and Shashank Tiwari. Once you get a copy please be sure to let us know what you think.
Charlie Schulze
As a simple addition to yesterday's coverflow post, I wanted to show the same example but with loading images via XML. For simplicity sake the XML is loaded and parsed all in the main file.
The structure for our XML is very simple:
We simply load our XML file with BulkLoader
Parse the results, now adding the images to the BulkLoader:
When our images are ready we can continue the process of setting up our coverflow. But now using the images we just loaded for our materials.
It's that simple. Be sure to let us know if you find this useful and are able to use it in a project.
Here is the full code:
There are several great AS3 / Papervision Coverflows out there but today I set out to create one in it's simplest form. There are no bells and whistles, just a stripped down coverflow with it's core functionality. It's up to you to add an XML feed, Flickr feed, or setup your images in an array and load them the way you want to. This is only meant to be a clean jumping off point.
In the download I have included 2 versions. One with left / right buttons and one without. Both versions you can select the items in the coverflow to navigate.
The heart of this coverflow app is a lot like some of the others. We need to calculate the x and rotation of the center item, left items, and right items are, then animate accordingly. This is the same way that John Dyer animates his coverflow.
For this simple version of coverflow you have two ways of navigating to items.
Selecting a plane to jump right to that item
Or using left / right buttons to navigate one item at a time:
On to the full source code. This version includes the left / right buttons.
That's it. This should provide a good base for you to build out your own unique coverflow.
In early 2008 I wrote a blog article on how to explode an image and rebuild it again. Recently this effect has been used in some amazing ways. Site's like Audi have taken this concept much further with the rows of these tiny boxes swimming in formation.
Today I decided to re-create that simple effect using the latest papervision code and provide a much needed update.
Creating this effect is actually fairly simple. You take an image, use some code to break it into smaller bitmaps which then are used as the materials for your planes. Then you just place the planes in a grid to re-create your image.
Here is a sample of the code that get's our image blocks to be used for our materials:
Once you've created your grid you just need to store the locations of all your x,y,z,rotation etc so that when you break apart the image you can easily piece it back together.
PlaneVO is nothing more than a simple value object. A value object gives us a nice strongly typed object to store the variables we want to access later.
PlaneVO.as
Now on to the full code. I have left comments throughout to explain what is happening. Try changing some of the math or swapping the image with your own. Once you mess with it for a little while you'll find it's easy to create some amazing effects.
This week I set out to create a Papervision Carousel in it's simplest form. At the heart of this carousel is a simple "for" loop / math which places the items in a circle in 3D space
Then to rotate our carousel we apply some similar math
This code allows us to just increment currentItem and rotate our carousel. Another easy add-on would be to setup a navigation along the bottom where you could control and change the currentItem to a specific number to rotate right to that section of the carousel.
It's also very easy to customize the number of items and radius of the carousel by adjusting these numbers.
Here is the full code.
Feel free to post links to ways you expand upon this file.
Take a look at the sphere on the left. Ever had this happen to you and wondered if there was a good way to get rid of it? One of the ways we use is by adding a viewport layer. This works much the same as adding a new layer in flash or adding movieclip over another in AS3.
The best thing about this approach is that it's very simple and quick to implement:
For even more in depth discussion on viewport layers take a look at:
http://blog.zupko.info/?p=129
Here is the full class: