[英]The background color is not rendering correctly on an animation I am trying to create on with the package react-moves
我正在使用react包react-moves创建三个单独的条纹的动画,这些动画将在页面刷新时出现在页面上。 背景颜色似乎无法正确呈现。 我的反应成分在下面输入;
class Stripes extends Component {
state = {
stripes: [
{
background:'#98c5e9',
left: 120,
rotate: 25,
top: -260 ,
delay: 0
},
{
background:'#ffffff',
left: 360,
rotate: 25,
top: -397,
delay: 500
},
{
background:'#98c5e9',
left: 600,
rotate: 25,
top: -498,
delay: 1000
}
]
}
AnimatedStripesHander = () => (
this.state.stripes.map((stripe, index) => (
<Animate
key={index}
show={true}
start={{
background: '#ffffff',
opacity: 0,
left: 0,
rotate: 0,
top: 0
}}
enter={{
background: [stripe.background],
opacity: [1],
left: [stripe.left],
rotate: [stripe.rotate],
top: [stripe.top],
timing: { delay: stripe.delay, duration: 500, ease: easePolyOut },
events: {
end() {
console.log(stripe.background)
}
}
}}
>
{({opacity,left,rotate,top,background})=>{
return(
<div
style={{
background,
opacity,
transform: `rotate(${rotate}deg) translate(${left}px,${top}px)`
}}
></div>
);
}}
</Animate>
))
)
我遇到的问题是在底部返回的样式对象中的背景标签。 这种背景是错误的,但我似乎无法理解为什么。 当我将其删除时,动画中的所有其他内容都可以很好地工作,但是背景色却不能,有人对反应移动有任何经验吗?
谢谢
没有npm包react-moves
所以我假设您正在使用react-move
。
react-move
的文档说您需要使用第三方程序包才能使用颜色插值:
https://github.com/react-tools/react-move#cadillac-interpolation----depends-on-d3-interpolate
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.