【问题标题】:Animate.css one letter of a wordAnimate.css 一个单词的一个字母
【发布时间】:2016-08-14 22:54:50
【问题描述】:

我正在尝试使用 animate.css 为单词的一个字母设置动画。动画不能在一段时间内工作,我找不到关于这个主题的任何好的信息。如何使用 animate.css 为单词的一个字母设置动画? 这是我的代码:

.animated {
	-webkit-animation-duration: 2s;
	animation-duration: 2s;
	-webkit-animation-fill-mode: both;
	animation-fill-mode: both;
}
.animated.infinite {
	-webkit-animation-iteration-count: infinite;
	animation-iteration-count: infinite;
	text-align: center;
}
@-webkit-keyframes tada {
 from {
 -webkit-transform: scale3d(1, 1, 1);
 transform: scale3d(1, 1, 1);
}
 10%, 20% {
 -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
 transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
}
 30%, 50%, 70%, 90% {
 -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
 transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
}
 40%, 60%, 80% {
 -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
 transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
}
to {
	-webkit-transform: scale3d(1, 1, 1);
	transform: scale3d(1, 1, 1);
}
}
 @keyframes tada {
 from {
 -webkit-transform: scale3d(1, 1, 1);
 transform: scale3d(1, 1, 1);
}
 10%, 20% {
 -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
 transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
}
 30%, 50%, 70%, 90% {
 -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
 transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
}
 40%, 60%, 80% {
 -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
 transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
}
to {
	-webkit-transform: scale3d(1, 1, 1);
	transform: scale3d(1, 1, 1);
}
}
.tada {
	-webkit-animation-name: tada;
	animation-name: tada;
}
/********************************/
.ani-g{
	font-size: 36px;
	color: #66ccff;
}
.ani-en{
	color: #66ccff;
	position: relative;
	bottom: 8px;
	display: inline;
}
.ani-erate{
	color: #666666;
	position: relative;
	bottom: 8px;
	display: inline;
}
<span class="ani-g animated infinite tada">G</span><span class="ani-en">EN</span><span class="ani-erate">ERATE THIS</span>
<h1 class="n-bitwise animated infinite tada">G</h1>

【问题讨论】:

    标签: html css animation animate.css


    【解决方案1】:

    此动画需要块级元素。只需为您的.animated 类插入display: inline-block;,它应该可以工作!

    .animated {
      display: inline-block;
      -webkit-animation-duration: 2s;
      animation-duration: 2s;
      -webkit-animation-fill-mode: both;
      animation-fill-mode: both;
    }
    .animated.infinite {
      -webkit-animation-iteration-count: infinite;
      animation-iteration-count: infinite;
      text-align: center;
    }
    @-webkit-keyframes tada {
      from {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
      }
      10%,
      20% {
        -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
      }
      30%,
      50%,
      70%,
      90% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
      }
      40%,
      60%,
      80% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
      }
      to {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
      }
    }
    @keyframes tada {
      from {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
      }
      10%,
      20% {
        -webkit-transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
      }
      30%,
      50%,
      70%,
      90% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
      }
      40%,
      60%,
      80% {
        -webkit-transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
        transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
      }
      to {
        -webkit-transform: scale3d(1, 1, 1);
        transform: scale3d(1, 1, 1);
      }
    }
    .tada {
      -webkit-animation-name: tada;
      animation-name: tada;
    }
    /********************************/
    
    .ani-g {
      font-size: 36px;
      color: #66ccff;
    }
    .ani-en {
      color: #66ccff;
      position: relative;
      bottom: 8px;
      display: inline;
    }
    .ani-erate {
      color: #666666;
      position: relative;
      bottom: 8px;
      display: inline;
    }
    <span class="ani-g animated infinite tada">G</span><span class="ani-en">EN</span><span class="ani-erate">ERATE THIS</span>
    <h1 class="n-bitwise animated infinite tada">G</h1>

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多