[CSS3 Animation] TweenMax.staggerTo()

复制代码
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>Hello Greensock!</title>
    <link href='http://fonts.googleapis.com/css?family=Asap:400,700' rel='stylesheet' type='text/css'>
    <link href='http://fonts.googleapis.com/css?family=Signika' rel='stylesheet' type='text/css'>
    <link href='main.css' rel='stylesheet' type='text/css'>

</head>
<body>
<h2>TweenMax.staggerTo()</h2>
<div id="demo">
    <p>The start times of each animation are staggered by 0.5 seconds</p>
    <div class="box green"></div>
    <div class="box grey"></div>
    <div class="box orange"></div>
    <div class="box green"></div>
    <div class="box grey"></div>
    <div class="box orange"></div>
    <div class="box green"></div>
    <div class="box grey"></div>
    <div class="box orange"></div>
</div>
</body>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.11.0/jquery.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular.min.js"></script>
<script src="//ajax.googleapis.com/ajax/libs/angularjs/1.2.16/angular-animate.min.js"></script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/gsap/1.11.6/TweenMax.min.js"></script>
<script src="app.js"></script>
</html>
复制代码

CSS:

复制代码
html, body {
    height: 100%;
}

body {
    background-color:#1d1d1d;
    font-family: "Asap", sans-serif;
    color:#989898;
    margin:0 10px;
    font-size:16px;
}

h1, h2, h3 {
    font-family: "Signika Negative", sans-serif;
    margin: 10px 0 10px 0;
    color:#f3f2ef;
}

h1 {
    font-size:36px;
}

h2 {
    font-size:30px;
}

h3 {
    font-size:24px;
}

p{
    line-height:22px;
    margin-bottom:16px;
    width:650px;
}

#demo {
    height:100%;
    position:relative;
}
.box {
    width:50px;
    height:50px;
    position:relative;
    border-radius:6px;
    margin-top:4px;
    display:inline-block
}

.green{
    background-color:#6fb936;
}

.orange {
    background-color:#f38630;
}
.grey {
    background-color:#989898;
}
复制代码

Javascript:

TweenMax.staggerTo(".green", 1.5, {rotation:360, y:100, x: 50}, 0.5); //class="green" box ratate 360 degree to Y = 100, X = 50, every 0.5s, one green box start to move
TweenMax.staggerTo(".grey", 2, {rotation:720, y:150, x: 50}, 0.5); 

 

 

The difference bewteen staggerTo() with to() method is that, staggerTo trigger element one by one, but to() trigger all elements at once.

 

posted @   Zhentiw  阅读(782)  评论(0编辑  收藏  举报
(评论功能已被禁用)
编辑推荐:
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
点击右上角即可分享
微信分享提示