Demo window 6. Animation

In the above examples, things will often get drawn to the screen with some delay, i.e., you may not see the erasures and paintings happen. This is because several operating systems use buffering of graphics. These systems will draw the graphics only just before getting user input. This means that `demoWaitForInput` is the place where your drawings will typically be painted on the screen. If you want painting to happen earlier (e.g. in animations), you can use

`demoShow ()
`

Also in animations, you will often want to regulate the time span between two consecutive drawings. If you want 0.05 seconds between drawings, you can put Praat to sleep temporarily with

`sleep (0.05)
`

If you need user input during the animation, you can replace `demoWaitForInput` or `demoShow` with

`demoPeekInput()
`

which returns immediately without waiting and will tell you (via e.g. `demoClicked` or `demoKey$`) whether a mouse or key event happened during drawing or sleeping.

### Links to this page

- Demo window