我有以下法典:
<><><><>>><>>>>><>>>>>>
<header class="hero">
<section class="hero-text-container">
<!--Content Here-->
</section>
<figure class="hero-figure">
<!--Image Here-->
</figure>
</header>
<>CSS
.hero {
background-image: radial-gradient(ellipse 30% 100% at -4% 5%, #ce0058, transparent),
radial-gradient(ellipse 100% 75% at 0% 0%, #cf4520, #460702, transparent),
radial-gradient(ellipse 100% 100% at 100% 100%, black, black);
display: flex;
width: 100%;
max-width: 100vw;
justify-content: center;
align-items: stretch;
text-align: justify;
flex-wrap: wrap;
margin: 0 auto;
border-bottom: 2px solid #eee;
animation-name: colors-circulating;
animation-duration: 5s;
animation-timing-function: ease-in-out;
animation-iteration-count: 3;
}
我删除了用于缩短的超文本代码,但已经执行。
The CSS above is styling the div with a black bg, and a 2 radial gradients of brick brown & hot pink. The gradients are located originally near the div s top left corner. See the full Implementation here:Hero Banner of a website I m working on
I want to animate the gradients to move clockwise from the top left => top right => bottom right => bottom left, so I wrote this code:
@keyframes colors-circulating {
0%, 100% {
background: radial-gradient(
ellipse 30% 100% at -4% 5%,
#ce0058,
transparent
),
radial-gradient(
ellipse 100% 75% at 0% 0%,
#cf4520,
#460702 60%,
transparent
),
radial-gradient(ellipse 100% 100% at 100% 100%, black, black);
}
25% {
background: radial-gradient(
ellipse 30% 100% at 96% 5%,
#ce0058,
transparent
),
radial-gradient(
ellipse 100% 75% at 100% 0%,
#cf4520,
#460702 60%,
transparent
),
radial-gradient(ellipse 100% 100% at 100% 100%, black, black);
}
50% {
background-image: radial-gradient(
ellipse 30% 100% at 96% 105%,
#ce0058,
transparent
),
radial-gradient(
ellipse 100% 75% at 100% 100%,
#cf4520,
#460702 60%,
transparent
),
radial-gradient(ellipse 100% 100% at 100% 100%, black, black);
}
75% {
background-image: radial-gradient(
ellipse 30% 100% at -4% 105%,
#ce0058,
transparent
),
radial-gradient(
ellipse 100% 75% at 0% 100%,
#cf4520,
#460702 60%,
transparent
),
radial-gradient(ellipse 100% 100% at 100% 100%, black, black);
}
}
现在的问题是,这部法典显示4幅不平稳的图像。 我如何使梯度顺利流动?
我看到了以下解决办法,但不幸的是,它们都没有为我工作:
- How to apply multiple css radial gradients to a single element
- Animate a div background image
- How to animate a radial-gradient using CSS?
- CSS animation not smooth with radial-gradient background
- CSS-Animation with two radial gradients moving/spinning inside the clipped mask png
我知道,我的执行可能不够正确,但我确实竭尽全力。
我如何运用上文用安全支助和办公室解释的理念一?