问题描述
我有一个对象,我想根据上级组件传递的偏移量,使用transform
平滑,动态地移动
每当偏移量变化导致重新渲染时,过渡都会明显重启。但是,此过渡应该是恒定的,没有可见的中断,并根据偏移量的差异加快/降低速度。
到目前为止的代码:
import React from "react";
export const animatedComponent = ({ offset }) => {
return (
<div style={
position: "absolute",transform: `translateY(${offset}px)`,transition: "transform 1s linear",}>
"This string is moved vertically"
</div>
);
};
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)