我一直在努力使这一过程更加顺畅:
http://codepen.io/alexrts/pen/jbNrXo
-webkit-animation: pulse 1.4s ease-out;
-moz-animation: pulse 1.4s ease-out;
animation: pulse 1.4s ease-out;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
animation-iteration-count: infinite;
如您所见,它看起来有点机器人化。
有人知道有没有JavaScript的方法吗?
最好,
亚历克斯
最佳答案
您应该使宽松线性
html {
background: #fff;
overflow: hidden;
font-family: Helvetica, Arial;
font-weight: 600;
font-size: 16px;
}
.live-cta {
position: absolute;
top: 45%;
left: 50%;
margin-left: -50px;
}
.live-icon {
position: relative;
width: 40px;
height: 40px;
float: left;
}
.live-text {
position: relative;
float: left;
margin: 12px 0 0 0;
color: #007aff;
}
.live-arrow {
background-image: url("http://s18.postimg.org/u8099c1c5/live_arrow.png");
background-size: 40px 40px;
background-repeat: no-repeat;
width: 40px;
height: 40px;
position: absolute;
top: 0;
left: 0;
z-index: 3;
}
.live-pulse-min {
border: 4px solid #007aff;
background: transparent;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
height: 10px;
width: 10px;
position: absolute;
top: 11px;
left: 11px;
-webkit-animation: pulse 1.4s linear;
-moz-animation: pulse 1.4s linear;
animation: pulse 1.4s linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
animation-iteration-count: infinite;
z-index: 1;
opacity: 0;
}
.live-pulse-max {
border: 4px solid #007aff;
background: transparent;
-webkit-border-radius: 100px;
-moz-border-radius: 100px;
border-radius: 100px;
height: 28px;
width: 28px;
position: absolute;
top: 2px;
left: 2px;
-webkit-animation: pulse2 1.4s linear;
-moz-animation: pulse2 1.4s linear;
animation: pulse2 1.4s linear;
-webkit-animation-iteration-count: infinite;
-moz-animation-iteration-count: infinite;
animation-iteration-count: infinite;
z-index: 1;
opacity: 0;
}
@-webkit-keyframes "pulse" {
0% {
-webkit-transform: scale(0);
opacity: 0.0;
}
50% {
-webkit-transform: scale(.5);
opacity: 1;
}
100% {
-webkit-transform: scale(1);
opacity: 0.0;
}
}
@-webkit-keyframes "pulse2" {
0% {
-webkit-transform: scale(0);
opacity: 0.0;
}
50% {
-webkit-transform: scale(.5);
opacity: 1;
}
100% {
-webkit-transform: scale(1);
opacity: 0.0;
}
}
<div class="live-cta">
<div class="live-icon">
<div class="live-arrow"></div>
<div class="live-pulse-min"></div>
<div class="live-pulse-max"></div>
</div>
<div class="live-text">LIVE</dive>
</div>
关于css - 更流畅的CSS动画,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/32247534/