HTML and CSS Reference
In-Depth Information
The duraion starts at around
800
milliseconds and it decreases gradually unil it reaches
100
milliseconds.
Classified intel
In both the
setTimeout
and
requestAnimationFrame
funcion calling, we used the
following binding syntax:
(this.tick).bind(this)
It makes sure that
this
inside the ick funcion refers to the current
this
—
gameScene
.
It doesn't work without the bind funcion because there is no context in both the
setTimeout
and
requestAnimationFrame
funcions.
For more detail on this context, please refer to the following two aricles from the Mozilla
documentaion that explain the bind method and the usage of the
this
operator:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
Global_Objects/Function/bind
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/
Operators/this
Parallax background scrolling
We will create a background movement that moves in a different speed than the runway.
This is also known as parallax scrolling, and creates an illusion of depth.
Prepare for lift off
Make sure the following image is ready in the project inside the
images
folder: