【发布时间】:2020-08-13 20:41:46
【问题描述】:
很抱歉,这似乎是一个显而易见的答案,但我正在尝试创建类似于 this 的动画。我正在尝试使用 react-three-fiber 创建一个类似的,但我不能使用文档中显示的那些,因为它们操纵了使用three.js 无法实现的样式转换属性。我试图通过位置属性和道具来操纵它,但它带有一个错误,如here 所示,我真的不知道从哪里开始解决这个问题。这是我的代码:
const props = useSpring({
to: async next => {
await next({ position: [100, 100, 100] });
await next({ position: [50, 50, 50] });
},
from: { position: [100, 100, 100] },
config: { duration: 3500 },
reset: true
});
return (
<Canvas>
<a.group {...props}>
<Box position={[-1.2, 0, 0]} />
<Box position={[1.2, 0, 0]} />
</a.group>
</Canvas>
)
我已成功使用 react-spring 进行悬停和缩放,但在使用位置时它不起作用。
【问题讨论】:
标签: reactjs three.js react-spring react-three-fiber