我想用手写笔创建微调器预加载器(如ios风格)。
我在for
元素中有petal
个周期。
我的变量delay
& degree
未正确编译
我需要旋转每个第n个元素并延迟每个动画
请帮帮我。这是我的代码:
animation a-preloader 1s infinite linear
delay = 0s
degree = 0deg
for num in (1..12)
&:nth-child({num})
animation-delay delay
transform rotate(degree)
delay = delay + 0.083s
degree = degree + 30deg
And here is my playground Codepen
预期结果:
答案 0 :(得分:1)
我们需要声明增量
delay = delay + 0.083s
degree = degree + 30deg
&:nth-child({num})
,如下:
animation a-preloader 1s infinite linear
delay = 0s
degree = 0deg
for num in (1..12)
&:nth-child({num})
animation-delay delay
transform rotate(degree)
delay = delay + 0.083s
degree = degree + 30deg