Playing around with canvas and animation frame