I wish to create a CSS animation that act like "Blink effect" using LESS. My purpose is to call a single mixin passing each time 2 @stop
colors in order to get diffent color blink depending by css class of DOM element.
Currently I have the following HTML:
<p class='blink'>
Loading...
</p>
<p class='blink alert'>
<big>WARNING!!!! Operation failed.</big>
</p>
And here, LESS CODE:
.blink
{
.animation-blink-mixin(@dark-green,@light-green);
&.alert
{
.animation-blink-mixin(@dark-red,@light-red);
}
}
ANIMATION MIXIN:
.animation-blink-mixin (@stop1, @stop2, @time:2s)
{
animation:animation-blink @durata infinite;
.steps()
{
0% { color:@stop1; }
50% { color:@stop2; }
100% { color:@stop1; }
}
@keyframes animation-blink { .steps(); }
}
My problem is that both DOM elements have the same "red color" animation, instead being one green2green and others red2red.
I understood that problem is in "animation name" that is always the same. Some suggestion to reach desired behaviour?
Thanks.