将SASS数学表达式转换为LESS
问题描述:
我有SASS代码在里面生成CSS类,这很好。它具有循环和简单的数学表达式。将SASS数学表达式转换为LESS
我想将它转换为LESS,但我无法自己完成它。请看下面的代码。
我该如何将这个转化为SESS所做的LESS代码?
@for $i from 1 through (($point-count + 1)/2) {
&:nth-of-type(#{$i}) {
transform: rotate(360deg/$point-count * ($i - 1));
}
&:nth-of-type(#{$i + $point-count/2}) {
transform: rotate(180deg + 360deg/$point-count * ($i - 1));
}
&:nth-of-type(#{$i}), &:nth-of-type(#{$i + $point-count/2}) {
&:before {
animation-delay: - $spin-animation-time + ($spin-animation-time/$point-count * 2 * ($i - 1));
}
}
}
答
.loop(@i) when (@i < (@point-count + 1)/2) {
.loop((@i + 1));
&:nth-of-type(@{i}) {
transform: rotate(360deg/@point-count * (@i - 1));
}
@index: @i + @point-count/2;
&:nth-of-type(@{index}) {
transform: rotate(180deg + 360deg/@point-count * (@i - 1));
}
&:nth-of-type(@{i}),
&:nth-of-type(@{index}) {
&:before {
animation-delay: - @spin-animation-time + (@spin-animation-time/@point-count * 2 * (@i - 1));
}
}
}
.loop(1)
你能代码LESS简单[循环](http://lesscss.org/features/#loops-feature)?管理变量的插值(以循环开始)? – FelipeAls