Skip to content
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

How do you specify the duration of the animation flip? #58

Open
gianpaj opened this issue Jan 12, 2018 · 2 comments
Open

How do you specify the duration of the animation flip? #58

gianpaj opened this issue Jan 12, 2018 · 2 comments

Comments

@gianpaj
Copy link

gianpaj commented Jan 12, 2018

Thanks for putting this component together!

If you can even show me where to add this prop I'll be happy to send a pull request. Thanks

@mr-piratman
Copy link

mr-piratman commented Jan 31, 2018

not possible in this version.
try to copy and past out of node_module. and add the props manually
like so: if FlipCard line 50
Animated.spring(this.state.rotate, { toValue: Number(isFlipped), tension: this.props.tension, friction: this.props.friction, useNativeDriver: this.props.useNativeDriver }

@kevinNejad
Copy link

kevinNejad commented Mar 2, 2018

spring animation doesnt get duration.
You can change the aniamtion to Animated.timing as follows:
Animated.timing(this.state.rotate,
{
toValue: Number(isFlipped),
duration:this.props.duration,
useNativeDriver: this.props.useNativeDriver
}
).start((param) => {
this.setState({isFlipping: false})
this.props.onFlipEnd(this.state.isFlipped)
})
}

*If you'd like to use long duration (longer than 1000) you may need to animate content change as well, as theyre now changed once you click on the card.
you can do it by changing the fipping time to half of the duration,
e.g. if your duration is 1000, then the flipping should be 500,
_animation (isFlipped) {
if (!this.timer) {
this.timer = setTimeout(() => {
this.setState({isFlipped: !this.state.isFlipped})
this.timer = null
}, 500)
}
You can set this value manually if all of your Flliping card behave the same.

just make sure you extends your node modules, otherwise, you'd lose the change when you remove and install node modules again.
Hope it helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants