Rubiks cube with drawTriangles()

The Flash plugin is required to view this object.

This is my first attemptĀ  to render a 3×3 rubiks cube. The beef is in the drawTriangles() method of the Graphics class.

To calculate each frame, matrices are applied to the 3d Points and rendered down to 2d vertices. The Array of 2d vertices is then passed to the drawTriangles() meathod along with the indices. (AdvancED Actionscript Animation)

The engine draws each cube into it’s own Shape. After the cubes have been drawn, the Shapes will be sorted. The Shapes are actually DepthSort objects that inherit from Shape and extend it with an additional zIndex property.

Right click swf to view source.

Leave a comment