$ git show odometer

Rolling digits

Intermediate/anim odometer

An odometer-style number: each digit is a column of 0 to 9 that springs to its new value.

Main · New Architecture only · worklets live in react-native-worklets
transitionPropertytransform transitioncubicBezier
odometer.tsx · reanimated 4
// Reanimated 4: each column is a plain style with a transform transition
const H = 34;
const DIGITS = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9];

function Digit({ value }) {
  return (
    <View style={{ height: H, overflow: 'hidden' }}>
      <Animated.View style={{
        transform: [{ translateY: -value * H }],
        transitionProperty: 'transform',
        transitionDuration: '500ms',
        transitionTimingFunction: cubicBezier(0.4, 1.4, 0.5, 1), // small overshoot past the digit
      }}>
        {DIGITS.map((d) => <Text key={d} style={[styles.digit, { height: H, lineHeight: H }]}>{d}</Text>)}
      </Animated.View>
    </View>
  );
}

const chars = String(value).split('').reverse();
<View style={{ flexDirection: 'row-reverse' }}>
  {chars.map((ch, i) => <Digit key={i} value={Number(ch)} />)}
</View>