Skip to content

Instantly share code, notes, and snippets.

@jstewsy
Last active November 3, 2018 23:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jstewsy/cfad40e1e1cee7cbbc57a7dc4cf3d7f2 to your computer and use it in GitHub Desktop.
Save jstewsy/cfad40e1e1cee7cbbc57a7dc4cf3d7f2 to your computer and use it in GitHub Desktop.
material design motion scss mixin concept
/**
* material-motion
*
* apply configurable animation enter and exit speed/easing combo for mobile
* and medium view port sizes
*/
$enter-animation-speed: 0.225s;
$enter-animation-speed-medium: 0.300s;
$enter-animation-easing: cubic-bezier(0, 0, 0.2, 1);
$exit-animation-speed: 0.195s;
$exit-animation-speed-medium: 0.250s;
$exit-animation-easing: cubic-bezier(0.4, 0, 0.6, 1);
@mixin material-motion($properties: all, $state: 'enter') {
@if $state == 'enter' {
transition: $properties $enter-animation-speed $enter-animation-easing;
@media screen and (min-width: $breakpoint) {
transition-duration: $enter-animation-speed-medium;
}
}
@if $state == 'exit' {
transition: $properties $exit-animation-speed $exit-animation-easing;
@media screen and (min-width: $breakpoint) {
transition-duration: $exit-animation-speed-medium;
}
}
}
// ex $breakpoint = 650px;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment