Home > Web Front-end > JS Tutorial > body text

Publish a JavaScript-based animation class Fx.js_javascript tips

WBOY
Release: 2016-05-16 18:16:45
Original
1146 people have browsed it
Copy code The code is as follows:

var example = new Fx(element,//element
{
form:{
//Style before animation
//color: "#00f",
},
to:{
//Target style
color: "#00f",
"background-color":"#5f5",
opacity:0.9,
},
//Linear method
transition:Transition.elasticInOut,
//Animation time
duration:5000,
//Animation frame value
fps:50,
onAnim:function(s){
//During animation
},
onStart:function(){
//When animation starts
},
onPause:function(){
//When animation is paused
},
onResume:function( ){
//When animation resumes
},
onStop:function(){
//When animation stops
}
}
);
// Start animation
example.start();
//Stop animation
example.stop();
//Stop animation and restore to original style
example.stop(1);
//Pause animation
example.pause();
//Resume animation
example.resume();

Full demo code:
Copy code The code is as follows:



< head>

Fx animation class supports CSS3






>

A





< ;button onClick="fx.stop(1);">stop(1)

< input type="checkbox" id="showlog" onClick="showlog = this.checked;" />





Package download
Related labels:
source:php.cn
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!