gpt4 book ai didi

html - CSS 渐变不从一端过渡到另一端

转载 作者:太空宇宙 更新时间:2023-11-04 02:00:52 24 4
gpt4 key购买 nike

我的 css 渐变动画工作正常,除了所有部分都在同时变化,而不是像这样从头到尾运行 www.verily.com,这是我试过的,

    .animated  {
-webkit-animation: animated1 20s infinite;
animation: animated1 20s infinite;
}



@-webkit-keyframes animated1 {
0%,
100% {
background-color: #2878ff
}
50% {
background-color: #ff1643
}
}

@keyframes animated1 {
0%,
100% {
background-color: #2878ff
}
50% {
background-color: #ff1643
}
}

最佳答案

这是为 linear-gradient 设置动画的一种方法

body {
background: linear-gradient(270deg, #f51313, #fbf708);
background-size: 400% 400%;
-webkit-animation: anim 10s ease infinite;
animation: anim 10s ease infinite;
}
@-webkit-keyframes anim {
0%, 100% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
}
@keyframes anim {
0%, 100% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
}

关于html - CSS 渐变不从一端过渡到另一端,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41784665/

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