Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to apply gradient animation effects in react component

Tags:

css

reactjs

how to make use of gradient animation effects like this in react component in-line. I have to make use of below CSS based gradient animation effects as inline in react component. Is there any specific package(s) available for that?

body {
width: 100wh;
height: 90vh;
color: #fff;
background: linear-gradient(-45deg, #EE7752, #E73C7E, #23A6D5, #23D5AB);
background-size: 400% 400%;
-webkit-animation: Gradient 15s ease infinite;
-moz-animation: Gradient 15s ease infinite;
animation: Gradient 15s ease infinite;
}

@-webkit-keyframes Gradient {
    0% {
        background-position: 0% 50%
    }
    50% {
        background-position: 100% 50%
    }
    100% {
        background-position: 0% 50%
    }
}

@-moz-keyframes Gradient {
    0% {
        background-position: 0% 50%
    }
    50% {
        background-position: 100% 50%
    }
    100% {
        background-position: 0% 50%
    }
}

@keyframes Gradient {
    0% {
        background-position: 0% 50%
    }
    50% {
        background-position: 100% 50%
    }
    100% {
        background-position: 0% 50%
    }
}

h1,
h6 {
    font-family: 'Open Sans';
    font-weight: 300;
    text-align: center;
    position: absolute;
    top: 45%;
    right: 0;
    left: 0;
}
like image 738
arun chakravarthy Avatar asked Feb 28 '18 09:02

arun chakravarthy


1 Answers

Take a look at this:

https://codepen.io/anon/pen/BYvVqP

I just used a state to store the classes.

className={this.state.animationClass}
like image 144
Janick Fischer Avatar answered Oct 17 '22 01:10

Janick Fischer