JavaScript functions bring fun out of <Canvas>...</canvas>