gpt4 book ai didi

html - 如何在完成后禁用 CSS 动画

转载 作者:太空宇宙 更新时间:2023-11-03 22:21:46 25 4
gpt4 key购买 nike

我有这个运行蓝色和红色渐变的 Windows 10 模拟器动画。此动画从以黑色开始的左侧过渡到以红色开始的右侧,然后从左侧过渡回黑色,这就是动画结束的时间。我正在尝试找到一种方法在动画运行一次后如何暂停/禁用动画(从左到右然后向左)为我的下一个 css 动画腾出空间,但是我不知道如何执行它。

是否有一个简单的 css 属性使动画只运行一次?

            <html>
<head>
<title>Windows 10 Simulator</title>

<link href="https://fonts.googleapis.com/
css?family=Noto+Sans|Open+Sans|PT+Sans|
Raleway|Source+Sans+Pro" rel="stylesheet">
</head>

<body>


<style onload>
html, body{
margin: 0;
padding: 0;

background-color: #000;
}

.wrapper {
height: 100%;
width: 100%;
left:0;
right: 0;
top: 0;
bottom: 0;
position: absolute;
background: linear-gradient(124deg, #000000, #000000, #0095f0 ,#0095f0, #0095F0, #ff0000, #ff0000, #0095f0);
background-size: 1800% 1800%;

animation-iteration-count: 0;
animation-fill-mode: forwards;
animation: rainbow 30s ease infinite;
}


@keyframes rainbow {
0% {background-position: 0% 0%}
10%{background-position: 100%% 15%}
20%{background-position: 100% 30%}
30%{background-position: 100% 45%}
40%{background-position: 100% 60%}
50%{background-position: 100% 85%}
60%{background-position: 100% 90%}
70%{background-position: 100% 100%}
80%{background-position: 100% 90%}
90%{background-position: 100% 85%}
80%{background-position: 100% 45%}
100%{background-position:100% 15%}
}



span {
margin-top: 250px;
color: #fff;
font-size: 30px;
font-family: 'Raleway', sans-serif;
animation-name: flickerAnimation;
animation-duration: 5s;
animation-iteration-count: 1;
position: absolute;
opacity: 0;
left: 0;
right: 0;
text-align: center;
}

#message{
font-size: 10px;
color: #fff;
animation-name: alertFade;
animation-duration: 4s;

opacity: 0;
animation-iteration-count: 1000;
margin-top: 620px;
}

span:nth-child(1) {
animation-delay: 1s;
animation-duration: 5s;

}

span:nth-child(2) {
animation-delay: 7s;
animation-duration: 7s;
}

span:nth-child(3) {
animation-delay: 15s;
}

span:nth-child(4) {
animation-delay: 22s;
}


@keyframes flickerAnimation{

0% {opacity: 0;}
50% {opacity: 1;}
100% {opacity: .0;}

}

@keyframes alertFade{
0% {opacity: .25}
50% {opacity: .75}
100% {opacity: .25}
}



</style>
<div class="wrapper">



<span>Hello! </span>
<span>Please Wait While We Setup</span>
<span>This Will Only Take a Few Seconds</span>
<span>Just a second...</span>


<div style="text-align: center;">
<p id="message" align="center">Please Do Not Turn
Off Your Device.</p>
</div>
</div>
</body>
</html>

最佳答案

在您的 .wrapper 类中,更改以下动画属性:

动画:彩虹 30s 轻松无限;到:动画:彩虹 30s ease 1;

您已使用 animation-iteration-count: 0; 将 animation-iteration-count 设置为 0,然后使用下面的动画属性让它无限播放彩虹30s轻松无限;

希望这对您有所帮助!

关于html - 如何在完成后禁用 CSS 动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53229382/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com