gpt4 book ai didi

css - 在页面加载时显示动画

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

我跟着下面的答案,

[https://stackoverflow.com/a/1964871/10697521][1]

我的动画效果很好,但在给定的示例中图像用于显示动画,

代替图像,我想在页面加载中心显示以下 css 动画,

动画 css,jsfiddle:

https://jsfiddle.net/mattii/4k7L5vj1/1/

代码:

<div class="modal">
<div class="sk-chase-dot"></div>
<div class="sk-chase-dot"></div>
<div class="sk-chase-dot"></div>
<div class="sk-chase-dot"></div>
<div class="sk-chase-dot"></div>
<div class="sk-chase-dot"></div>
</div>

CSS:

.modal {
width: 40px;
height: 40px;
position: fixed;
animation: sk-chase 2.5s infinite linear both;
}

.sk-chase-dot {
width: 100%;
height: 100%;
position: absolute;
left: 0;
top: 0;
animation: sk-chase-dot 2.0s infinite ease-in-out both;
}

.sk-chase-dot:before {
content: '';
display: block;
width: 25%;
height: 25%;
background-color: orange;
border-radius: 100%;
animation: sk-chase-dot-before 2.0s infinite ease-in-out both;
}

.sk-chase-dot:nth-child(1) { animation-delay: -1.1s; }
.sk-chase-dot:nth-child(2) { animation-delay: -1.0s; }
.sk-chase-dot:nth-child(3) { animation-delay: -0.9s; }
.sk-chase-dot:nth-child(4) { animation-delay: -0.8s; }
.sk-chase-dot:nth-child(5) { animation-delay: -0.7s; }
.sk-chase-dot:nth-child(6) { animation-delay: -0.6s; }
.sk-chase-dot:nth-child(1):before { animation-delay: -1.1s; }
.sk-chase-dot:nth-child(2):before { animation-delay: -1.0s; }
.sk-chase-dot:nth-child(3):before { animation-delay: -0.9s; }
.sk-chase-dot:nth-child(4):before { animation-delay: -0.8s; }
.sk-chase-dot:nth-child(5):before { animation-delay: -0.7s; }
.sk-chase-dot:nth-child(6):before { animation-delay: -0.6s; }

@keyframes sk-chase {
100% { transform: rotate(360deg); }
}

@keyframes sk-chase-dot {
80%, 100% { transform: rotate(360deg); }
}

@keyframes sk-chase-dot-before {
50% {
transform: scale(0.4);
} 100%, 0% {
transform: scale(1.0);
}
}

最佳答案

只需将这些 css 添加到 .modal 类中即可享受它! :)

top: 50%;
left: 50%;
transform: translate(-50%, -50%);

新的CSS:

.modal {
top: 50%;
left: 50%;
transform: translate(-50%, -50%);

width: 40px;
height: 40px;
position: fixed;
animation: sk-chase 2.5s infinite linear both;
}

关于css - 在页面加载时显示动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58639392/

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