gpt4 book ai didi

css - 如何在 React 组件中应用渐变动画效果

转载 作者:行者123 更新时间:2023-11-28 09:43:19 24 4
gpt4 key购买 nike

如何使用像this这样的渐变动画效果在线 react 组件中。我必须使用以下基于 CSS 的渐变动画效果作为 react 组件中的内联。是否有任何特定的软件包可用?

body {
width: 100wh;
height: 90vh;
color: #fff;
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
}

@-webkit-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}

@-moz-keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}

@keyframes Gradient {
0% {
background-position: 0% 50%
}
50% {
background-position: 100% 50%
}
100% {
background-position: 0% 50%
}
}

h1,
h6 {
font-family: 'Open Sans';
font-weight: 300;
text-align: center;
position: absolute;
top: 45%;
right: 0;
left: 0;
}

最佳答案

看看这个:

https://codepen.io/anon/pen/BYvVqP

我只是使用了一个状态来存储类。

className={this.state.animationClass}

关于css - 如何在 React 组件中应用渐变动画效果,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49026159/

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