Improving rotation and translation of canvas