我的 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%
}
}
我是一名优秀的程序员,十分优秀!