Posted by: pixelero | May 31, 2009

FP10 graphics.drawTriangles: BurningSphere

Hi! Ok, it’s been some time since my last post. Well, anyway, here’s something I’ve been writing every now and then during the past couple of weeks – maybe a line or two an evening:

Keyboard: Press ‘space’ to see the triangle mesh, or just press ‘Delele’ if you get tired of the whole thing !

The -maybe messy- sources (main, MeshConnection, MeshTriangle, MeshParticle) include solving all kinds of funny stuff, like subdividing from an icosahedron to a sphere, animated ‘mass and spring’-like system, finding the correct one out of 5000 triangles, etc.

*** Edit, As you may read from the comments, the first posting – old version – had a ‘scale by 20’ bug fixed in newer version of FP, If you now see the sphere appearing in a very small scale at the center of stage, update your flash player ***

*** Edit, same code with small variations created this and this [click if it gets too boring !] ***


  1. Hey, for some reason, it looks like the camra is inside the ball here, or too close, doesn’t look at all like the screenshot…


  2. Same here… Initially tough may be some y player become old but I have last version on two computers and and on both it looks as if camera is very close to the sphere so that whole screen is almost of the same color and reacts to mouse…

  3. I’ve got the same problem 😦

  4. Works for me perfectly though. What are you guys on? I’m on Firefox/Vista.

  5. quick fixed here, mtrx.prependTranslation(0, 0, -8000);

    i think it’s flash player diff bug, cause every demo from 2008 got same issue here, Petri are you on latest flash player version?

    btw, awesome!

  6. @everyone – Oops’n’sorry guys: I didn’t realise I was still haunted by that annoying 1/20 bug … should be fixed now.

  7. a little bit more here (sry, maybe just debug version will get this prob)


    TypeError: Error #1009: Cannot access a property or method of a null object reference.
    at BurningSphere/detectMouse()[C:\Documents and Settings\Petri-3\Desktop\Folder\src\]
    at BurningSphere/mouseMoved()[C:\Documents and Settings\Petri-3\Desktop\Folder\src\]


    look like need some “if null” there

    • … nothing seems to come easy today.
      If I realised that problem correctly, it’s best fixed by calling enterFrame() once before adding eventListener for mouse ?

  8. worked fien for me (opera/Mac)
    very nice result and pretty elegant way to solve the “is point inside triangle” question.

  9. Looking great now! 🙂

  10. very nice, i especially liked the last one with the dancing patterns.
    had to upgrade the player too – now your old drawTriangles-examples went straight to scaling hell 🙂

  11. I was just looking for some 3d-example in actionscript – but I’ve spent an hour looking mesmerized at your animations – especially the second. It’s artistic, but it also follows the laws of physics pretty neatly, imagining the sphere as a watery planet.

    There’s some really inspired stuff on your flickr page too: I especially like the “eeryNoise”, which might have been called “Northern Lights”.

    Thanks for sharing.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s


%d bloggers like this: