Creating Animation in JavaScript

You can create an animation in JavaScript easily using the

setInterval method, the syntax is as follows:

myVariable=setInterval(myfunction, time interval)

The setInterval method runs a function created by you at a certain time interval in milliseconds. For example, a time interval of 1000 equals to 1 second.

Here are some examples of animations created by us: