Stylus - 如何实现参数化变换?
Stylus - How to achieve a parametric transform?
我有一个ul
,里面有N个li
。我想将每个 li
旋转 360/N
度,使它们形成一个轮子。
我在 Stylus 中尝试了很多语法来实现这一点,但我总是得到同样的错误:
expected "ident" or "string", got "unit 360"
例如:
n=8
for i in (1..n)
li:nth-child({i})
transform rotate( {360/i}deg ) // expected "ident" or "string", got "unit 360"
或
n=8
for i in (1..n)
li:nth-child({i})
transform rotate( {360/i + 'deg'} ) // expected "ident" or "string", got "unit 360"
或
n=8
rotation = 0deg
for i in (1..n)
li:nth-child({i})
transform rotate( rotation )
rotation = rotation + {360/i} + "deg" // expected "ident" or "string", got "unit 360"
或
n=8
rotation = 0deg
for i in (1..n)
li:nth-child({i})
transform rotate( rotation )
rotation += {360/i + "deg"} // expected "ident" or "string", got "unit 360"
有人知道正确的语法吗?
更简单:
n=8
for i in (1..n)
li:nth-child({i})
transform rotate(360/i deg)
我有一个ul
,里面有N个li
。我想将每个 li
旋转 360/N
度,使它们形成一个轮子。
我在 Stylus 中尝试了很多语法来实现这一点,但我总是得到同样的错误:
expected "ident" or "string", got "unit 360"
例如:
n=8
for i in (1..n)
li:nth-child({i})
transform rotate( {360/i}deg ) // expected "ident" or "string", got "unit 360"
或
n=8
for i in (1..n)
li:nth-child({i})
transform rotate( {360/i + 'deg'} ) // expected "ident" or "string", got "unit 360"
或
n=8
rotation = 0deg
for i in (1..n)
li:nth-child({i})
transform rotate( rotation )
rotation = rotation + {360/i} + "deg" // expected "ident" or "string", got "unit 360"
或
n=8
rotation = 0deg
for i in (1..n)
li:nth-child({i})
transform rotate( rotation )
rotation += {360/i + "deg"} // expected "ident" or "string", got "unit 360"
有人知道正确的语法吗?
更简单:
n=8
for i in (1..n)
li:nth-child({i})
transform rotate(360/i deg)