2017-02-23 1 views
1

私はLESSでアニメーション遅延を生成しようとしています。最終結果はのようになります。しかし、それは動作しませんアニメーションがLESSで生成を遅らせます

@animation-delays: 10; 
@animation-delay-step: .5; // delay in seconds 

.animation-delays-loop (@i) when (@i > 0) { 
    [data-animation-step="@{i}"] { 
     @animation-delay = @animation-delay-step * @{i}; 
     animation-delay: @animation-delay~"s"; 
    } 
    .animation-delays-loop(@i - 1); 
} 
.animation-delays-loop (@animation-delays); 

[data-animation-delay="1"] { 
    animation-delay: .5s; 
} 
[data-animation-delay="2"] { 
    animation-delay: 1s; 
} 

私のコードは次のようになります。問題はanimation-delay: @animation-delay~"s";にあるようです。任意のアイデアを修正する方法は?

+1

'1s 'を乗算しようとしましたか? – chazsolo

+0

@chazsolo、ありがとう私は解決策を見つけました。 – sdvnksv

答えて

1

OK、私はこれを行うことになってしまった:

@animation-delays: 10; 
@animation-delay-step: .5; // delay in seconds 

.animation-delays-loop (@i) when (@i > 0) { 
    [data-animation-step="@{i}"] { 
     @animation-delay: @i * @animation-delay-step; 
     animation-delay: ~"@{animation-delay}s"; 
    } 
    .animation-delays-loop(@i - 1); 
} 
.animation-delays-loop (@animation-delays); 

は魅力のように働きました。

関連する問題