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:

Galaxy 

corkscrew

corkscrew

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?