The thing is that draw() only updates the screen at the end and not throughout
And you cannot force the screen to update.
The work around is that you use thread and it changes an image that you can display in draw () - when you do it right. I posted one example here
And jeremy douglas made another approach
links see below -