i want to change font color for part of text every second using react and javascript.
this is my string "good morning"
i want the text "morning" to change colors
below are the colors i want to change
red, green, blue, yellow, purple, pink, black
below is what i have tried,
const Parent = () => {
<div>
<span>good</span>
<span class="change">morning</span>
</div>
}
.change {
animation: change 1s step-end both;
}
@key-frames change {
from {color: red}
to {color: green}
}
but the above only changes the text from red to green. how do i keep it as a loop like should change text color from red, green, blue, yellow, purple, pink, black and again red,green and so on.
could someone help me fix this. thanks.