.

Java Script Animation

Java script-Animation

Javascript supports various animations to enhance the webpages. It supports the following animations such as

java script animation img1

Java script can assign motions for HTML elements such <img>, <p> etc. Time oriented functions are used for java script animation. Such function are setTImeout and setInterval and clearTimeout.

setTimeout( function, duration)

Allocate time for execution of given function.

setInterval(function, duration)

When the given duration is completed again this function request the given function to execute.

clearTimeout(setTimeout_variable)

It clears the values of setTimeout function.

Types of animations

  • Manual animations
  • Automated Animations

Manual Animations

java script animation img2

The above example, illustrate how a picture changes its location towards to right with every click.

Automated Animations

java script animation img3

Output

java script animation img4

The functions setInterval, setTimeout, stop are timing oriented functions. The periodic change in the location of the object, it seems like motion.

.