The requestAnimationFrame method in the browser passes a timestamp to the callback function. By default, your animation method is not set up to accept this argument.
requestAnimationFrame
Try def animation(self, timestamp=none):.
def animation(self, timestamp=none):