Animation jittery even though fps stays at 60fps
See original GitHub issueDescription
Scrollview scroll with modifying the height of the header is super jittery. The only device it works on properly is iPad Pro. All iPhones it does not work well. Test devices iPhone 11 Pro, iPhone 6 and iPad Pro. Also it appears to just be on momentum scroll. (The event throttle is 1).
Screenshots
Steps To Reproduce
See code below.
Expected behavior
Smooth height animation.
Actual behavior
Jittery animation.
Snack or minimal code example
import React from 'react';
import { View, StyleSheet } from 'react-native';
import Animated, { interpolate, useSharedValue, useAnimatedStyle, useAnimatedScrollHandler, Extrapolate } from 'react-native-reanimated';
function ScrollExample() {
const y = useSharedValue(0);
const scrollHandler = useAnimatedScrollHandler((event) => {
y.value = event.contentOffset.y;
});
const stylez = useAnimatedStyle(() => {
const height = interpolate(y.value, [-100, 0, 200], [500, 400, 100], Extrapolate.CLAMP)
return {
height: height,
// zIndex: height > 100 ? 0 : 1,
};
});
console.log('render');
return (
<View style={{flex: 1, backgroundColor: '#f1f2f3'}}>
<Animated.View style={[{backgroundColor: '#fab', ...StyleSheet.absoluteFill, bottom: null }, stylez]} />
<Animated.ScrollView
contentContainerStyle={{paddingTop: 300}}
onScroll={scrollHandler}
scrollEventThrottle={1}>
<View style={{height: 200, margin: 20, marginBottom: 0, backgroundColor: '#fff', borderWidth: StyleSheet.hairlineWidth, borderColor: '#ccc', borderRadius: 8}} />
<View style={{height: 200, margin: 20, marginBottom: 0, backgroundColor: '#fff', borderWidth: StyleSheet.hairlineWidth, borderColor: '#ccc', borderRadius: 8}} />
<View style={{height: 200, margin: 20, marginBottom: 0, backgroundColor: '#fff', borderWidth: StyleSheet.hairlineWidth, borderColor: '#ccc', borderRadius: 8}} />
<View style={{height: 200, margin: 20, marginBottom: 0, backgroundColor: '#fff', borderWidth: StyleSheet.hairlineWidth, borderColor: '#ccc', borderRadius: 8}} />
<View style={{height: 200, margin: 20, marginBottom: 0, backgroundColor: '#fff', borderWidth: StyleSheet.hairlineWidth, borderColor: '#ccc', borderRadius: 8}} />
<View style={{height: 200, margin: 20, marginBottom: 0, backgroundColor: '#fff', borderWidth: StyleSheet.hairlineWidth, borderColor: '#ccc', borderRadius: 8}} />
</Animated.ScrollView>
</View>
);
}
export default ScrollExample
Package versions
- React: ~16.13.0
- React Native: https://github.com/expo/react-native/archive/sdk-39.0.2.tar.gz (.63)
- React Native Reanimated: 2.0.0-alpha.6.1
- NodeJS: 12.19.0
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:14 (5 by maintainers)
Top Results From Across the Web
Why do some games feel smooth at 60fps while other ... - Reddit
In this case, example B would look very jittery as some frames would have the distinct appearance of sticking for a moment before...
Read more >Choppy Gameplay but High FPS - What to Do? - Driver Support
If you are experiencing choppy gameplay, but have a high FPS, your driver could be to blame. Learn how to automatically update drivers...
Read more >Why is the game 60 fps on PC? Its killing my eyes
You'll notice the intros run at a much slower framerate; that's not because the engine can't handle faster speed, but rather because it...
Read more >60 fps to 30 fps makes movements jittery on mobile device
2D movement/scrolling looks particularly bad at lower frame rates, while into-the-screen motion doesn't look so bad. It's also possible that bad ...
Read more >When playing some games, there are very noticeable ... - Quora
You can actually be getting 100fps and have a jerky game. This is because each frame is not always rendered in the same...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m on 2.5.0, and if a element inside my scroll is animating with interpolation while the user is scrolling the scroll jitters…
This should be resolved.