3D Spirals with Away3D

Mike Chambers’ post a few days ago about making spirals with EaslJS inspired me to play around with the same idea in Away3D. While these are quite pretty they don’t really move around to well in 3D space because there are so many lines to move. This will all work much, MUCH, better when we get access to Flash Player Molehill.

Click on the image to view the application.

Spiral Hurricane
view source

Here are a view other screen shots I took from the app:




If you want to see it the source code is available. The only real issue that I ran into while creating this was how to clear away the _view3D.scene when changing the pattern. I tried a few different approaches before I settled on this:

try {
	_view3D.scene.removeChild( _spiralContainer );
} catch( e:Error ) {}

_spiralContainer = new ObjectContainer3D();
_view3D.scene.addChild( _spiralContainer );

As you can see the _spiralContainer is a ObjectContainer3D. That’s where I draw the polygons. I couldn’t find a way to empty out the _spiralContainer so I just re-instantiate it each time the pattern changes. But that didn’t do it either. So I have to remove it from the _view3D.scene first, then re-instantiate, than add it back again.

The removeChild() had to be done in a try/catch because the first time this runs the spiralContainer hasn’t been added yet. It’s a little messy but it works well. If you know of a better way to clear away the scene when the pattern changes I’d love to hear about it in the comments.

What do you think?

6 thoughts on “3D Spirals with Away3D

  1. That's pretty lame taking off the html links. Ya you might get some spam but your going to lose readers too. Some people like me like to read a good blog post and post my website at the same time.

    1. @AlexG Oh hell yeah. I’m just waiting for Away3D 4.0 to go to beta. It SHOULD have been beta a few weeks ago and a final release by the end of the year. Looks like the team has fallen behind. Which sucks but it’s good to know that they’re not rushing it out the door.

  2. Extraordinary work, detailed drawings are so beautiful, I remember as a child playing a square ruler and a ruler with a jagged hole in its center, can create spirals similar but not as nice as this ..

Leave a Reply

Your email address will not be published. Required fields are marked *