-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AnimationExperimental.startAnimation reset some property values to defaults after animation ends. #796
Comments
To avoid this resets, i use dirty workaround using customized easing function and setting duration to "infinity" value var easeInQuad = function(t: number): number {
return t * t;
};
var ease_duration = 300; //duration for animation
var infinite_duration = 100000;
AnimationExperimental.startAnimation({
node: this.refs['internal'],
duration: infinite_duration,
easing: (t) => easeInQuad(Math.min(1, t*infinite_duration/ease_duration)),
property: 'scaleXY',
toValue: [2,2],
}); |
@istarkov thanks! This is helpful on the prototype stage. |
@istarkov, animate() {
AnimationExperimental.startAnimation({
node: this.refs['internal'],
duration: 1000,
easing: 'easeInQuad',
property: 'scaleXY',
toValue: [2, 2],
}, () => this.setState({scale: [2,2]}));
}
getInitialState() {
return {
scale: [1, 1]
}
}
render() {
return <View ref="internal"
style={{transform:[
{scaleX: this.state.scale[0]},
{scaleY: this.state.scale[1]}]}>
</View>
} It works, but it's a bit tricky with Flexbox and |
AnimationExperimental is very.. Experimental.. 😉 A new api will be coming soon, there aren't any plans to fix any issues with this at the moment as it is more or less deprecated. |
AnimationExperimental.startAnimation with properties “position” and “opacity" does not reset position and opacity to defaults after animation ends.
And this works as expected
element position after animation is {x:200,y:200}
But scaleXY and rotation get default values (rotation=0, scale=[1,1]) after animation end
this work as not expected
scale instantly after animation end gets scale = [1,1]
The text was updated successfully, but these errors were encountered: