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 –