CSS css3 关键帧动画的 SASS(非 SCSS)语法
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18894981/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
SASS (not SCSS) syntax for css3 keyframe animation
提问by daviestar
Is there any way to write keyframes in SASS?
有没有办法在SASS中编写关键帧?
Every example I have found is actually SCSS, even when it says it's SASS. To be clear, I mean the one with no curly brackets.
我发现的每个例子实际上都是 SCSS,即使它说它是 SASS。明确地说,我的意思是没有大括号的那个。
回答by daviestar
Here is how you implement css keyframes in the Sass syntax:
以下是在 Sass 语法中实现 css 关键帧的方法:
@keyframes name-of-animation
0%
transform: rotate(0deg)
100%
transform: rotate(360deg)
Here is a Sass mixin to add vendor prefixes:
这是一个用于添加供应商前缀的 Sass mixin:
=keyframes($name)
@-webkit-keyframes #{$name}
@content
@-moz-keyframes #{$name}
@content
@-ms-keyframes #{$name}
@content
@keyframes #{$name}
@content
Here's how to use the mixin in Sass syntax:
以下是在 Sass 语法中使用 mixin 的方法:
+keyframes(name-of-animation)
0%
transform: rotate(0deg)
100%
transform: rotate(360deg)