put html event initialization in functions.
start animation from within init() function.