As seen in The Web Game Developer's Cookbook