我想使用 Animated 函数将组件移动到屏幕上的绝对位置。
基本上它是这样工作的:
this.state.pan = new Animated.ValueXY({x: 50, y:50})
Animated.spring(
this.state.pan, { toValue: { x: 0, y: 0 } }
).start();
Run Code Online (Sandbox Code Playgroud)
我想知道如何将组件移动到屏幕的左上角。toValue 相对于对象的最后一个位置。
有诀窍吗?