<div class="codetitle"> <span><a style="CURSOR: pointer" data="61764" class="copybut" id="copybut61764" onclick="doCopy('code61764')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code61764"> <br>var example = new Fx(element,//element<br>{ <br>form:{ <br>//Style before animation<br>//color: "#00f", <br>}, <br>to:{ <br>//Target style<br>color: "#00f", <br>"background-color":"#5f5", <br>opacity:0.9, <br>}, <br>//Linear method<br>transition:Transition.elasticInOut, <br> //Animation time<br>duration:5000, <br>//Animation frame value<br>fps:50, <br>onAnim:function(s){ <br>//During animation<br>}, <br>onStart:function(){ <br>//When animation starts<br>}, <br>onPause:function(){ <br>//When animation is paused<br>}, <br>onResume:function( ){ <br>//When animation resumes<br>}, <br>onStop:function(){ <br>//When animation stops<br>} <br>} <br>); <br>// Start animation<br>example.start(); <br>//Stop animation<br>example.stop(); <br>//Stop animation and restore to original style<br>example.stop(1); <br>//Pause animation<br>example.pause(); <br>//Resume animation<br>example.resume(); <br> </div> <br>Full demo code:<br><div class="codetitle"> <span><a style="CURSOR: pointer" data="53478" class="copybut" id="copybut53478" onclick="doCopy('code53478')"><u>Copy code</u></a></span> The code is as follows:</div> <div class="codebody" id="code53478"> <br><!DOCTYPE HTML> <br><html> <br>< head> <br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <br><title>Fx animation class supports CSS3</title> <br><style type="text/css"> <br>*{ margin:0; padding:0; font-size:12px;} <br>#anim{ border-bottom:3pt solid #006;!important } <br>button{ width:70px; height:30px; font-size:16px; text-align:center;} <br></style> <br><script src="../../ scripts/Fx.js" type="text/javascript"></script> <br><script type="text/javascript"> <br>/* Demo */ <br>var fx,showlog = false; <br>window.onload = function(){ <br>var anim = document.getElementById("anim"); <br>var log = document.getElementById("log"); <br><br> fx = new Fx(anim, <br>{ <br>to:{ <br>position:"absolute", <br>left:"180px", <br>top:"180px", <br>color:" hsla(270, 50%, 50%, 0.8)", <br>"background-color":"#5f5", <br>//"background-color":"rgba(0,0,255,0.6)", //"rgb(0,255,128)",// <br>opacity:0.9, <br>"font-size":"76px", <br>"border-top-left-radius":"150px", <br>"border-top-right-radius":"150px", <br>"border-bottom-left-radius":"150px", <br>"border-bottom-right-radius":"150px", <br><br>"-moz-border-radius-topleft":"150px", <br>"-moz-border-radius-topright":"150px", <br>"-moz-border-radius-bottomright ":"150px", <br>"-moz-border-radius-bottomleft":"150px", <br>"text-shadow":"#000 9px 6px 2px ", <br>"-webkit-box- shadow":"#ff0 30px 20px 8px 0px", <br>"-moz-box-shadow":"#ff0 30px 20px 8px 0px", <br>width:"300px", <br>height:"300px" , <br>"line-height":"300px" <br>}, <br>transition:Transition.elasticIn,//bounceIn <br>duration:5000, <br>onAnim:function(s){ <br> <br>var str=""; <br>if(showlog){ <br>str = '<h1 style="color:red;font-size:16px;">runStyle:</h1>' ; <br>for(var k in s){ <br>str =k ":" s[k] "<br />"; <br>} <br>str = "laveTime:" this.laveTime "<br />"; <br><br>} <br>log.innerHTML = str; <br>}, <br>onStop:function(){ <br>//alert("Stop") ; <br>} <br>} <br>); <br><br>}; <br></script> <br></head> <br><br><body> <br> ><br><div id="anim" style=" <BR>position:absolute; <BR>left:70px; <BR>top:70px; <BR>width:150px; <BR>height:150px; <BR>color:hsla(10, 70%, 70%, 0.8); <BR>border:1px solid #666; <BR>background-color:#ccf; <BR>overflow:hidden; <BR>text- <BR>font-size:26px; <BR>-webkit-box-shadow:0px 0px 0px #000; <BR>-moz-box-shadow:0px 0px 0px #000; <BR>-moz-border-radius:0px; <BR>text-align:center; <BR>line-height:150px;" > <br>A</div> <br><button onClick="fx .start();">start()</button> <br><button onClick="fx.pause();">pause()</button> <br><button onClick= "fx.resume();">resume()</button> <br><button onClick="fx.stop(0);">stop(0)</button> <br>< ;button onClick="fx.stop(1);">stop(1)</button> <br><label for="showlog">Display data:</label> <br>< input type="checkbox" id="showlog" onClick="showlog = this.checked;" /> <br><br /> <br><div id="log"></div> ; <BR></body> <br></html> <br> </div> <br><a href="http://xiazai.jb51.net/201011/yuanma/fx.rar" target="_blank">Package download</a>