0
我学习反应原生动画。当我console.log(this.position.x);
它表明x
下的函数名_interpolation
那么,为什么我们这样做:函数`interpolate`来自
transform: [{
rotate: this.position.x.interpolate({
inputRange: [-200, 200],
outputRange: ['-45deg', '45deg'] // 0 : 150, 0.5 : 75, 1 : 0
}),
}],
souldn't它是:
transform: [{
rotate: this.position.x._interpolation({
inputRange: [-200, 200],
outputRange: ['-45deg', '45deg'] // 0 : 150, 0.5 : 75, 1 : 0
}),
}],
附: position
来自this.position = new Animated.ValueXY();
感谢您的帮助,AnimatedValue来自哪里? – farmcommand2
您的屏幕截图显示该值是“AnimatedValue”的实例。 –
以下是AnimatedValue源代码的链接:https://github.com/facebook/react-native/blob/1e8f3b11027fe0a7514b4fc97d0798d3c64bc895/Libraries/Animated/src/nodes/AnimatedValue.js –