Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SASS (not SCSS) syntax for css3 keyframe animation

Tags:

css

sass

keyframe

Is there any way to write keyframes in 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.

like image 502
daviestar Avatar asked Sep 19 '13 12:09

daviestar


People also ask

Does css3 use keyframe animation?

You can change as many CSS properties you want, as many times as you want. To use CSS animation, you must first specify some keyframes for the animation.

What is the syntax of sass?

SASS supports two syntaxes namely SCSS and Indented syntax. The SCSS (Sassy CSS) is an extension of CSS syntax. This means every valid CSS is a valid SCSS as well. SCSS makes much easier to maintain large stylesheets and can recognize vendor specific syntax, Many CSS and SCSS files use the extension .

What is keyframe CSS animation?

Definition and Usage The @keyframes rule specifies the animation code. The animation is created by gradually changing from one set of CSS styles to another. During the animation, you can change the set of CSS styles many times.


1 Answers

Here is how you implement css keyframes in the Sass syntax:

@keyframes name-of-animation   0%     transform: rotate(0deg)   100%     transform: rotate(360deg) 

Here is a Sass mixin to add vendor prefixes:

=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:

+keyframes(name-of-animation)   0%     transform: rotate(0deg)   100%     transform: rotate(360deg) 
like image 103
daviestar Avatar answered Oct 05 '22 00:10

daviestar