gpt4 book ai didi

css3动画暂停在屏幕中间

转载 作者:太空宇宙 更新时间:2023-11-04 13:39:44 27 4
gpt4 key购买 nike

基本上这是一个球。这个球从左到右。我希望球到达屏幕中间时暂停,3 秒后它应该淡出我该怎么做?

div.new-goal {
position:absolute;
margin-top: 30px;
background-color: transparent;
text-align:center;
-webkit-animation: movein 1.0s ease-out 0s 1, moveout 2.1s ease-in 1s 1;
-webkit-animation-fill-mode: forwards;
white-space: nowrap;
color: $green2;
}

ps:是SASS

最佳答案

HTML

<div id="ball"></div>

CSS

body {
margin: 0;
padding: 0;
}

#ball {
width: 50px;
height: 50px;
background: green;
border-radius: 50%;
position: absolute;
left: -50px;
-webkit-animation: move 8s;
-webkit-animation-fill-mode: forwards;
}

@-webkit-keyframes move
{ /*
8s : 100% = 3s : x
x = 37.5%
*/
37.5% {
left: calc(50% - 25px); opacity: 1;
}
75% {
left: calc(50% - 25px); opacity: 1;
}
85% {
left: 80%; opacity: 0;
}
100% {
opacity: 0;
}
}

http://jsfiddle.net/8B9Lx/3/

关于css3动画暂停在屏幕中间,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22781873/

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