Last active
May 18, 2021 15:58
-
-
Save lunelson/1a5abecfa5823b154922 to your computer and use it in GitHub Desktop.
Fork of Tomeij's Animation mixin
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // ---- | |
| // Sass (v3.4.14) | |
| // Compass (v1.0.3) | |
| // ---- | |
| @mixin animation($args...) { | |
| $name: unique-id(); // name for @keyframes | |
| $args: join((), $args, 'space'); // conform args as SSV | |
| animation: $name + ' ' + $args; | |
| @keyframes #{$name} { | |
| @content; | |
| } | |
| } | |
| // alias of above | |
| @mixin anim($args...) { @include animation($args...) { @content; } } | |
| .test1 { | |
| @include anim(0.5s ease-in) { | |
| from { background-position: 0% 0%; } | |
| to { background-position: 114.2857% 0%; } | |
| } | |
| } | |
| .test2 { | |
| @include anim(1s, ease-out) { | |
| from { width: 2rem; } | |
| to { width: 5rem; } | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .test1 { | |
| animation: urudhohfy 0.5s ease-in; | |
| } | |
| @keyframes urudhohfy { | |
| from { | |
| background-position: 0% 0%; | |
| } | |
| to { | |
| background-position: 114.2857% 0%; | |
| } | |
| } | |
| .test2 { | |
| animation: urudhohg6 1s ease-out; | |
| } | |
| @keyframes urudhohg6 { | |
| from { | |
| width: 2rem; | |
| } | |
| to { | |
| width: 5rem; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment