Source:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title> Weibo effects </title>
<style>
*{
margin:0;
padding:0;
}
#txt {
Color: #090;
}
#oul {
width:700px;
height:500px;
Display:block;
border:1px solid #000;
position:relative;
left:700px;
Overflow:hidden;
}
#oul li{
Color: #9FC;
List-style:none;
width:700px;
Border-bottom: #000 1px dashed;
opacity:0;
Overflow:hidden;
}
</style>
<script src= "Perfect motion frame. js" type= "Text/javascript" ></script>
<script>
Window.onload=function () {
var Txt=document.getelementbyid (' Txt ');
var Obt=document.getelementbyid (' oBt ');
var Oul=document.getelementbyid (' Oul ');
Obt.onclick=function () {
var oli=document.createelement (' Li ');
Oli.innerhtml=txt.value;
Txt.value= ";
Oul.insertbefore (Oli,oul.childnodes[0]);
var target=oli.offsetheight;
oli.style.height=0;
Startmove (Oli,{height:target},function () {startmove (oli,{opacity:100});
})
}
}
</script>
<body>
<textarea rows= "Ten" cols= "id=" TXT "></textarea><input type=" button "value=" Release "id=" Obt "/>
<ul id= "Oul" >
</ul>
</body>
Stereotypical motion framework
JavaScript Document
function GetStyle (obj,name) {
if (Obj.currentstyle) {
return Obj.currentstyle[name];
}else{
Return getComputedStyle (Obj,false) [name];
}
}
function Startmove (obj,json,fun) {
Clearinterval (Obj.timer);
Obj.timer=setinterval (function () {
var bstop=true;
for (Var attr in JSON) {
var beginning=0;
if (attr== ' opacity ') {
Beginning=math.round (parsefloat (GetStyle (obj, attr) *100);
}else{
Beginning=parseint (GetStyle (obj,attr));
}
var speed= (json[attr]-beginning)/6;
Speed=speed>0? Math.ceil (Speed): Math.floor (speed);
if (Beginning!=json[attr])
Bstop=false;
if (attr== ' opacity ')
{
Obj.style.filter= ' alpha (opacity: ' + (beginning+speed) + ') ';
obj.style.opacity= (beginning+speed)/100;
}
Else
{
obj.style[attr]=beginning+speed+ ' px ';
}
}
if (bstop) {
Clearinterval (Obj.timer);
if (fun) fun ();
}
},30)
}
Link Motion Example Motion frame application Weibo