Home  >  Article  >  Web Front-end  >  Publish a JavaScript-based animation class Fx.js_javascript tips

Publish a JavaScript-based animation class Fx.js_javascript tips

WBOY
WBOYOriginal
2016-05-16 18:16:451160browse
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
Statement:
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