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 to really control the animation/bounce speed? #90

Closed
HectorRicardo opened this issue Feb 20, 2021 · 2 comments
Closed

How to really control the animation/bounce speed? #90

HectorRicardo opened this issue Feb 20, 2021 · 2 comments

Comments

@HectorRicardo
Copy link

HectorRicardo commented Feb 20, 2021

(Please download both .mov videos below, so you can see the bug. They are really short - 5 seconds each)

I found a use case in which the component is not behaving as expected:

const App = () => (
  <SafeAreaView style={styles.root}>
    <View style={styles.container}>
      <TextTicker>A long text that won't fit in a linei</TextTicker>
      <TextTicker>A long text that won't fit in a lineo</TextTicker>
    </View>
  </SafeAreaView>
);

const styles = StyleSheet.create({
  root: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
  container: {
    width: 200,
    borderColor: 'black',
    borderWidth: 1,
  },
});
tickerbug.mov

As you can see, the first TextTicker moves way much faster than the second one
If I put a bounceSpeed = 1000 on both of them, it makes them slower, but the first one is still faster than the second one.

tickerbugslow.mov

I understand that the total duration of the animation will change between both of them (because the first one is slighly shorter than the second one). My question is, how do I force them to be at the same speed?

@deanhet
Copy link
Owner

deanhet commented Feb 21, 2021

I've done a little bit of digging into this as it's a very strange bug (but thanks for reporting!).
I can confirm the issue, how the text-ticker works is that it measures the text and sets the speed/animation duration based on the width of it. You can see that in the source with the references to this.distance.

Although the sentences look almost the same width here, one is reporting back with 17.66... and the other is 13. The code is working as intended here, even though it's not ideal behaviour.

You can use the duration prop to make them behave a bit more like you would expect. Would that be a suitable solution in this case?

@deanhet deanhet closed this as completed Aug 14, 2021
@RobinBobin
Copy link

RobinBobin commented Oct 12, 2021

I think my issue is related to this one.

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