We have moved some of our static JS code from previous lessons here and placed them into methods we can call from our main example to clean up the lesson.
In this example we moved the last 3 transitions to there own
Thread.block()
and added the
delay()
property to each with a delay of 300ms.
The code above produces a water effect by adding a 300ms
delay()
to the preceding commands.
It acts similarly to
setTimeout()
but instead of nesting timeouts to produce the effect we can write them in series.
They other type of delay that could have been used is
wait()
.
Take a look at the example below before moving on to see how it could have been used instead the standard
delay()
method.