我想为动画设置最小和最大toValue
this.myAnimated = new Animated.ValueXY() ;
和PanResponder中的
onPanResponderRelease: (evt, gestureState) => {
this.myAnimated.flattenOffset();
Animated.decay(this.myAnimated, {
deceleration: 0.997,
velocity: {x: 0, y: gestureState.vy},
}).start();
}
我希望我能得到
答案 0 :(得分:0)
这样为我解决了这个问题
this._value = {x: 0, y: 0};
this.myAnimated.addListener((value) => {
if (value.y < 100 && value.y > 500 )
Animated.decay(this.state.myAnimated).stop();
this._value = value
});