css - 完成后暂停 css 动画

标签 css css-animations

所以我试图在完成动画后为一些文本设置动画。

问题是它在完成后就消失了,即使我将不透明度设置为 1@ 100%。

/* text animation */

@-webkit-keyframes textAnimation { 
    0% {
        opacity: 0;
        -webkit-transform: translateY(-200%);
    }
    10% {
        opacity: 1;
        -webkit-transform: translateY(0%);
    }
    20% {
        opacity: 1;
        -webkit-transform: translateY(0%);
    }
    100% {
        opacity: 1;
        -webkit-transform: translateY(0%);
    }

}




.text-animation {
    z-index: 1000;


    width: 100%;
    text-align: center;
    opacity: 0;
    -webkit-animation: textAnimation 2s linear  2s;
    -moz-animation: textAnimation 2s linear  2s;
    -o-animation: textAnimation 2s linear  2s;
    -ms-animation: textAnimation 2s linear  2s;
    animation: textAnimation 2s linear  2s;
     -webkit-animation-iteration-count: 1;
      -webkit-animation-delay: 1s;
    -moz-animation-delay: 1s;
    -o-animation-delay: 1s;
    -ms-animation-delay: 1s;
    animation-delay: 1s;
}

/* text animation */

我只是不明白这里的问题是什么......

最佳答案

这对我有用。

如果你在类中设置了结束状态并且没有添加延迟。

@-webkit-keyframes textAnimation {
    0% { opacity: 0; -webkit-transform: translateY(-200%); }
    33% { opacity: 1; -webkit-transform: translateY(-200%); }
    100% { opacity: 1; -webkit-transform: translateY(0%); }
}

.text-animation {
color:#fff;
font-size:32px;
width: 100%;
text-align: center;
opacity: 1;
-webkit-animation: textAnimation 3s linear;
-moz-animation: textAnimation 3s linear;
-o-animation: textAnimation 3s linear;
-ms-animation: textAnimation 3s linear;
animation: textAnimation 3s linear;
}

关于css - 完成后暂停 css 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13981544/

相关文章:

css - 如何从标题面板小部件中删除默认的 GET 样式?

python - 从 pandas 单元格中删除 html 格式

CSS:只改变一种指定的颜色?

css - 输入范围 slider 动画 CSS

html - 从不显示到显示 block 的 CSS 转换,反之亦然

javascript - 仅使用 CSS 自动调整此 div 的大小

javascript动态添加和删除类

html - CSS 关键帧图像出现在它应该出现之前

html - 为什么这个 SVG 滤镜动画在 Edge 或 Chrome 中不起作用?

css - webkit 动画旋转在 Nexus Mobile 中不起作用