I have read Less#loops and Less#functions docs.
But I can't figure out how to apply percentage
function, or a similar way to loop percentages progressively without using such function.
When I calculate it, out of a loop, as pointed out in another post width: percentage(140/620);
, it works, but not when trying to loop using variables.
On 2014 @pixelass suggested to use an external library to loop easier, but I don't feel like using an external library.
What I am trying to loop (and doesn't even compile):
.loop (@n, @index: 0) when (@index < @n) {
percentage(@index * (100/@n)){ // This line is messing up my day.
// code
}
.loop(@n, (@index + 1)); // Next iteration.
}
@keyframes anim {
.loop(20); // Launch the loop.
}
I am trying to translate this Sass to Less:
@keyframes anim{
$steps:20;
@for $i from 0 through $steps{
#{percentage($i*(1/$steps))}{
// code
}
}
}