Open kevinaltschuler opened 1 year ago
Hi, thanks for updating this, it's really helped me.
I may have used it incorrectly but it seemed to me that this code
let animation = Animated.sequence([
Animated.timing(time.current, {
toValue: 0,
duration: 0,
delay: (length / fps) * 1000,
easing: Easing.linear,
useNativeDriver: false,
}),
Animated.timing(time.current, {
toValue: length,
duration: 0,
easing: Easing.linear,
useNativeDriver: false,
delay: (length / fps) * 1000,
}),
]);
caused only the first and last frames to be played. Again maybe I misunderstood how to use it. But I ended up changing it to this
const frames = [].concat(...Array.from({ length }, (_, i) => [i + 1]));
const animation = Animated.sequence(frames.map(frame =>
Animated.timing(time.current, {
toValue: frame,
duration: 0,
delay: (length / fps) * 1000,
easing: Easing.linear,
useNativeDriver: false,
})
));
and it got it cycling through all frames. Thanks again!
that first line is a little weird i think you can do that like this:
const frames = Array.from(Array(length).keys())
did this for personal use and figured i would share, this is NOT very well tested but it should be either working or close to working for most use cases.