Home > Web Front-end > JS Tutorial > How to use JavaScript to achieve animation effects_javascript skills

How to use JavaScript to achieve animation effects_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 17:28:17
Original
1193 people have browsed it

In fact, the principle is very simple. It mainly uses a timer function. Below I will
demonstrate a simple animation production process for you. Through the relevant introduction, you can draw inferences and create more dazzling animation effects. .
The effect of this example is to click the "Start Moving" button on the web page, and the specified layer will move from left to right. During this process, if you click the "Stop Moving" button, it will stop moving.

Copy code The code is as follows:

 
 
 JavaScript Motion Sample
 

"visibility:visible; position:absolute; left:10; top:10; z-index:1;">
 
 
 ;/div>
 


 
 
 
 


The main one used here is called setTimeout( function, interval) function, the parameter format of this function is:
The first parameter "function" is the name of the function to be called after timeout, and the second parameter "interval" is the timeout value, in microseconds.
Note that if you want to stop this timer, you must save the return value after calling the setTimeout() function, and cancel the timer through the clearTimeout(id) function.
Related labels:
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template