I have a LinearProgress bar that goes from 0 to 100 over the course of a few seconds, then jumps back to 0 and repeats.
<LinearProgress variant="determinate" value={progress}/>
The first load looks great with the animation. After it hits 100, the jump back to 0 ends up only reaching about 30, due to the long transition toward 0. If I turn off animations altogether, the jump from 100 to 0 is clean, but the progress from 0 to 100 is choppy.
Is it possible to have the animation/transition on while increasing but not decreasing/reset without swapping components? I see it's answered here for React Bootstrap, not sure if I can apply a similar technique here.
This works okay-ish, but would really like to avoid swapping components if possible:
const NoTransitionLinearProgress = withStyles({
bar: {
transition: 'none'
}
})(LinearProgress);
const ProgressBar = () => {
const progress = useSelector(state => state.progress);
if (progress > 0) {
return (
<LinearProgress variant="determinate" value={progress}/>
);
}
return (
<NoTransitionLinearProgress variant="determinate" value={progress}/>
);
}