Link Motion Example Motion frame application Weibo

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.