Last active
February 19, 2022 03:01
-
-
Save PaulieScanlon/ed52c1a3e3f077b7c8f3398de04b1a05 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using the example from https://paulie.dev/posts/2021/02/theme-ui-alpha-6/#css-keyframes | |
you could also store the animationName as a const | |
const animationTypeOne = keyframes({ | |
'0%': { | |
opacity: 1, | |
}, | |
'20%': { | |
opacity: 0, | |
}, | |
'100%': { | |
opacity: 1, | |
}, | |
}) | |
... | |
{dots.map((dot, index) => ( | |
<Box | |
key={index} | |
sx={{ | |
animationDelay: `${index / 10}s`, | |
animationDuration: '1.2s', | |
animationTimingFunction: 'linear', | |
animationIterationCount: 'infinite', | |
animationName: animationTypeOne, // <= use a const as the animationName | |
backgroundColor: 'primary', | |
borderRadius: `${size}`, | |
height: `${size}`, | |
width: `${size}`, | |
opacity: 0, | |
}} | |
/> | |
))} | |
... | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment