Away3D the right timing

Flash

bees

A new computer is great, but the day I upgraded to a MacBook Pro, a little issue became obvious… I was using a G5 and a G4 to make my demos (and still do), not because I love pain, but because if you dev only on new machines, you can be sure your client will call you and accuse you of smelting his CPU…

The day I ran the demo shown above, it was clear (and hilarious) that the code I wrote one day before on the G4 was running a bit faster on the new mac… In this case, the bees were flying like crazy. So I’ve written a little class to correct this, and with a surprisingly short and easy code, a time based animation can ensure that your 3D runs the same on every machine. And these days, the power gap between machines can be huge. In this demo, the time base runs exact the same on my G5, G4 and on the macbook pro. Only the smoothness and fps are (very) different, since the bees need to cover greater distances on updates on the G4 than on the faster mac. This is especially visible when you have increases for properties in your code like position, (obj.x += value) or rotations…. and this demo is just full of those!

Here the version not timebased (obj.y += value)
and here
the version where the animations are timebased (obj.y += tb.increase(value) )

The lucky ones like me with both fast and a slow machines will be able to see the difference very quickly. For the people having a machine as powerful as a G5, they will see no differences since this is the machine that I’ve used for the speed base… For the ones who wanna keep doing 3D for clients with older machines, this handy little class will soon land in the Away3D trunk.