I am building a GatsbyJS site with MUI. Using the withStyles
HOC, is it possible to make a blinking animation?
I tried providing animation in styles
:
const styles = theme => ({
'@keyframes blinker': {
from: {opacity: 1},
to: {opacity: 0}
},
headerGT: {
color: 'white',
animation: ['blinker', '1s', 'linear', 'infinite'],
'-webkit-animation': ['blinker', '1s', 'linear', 'infinite'],
'-moz-animation': ['blinker', '1s', 'linear', 'infinite'],
}
})
I can see the class and keyframes gets recognized and headerGT
has the animation method when the DOM is build, but the animation does not fire. Any ideas?
Standard blink animation is usually about 8 frames, with the lids closed for about 2 frames, and an ease-in and ease-out at either end. Often you want to offset the eye lids by one frame. To see how to do it in detail, watch the short tutorial video below.
Text Blinking feature can be done by animation property with blinking(any name), blink time, and up to blink time and @keyframes selector beside blinking(any name) same as given in animation and opacity property value.
I had the same problem but as specified in the JSS docs, referencing my animation with the $ prefix solved it.
Try this:
const style = theme => (
{
'@keyframes blinker': {
from: { opacity: 1 },
to: { opacity: 0 },
},
headerGT: {
[...]
animationName: '$blinker',
animationDuration: '1s',
animationTimingFunction: 'linear',
animationIterationCount: 'infinite',
},
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With