[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.

时间: 2024-08-09 22:01:11

[CSS3 Animation] TweenMax.staggerTo()的相关文章

CSS3 Animation

animation:[<animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> || <animation-iteration-count> || <animation-direction>] [, [<animation-name> || <animation-duration> |

css3 animation动画对应属性解释

animation Value:     [<animation-name> || <animation-duration> || <animation-timing-function> || <animation-delay> || <animation-iteration-count> || <animation-direction> || <animation-fill-mode>] [, [<animatio

实现了一个百度首页的彩蛋——CSS3 Animation简介

在百度搜索中有这样一个彩蛋:搜索“旋转”,“跳跃”,“反转”等词语,会出现相应的动画效果(搜索“反转”后的效果).查看源码可以发现,这些效果正是通过CSS3的animation属性实现的. 实现这个彩蛋 简单来说可以分三步: 1.实现一些css动画类,等待调用: 2.设立关键字与动画匹配方法: 3.每当页面加载完成,根据关键字为body添加指定动画类. 查看DEMO:百度搜索彩蛋 CSS3 Animation animation: name duration timing-function de

2016.2.20 css3 animation 的学习

使用css3 animation动画 'use strict'; var mousex, mousey; function tuo(el) { var move = function () { el.style.left = event.x - mousex + 'px'; el.style.top = event.y - mousey + 'px'; }; el.addEventListener('mousedown', function () { mousex = event.x - el.

HTML5+CSS3 animation/keyframe/transform/transition/2D translate/3D translate 学习总结

<h1>HTML5+CSS3 animation/keyframe/transform/transition/2D translate/3D translate 学习总结</h1> <h1>HTML5,animation,keyframe,transform,transition,2D translate,3D translate,CSS3</h1> CSS3 教程 CSS 用于控制网页的样式和布局. CSS3 是最新的 CSS 标准. 本教程向您讲解 CS

css3 animation动画技巧

一,css3 animation动画前言 随着现在浏览器对css3的兼容性越来越好,使用css3动画来制作动画的例子也越来越广泛,也随着而来带来了许多的问题值得我们能思考.css3动画如何让物体运动更顺畅,css3动画如何做弧线动画,css3动画是否有动画库,css3帧动画如何快速简单……   为了解决这些折磨人的问题,我们今天来分析一下: 首先介绍css3 Animation动画库: http://daneden.github.io/animate.css/ 基本涵盖了我们常见的基础css3动

css3 animation 属性众妙

转自:凹凸实验室(https://aotu.io/notes/2016/11/28/css3-animation-properties/) 本文不会详细介绍每个 css3 animation 属性(需要了解的同学可先移步 MDN),而是结合实际的开发经验,介绍 css3 animation 属性的一些使用场景及技巧. 1. animation-delay MDN 中的介绍: animation-delay CSS 属性定义动画于何时开始,即从动画应用在元素上到动画开始的这段时间的长度. 该属性值

CSS3(animation, trasfrom)总结

CSS3(animation, trasfrom)总结 1. Animation 样式写法: 格式: @-浏览器内核-keyframes 样式名 {} 标准写法(chrome safari不支持 @keyframes  [样式名] { 0% {left: 10px ; top : 20px;} 50% {left: 20px ; top : 30px;} 100% {left: 10px ; top : 20px;} }; Firefox @-mz-keyframes  [样式名] { 0% {

CSS3 animation属性

CSS3 animation属性 @import @media @font-face @keyframes 当我们使用@keyframes定义好了一个动画,它并不会执行产生任何效果,直到我们通过animation属性将动画应用到相应元素上. 对于 CSS3 animation 属性其完整的语法如下: animation: name duration timing-function delay iteration-count direction; name是使用@keyframes定义好的关键帧名