Put drawCanvas inside a tick function