I would like to animate MUI LinearProgress. I do have the animation keyframes code with me, but not sure on how to get the stripes working. Please advice.
This is my code:
import React, { FunctionComponent } from 'react';
import { Box, LinearProgress, LinearProgressProps } from '@mui/material';
import { styled, keyframes } from '@mui/material/styles';
const stripes = keyframes`
from {
background-position: 0 0;
}
to {
background-position: 30 0;
}
`;
const BorderLinearProgress = styled(LinearProgress)(({ theme }) => ({
height: 8,
borderRadius: 5,
animation: `${stripes} .3s linear infinite reverse`,
}));
const LinearProgressBar: FunctionComponent<LinearProgressProps> = (props) => {
return (
<Box sx={{ width: '100%' }}>
<BorderLinearProgress {...props} />
</Box>
);
};
export default LinearProgressBar;
Expected Output: Similar to this
Blueprint CSS: CSS Link
Stackblitz Link: Link