Skip to content

Instantly share code, notes, and snippets.

@PaulieScanlon
Last active February 19, 2022 03:01
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PaulieScanlon/ed52c1a3e3f077b7c8f3398de04b1a05 to your computer and use it in GitHub Desktop.
Save PaulieScanlon/ed52c1a3e3f077b7c8f3398de04b1a05 to your computer and use it in GitHub Desktop.
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