直接 上代码:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<title></title>
<style>
#box{
width:100px;
height:100px;
background-color:red;
position: absolute;
left: 100px;
top: 0px;
opacity:1 ;
}
</style>
</head>
<body>
<div id="box"></div>
<script src="js/TweenMax.min.js"></script>
<script>
// from to 區別
// from 是规定起始位置的状态
// to 是规定到达位置的状态
//fromTo() 起始 终点状态 第一个是起始状态, 第二个是终点状态
var t = new TimelineMax();
// t.to('#box',3,{
// left : 300,
// width: 200,
// heignt: 200,
// opacity: 0.1
// })
// t.from('#box',3,{
// left : 300,
// width: 200,
// heignt: 200,
// opacity: 0.1
// })
// 3 表示状态完成是需要的时间s, 5 表示延迟5秒执行
t.fromTo('#box',3,{
left : 300,
width: 200,
heignt: 200,
opacity: 0.1
},{
left : 600,
width: 100,
heignt: 100,
opacity: 1
},5)
</script>
</body>
</html>