Snakes and canvas api