I have an animation that I want to use in a react.js component.
@keyframes pulse {
0% {
background-color: #94A3B8;
}
50% {
background-color: #CBD5E1;
}
100% {
background-color: #94A3B8;
}
}
I can put it in a CSS file and import it into the react component. then i can reference it like this:
<div style={{animation: "pulse"}}></div>
I'm curious if animation can be defined in the component. something like this:
const animation = `
@keyframes pulse {
0% {
background-color: #94A3B8;
}
50% {
background-color: #CBD5E1;
}
100% {
background-color: #94A3B8;
}
}
`
<div style={{ keyframes: animation }}></div>