Welcome
Features (API)
Example JS Clean up
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.
Example JS
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.
Example HTML
Example CSS
Output
Run
Click "Run" to see the result.
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.
Wait
Example JS Clean up
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.
Example JS
In this example we replaced the block
delay()
with a Thread
wait()
command.
Example HTML
Example CSS
Output
Run
Click "Run" to see the result.
As you can see Thread
wait()
works identical to block
delay()
by making the thread wait the desired time before executing the next block. You can use them interchangeably depending on which is easier for you to read.