Using Code Block for Animation in LESS
Let's make a function that sets animation keyframes:
.keyframes(@name, @code) {
@keyframes @name {@code();}
}
Let's use our function:
.keyframes(anim, {
from {
width: 100px;
}
to {
width: 200px;
}
});
Compilation result:
@keyframes anim {
from {
width: 100px;
}
to {
width: 200px;
}
}