Indeed, what you're looking for is a css animation, not just a transition. While transitions help create a smooth shift between states, animations provide more intricate behaviors by altering css properties.
The basic structure would be something like this:
element {
animation-name: yourAnimationName;
animation-timing-function: cubic-bezier(.79,0,.46,1);
animation-delay: 0.25s;
}
@keyframes yourAnimationName {
// specify which css properties to animate
}
You can define keyframes with from and to values:
@keyframes yourAnimationName {
from { background-color: red; }
to { background-color: yellow; }
}
Alternatively, you can have multiple keyframes using percentages to indicate the progress of the animation:
@keyframes example {
0% {background-color: red;}
25% {background-color: yellow;}
50% {background-color: blue;}
100% {background-color: green;}
}
If you use keyframes with percentage values, you may not need the cubic-bezier timing function.
For further information on css animations, I suggest checking out this resource HERE.