曲奇饼 发表于 2019-11-5 23:21:45

跳动文字纯动画源码

/*CSS部分源码*/
@keyframes style1 {
from, 20%, 53%, 80%, to {
    animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    transform: translate3d(0,0.5,0.1);
}
40%, 43% {
    animation-timing-function: cubic-bezier(0.755, 0.050, 0.855, 0.060);
    transform: translate3d(0px, -35px, 0);
}
}

@keyframes style2 {
from {
    transform: scale3d(1, 1, 1);
}
30% {
    transform: scale3d(1.25, 0.75, 1);
}
40% {
    transform: scale3d(0.75, 1.25, 1);
}
50% {
    transform: scale3d(1.15, 0.85, 1);
}
65% {
    transform: scale3d(.95, 1.05, 1);
}
75% {
    transform: scale3d(1.05, .95, 1);
}
to {
    transform: scale3d(1, 1, 1);
}
}

@keyframes style3 {
from {
    transform: scale3d(1, 1, 1);
}
10%, 20% {
    transform: scale3d(.9, .9, .9) rotate3d(0, 0, 1, -3deg);
}
30%, 50%, 70%, 90% {
    transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, 3deg);
}
40%, 60%, 80% {
    transform: scale3d(1.1, 1.1, 1.1) rotate3d(0, 0, 1, -3deg);
}
to {
    transform: scale3d(1, 1, 1);
}
}

@keyframes style4 {
from, 20%, 40%, 60%, 80%, to {
      animation-timing-function: cubic-bezier(0.215, 0.610, 0.355, 1.000);
    }
    0% {
      opacity: 0;
      transform: scale3d(.3, .3, .3);
    }
    20% {
      transform: scale3d(1.1, 1.1, 1.1);
    }
    40% {
      transform: scale3d(.9, .9, .9);
    }
    60% {
      opacity: 1;
      transform: scale3d(1.03, 1.03, 1.03);
    }
    80% {
      transform: scale3d(.97, .97, .97);
    }
    to {
      opacity: 1;
      transform: scale3d(1, 1, 1);
    }
}

//将上面的代码做成文件 并引入HTML
<link rel='stylesheet' href='animations.css'>


//HTML里面的style代码
<style type='text/css'>

.is-animate.style1 > div { animation-name: style1; }

.is-animate > div {
animation-duration: 1s;
animation-fill-mode: both;
animation-iteration-count: infinite;
}

.is-animate > div:nth-child(1) { animation-delay: 0.0s }
.is-animate > div:nth-child(2) { animation-delay: 0.1s }
.is-animate > div:nth-child(3) { animation-delay: 0.2s }
.is-animate > div:nth-child(4) { animation-delay: 0.3s }
.is-animate > div:nth-child(5) { animation-delay: 0.4s }
.is-animate > div:nth-child(6) { animation-delay: 0.5s }

</style>

//HTML文件代码
<div class='is-animate style1'>
<div>1</div>
<div>2</div>
<div>3</div>
<div>4</div>
<div>5</div>
<div>6</div>
</div>

大致的效果如下:
页: [1]
查看完整版本: 跳动文字纯动画源码