Canvas Play 04: The Little Things

In the last demo I introduced object pooling, colour pooling and 1000 orbs. This demo shows how the little things can make a big difference. The small change in this demo is that a black rectangle is drawn over all of the orbs on every update to give the effect that they’re leaving a trail behind them. Click the image below to see it in action.

Canvas_04 Demo
[Please note that this demo hasn't been optimised to work on all machines, so you may experience some slow down]

View Source

Below, I’ve included the source code of the demo. You can have a look through all of the code properly on GitHub, but I’ll give a quick overview.

As I mentioned before, the only change is the introduction of a black Rectangle, which is added to the CanvasController. To add the rectangle a Rectangle class was created. The Rectangle is created at the same dimensions as the Canvas and is added with 5% alpha, changing the alpha value will effect the length of the trail for each Orb. You can grab the source code from GitHub and have a play.

Posted by Mark on March 15th, 2011
 

3 Responses to “Canvas Play 04: The Little Things”

Leave a Reply