Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to change speed of animations/transitions. #73

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion _sass/hamburgers/_base.scss
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
border-radius: $hamburger-layer-border-radius;
position: absolute;
transition-property: transform;
transition-duration: 0.15s;
transition-duration: (0.15s * $hamburger-scale-speed);
transition-timing-function: ease;
}

Expand Down
1 change: 1 addition & 0 deletions _sass/hamburgers/hamburgers.scss
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ $hamburger-layer-border-radius : 4px !default;
$hamburger-hover-opacity : 0.7 !default;
$hamburger-active-layer-color : $hamburger-layer-color !default;
$hamburger-active-hover-opacity: $hamburger-hover-opacity !default;
$hamburger-scale-speed : 1 !default;

// To use CSS filters as the hover effect instead of opacity,
// set $hamburger-hover-use-filter as true and
Expand Down
6 changes: 3 additions & 3 deletions _sass/hamburgers/types/_3dx-r.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
}

.hamburger-inner {
transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),
background-color 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0.15s) cubic-bezier(0.645, 0.045, 0.355, 1),
background-color ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);

&::before,
&::after {
transition: transform 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions _sass/hamburgers/types/_3dx.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
}

.hamburger-inner {
transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),
background-color 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0.15s) cubic-bezier(0.645, 0.045, 0.355, 1),
background-color ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);

&::before,
&::after {
transition: transform 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions _sass/hamburgers/types/_3dxy-r.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
}

.hamburger-inner {
transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),
background-color 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0.15s) cubic-bezier(0.645, 0.045, 0.355, 1),
background-color ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);

&::before,
&::after {
transition: transform 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions _sass/hamburgers/types/_3dxy.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
}

.hamburger-inner {
transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),
background-color 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0.15s) cubic-bezier(0.645, 0.045, 0.355, 1),
background-color ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);

&::before,
&::after {
transition: transform 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions _sass/hamburgers/types/_3dy-r.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
}

.hamburger-inner {
transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),
background-color 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0.15s) cubic-bezier(0.645, 0.045, 0.355, 1),
background-color ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);

&::before,
&::after {
transition: transform 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);
}
}

Expand Down
6 changes: 3 additions & 3 deletions _sass/hamburgers/types/_3dy.scss
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@
}

.hamburger-inner {
transition: transform 0.15s cubic-bezier(0.645, 0.045, 0.355, 1),
background-color 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0.15s) cubic-bezier(0.645, 0.045, 0.355, 1),
background-color ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);

&::before,
&::after {
transition: transform 0s 0.1s cubic-bezier(0.645, 0.045, 0.355, 1);
transition: transform ($hamburger-scale-speed * 0s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.645, 0.045, 0.355, 1);
}
}

Expand Down
16 changes: 8 additions & 8 deletions _sass/hamburgers/types/_arrowalt-r.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
.hamburger--arrowalt-r {
.hamburger-inner {
&::before {
transition: top 0.1s 0.1s ease,
transform 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);
transition: top ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) cubic-bezier(0.165, 0.84, 0.44, 1);
}

&::after {
transition: bottom 0.1s 0.1s ease,
transform 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);
transition: bottom ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) cubic-bezier(0.165, 0.84, 0.44, 1);
}
}

Expand All @@ -20,15 +20,15 @@
&::before {
top: 0;
transform: translate3d($hamburger-layer-width * 0.2, $hamburger-layer-width * -0.25, 0) rotate(45deg) scale(0.7, 1);
transition: top 0.1s ease,
transform 0.1s 0.1s cubic-bezier(0.895, 0.03, 0.685, 0.22);
transition: top ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.895, 0.03, 0.685, 0.22);
}

&::after {
bottom: 0;
transform: translate3d($hamburger-layer-width * 0.2, $hamburger-layer-width * 0.25, 0) rotate(-45deg) scale(0.7, 1);
transition: bottom 0.1s ease,
transform 0.1s 0.1s cubic-bezier(0.895, 0.03, 0.685, 0.22);
transition: bottom ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.895, 0.03, 0.685, 0.22);
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions _sass/hamburgers/types/_arrowalt.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@
.hamburger--arrowalt {
.hamburger-inner {
&::before {
transition: top 0.1s 0.1s ease,
transform 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);
transition: top ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) cubic-bezier(0.165, 0.84, 0.44, 1);
}

&::after {
transition: bottom 0.1s 0.1s ease,
transform 0.1s cubic-bezier(0.165, 0.84, 0.44, 1);
transition: bottom ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) cubic-bezier(0.165, 0.84, 0.44, 1);
}
}

Expand All @@ -20,15 +20,15 @@
&::before {
top: 0;
transform: translate3d($hamburger-layer-width * -0.2, $hamburger-layer-width * -0.25, 0) rotate(-45deg) scale(0.7, 1);
transition: top 0.1s ease,
transform 0.1s 0.1s cubic-bezier(0.895, 0.03, 0.685, 0.22);
transition: top ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.895, 0.03, 0.685, 0.22);
}

&::after {
bottom: 0;
transform: translate3d($hamburger-layer-width * -0.2, $hamburger-layer-width * 0.25, 0) rotate(45deg) scale(0.7, 1);
transition: bottom 0.1s ease,
transform 0.1s 0.1s cubic-bezier(0.895, 0.03, 0.685, 0.22);
transition: bottom ($hamburger-scale-speed * 0.1s) ease,
transform ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.1s) cubic-bezier(0.895, 0.03, 0.685, 0.22);
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions _sass/hamburgers/types/_collapse-r.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@
.hamburger-inner {
top: auto;
bottom: 0;
transition-duration: 0.13s;
transition-delay: 0.13s;
transition-duration: ($hamburger-scale-speed * 0.13s);
transition-delay: ($hamburger-scale-speed * 0.13s);
transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);

&::after {
top: ($hamburger-layer-spacing * 2 + $hamburger-layer-height * 2) * -1;
transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1),
opacity 0.1s linear;
transition: top ($hamburger-scale-speed * 0.2s) ($hamburger-scale-speed * 0.2s) cubic-bezier(0.33333, 0.66667, 0.66667, 1),
opacity ($hamburger-scale-speed * 0.1s) linear;
}

&::before {
transition: top 0.12s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1),
transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19);
transition: top ($hamburger-scale-speed * 0.12s) ($hamburger-scale-speed * 0.2s) cubic-bezier(0.33333, 0.66667, 0.66667, 1),
transform ($hamburger-scale-speed * 0.13s) cubic-bezier(0.55, 0.055, 0.675, 0.19);
}
}

&.is-active {
.hamburger-inner {
transform: translate3d(0, ($hamburger-layer-spacing + $hamburger-layer-height) * -1, 0) rotate(45deg);
transition-delay: 0.22s;
transition-delay: ($hamburger-scale-speed * 0.22s);
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);

&::after {
top: 0;
opacity: 0;
transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333),
opacity 0.1s 0.22s linear;
transition: top ($hamburger-scale-speed * 0.2s) cubic-bezier(0.33333, 0, 0.66667, 0.33333),
opacity ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.22s) linear;
}

&::before {
top: 0;
transform: rotate(90deg);
transition: top 0.1s 0.16s cubic-bezier(0.33333, 0, 0.66667, 0.33333),
transform 0.13s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);
transition: top ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.16s) cubic-bezier(0.33333, 0, 0.66667, 0.33333),
transform ($hamburger-scale-speed * 0.13s) ($hamburger-scale-speed * 0.25s) cubic-bezier(0.215, 0.61, 0.355, 1);
}
}
}
Expand Down
22 changes: 11 additions & 11 deletions _sass/hamburgers/types/_collapse.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,40 +6,40 @@
.hamburger-inner {
top: auto;
bottom: 0;
transition-duration: 0.13s;
transition-delay: 0.13s;
transition-duration: ($hamburger-scale-speed * 0.13s);
transition-delay: ($hamburger-scale-speed * 0.13s);
transition-timing-function: cubic-bezier(0.55, 0.055, 0.675, 0.19);

&::after {
top: ($hamburger-layer-spacing * 2 + $hamburger-layer-height * 2) * -1;
transition: top 0.2s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1),
opacity 0.1s linear;
transition: top ($hamburger-scale-speed * 0.2s) ($hamburger-scale-speed * 0.2s) cubic-bezier(0.33333, 0.66667, 0.66667, 1),
opacity ($hamburger-scale-speed * 0.1s) linear;
}

&::before {
transition: top 0.12s 0.2s cubic-bezier(0.33333, 0.66667, 0.66667, 1),
transform 0.13s cubic-bezier(0.55, 0.055, 0.675, 0.19);
transition: top ($hamburger-scale-speed * 0.12s) ($hamburger-scale-speed * 0.2s) cubic-bezier(0.33333, 0.66667, 0.66667, 1),
transform ($hamburger-scale-speed * 0.13s) cubic-bezier(0.55, 0.055, 0.675, 0.19);
}
}

&.is-active {
.hamburger-inner {
transform: translate3d(0, ($hamburger-layer-spacing + $hamburger-layer-height) * -1, 0) rotate(-45deg);
transition-delay: 0.22s;
transition-delay: ($hamburger-scale-speed * 0.22s);
transition-timing-function: cubic-bezier(0.215, 0.61, 0.355, 1);

&::after {
top: 0;
opacity: 0;
transition: top 0.2s cubic-bezier(0.33333, 0, 0.66667, 0.33333),
opacity 0.1s 0.22s linear;
transition: top ($hamburger-scale-speed * 0.2s) cubic-bezier(0.33333, 0, 0.66667, 0.33333),
opacity ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.22s) linear;
}

&::before {
top: 0;
transform: rotate(-90deg);
transition: top 0.1s 0.16s cubic-bezier(0.33333, 0, 0.66667, 0.33333),
transform 0.13s 0.25s cubic-bezier(0.215, 0.61, 0.355, 1);
transition: top ($hamburger-scale-speed * 0.1s) ($hamburger-scale-speed * 0.16s) cubic-bezier(0.33333, 0, 0.66667, 0.33333),
transform ($hamburger-scale-speed * 0.13s) ($hamburger-scale-speed * 0.25s) cubic-bezier(0.215, 0.61, 0.355, 1);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions _sass/hamburgers/types/_elastic-r.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
.hamburger--elastic-r {
.hamburger-inner {
top: math.div($hamburger-layer-height, 2);
transition-duration: 0.275s;
transition-duration: ($hamburger-scale-speed * 0.275s);
transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);

&::before {
top: $hamburger-layer-height + $hamburger-layer-spacing;
transition: opacity 0.125s 0.275s ease;
transition: opacity ($hamburger-scale-speed * 0.125s) ($hamburger-scale-speed * 0.275s) ease;
}

&::after {
top: ($hamburger-layer-height * 2) + ($hamburger-layer-spacing * 2);
transition: transform 0.275s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: transform ($hamburger-scale-speed * 0.275s) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
}

Expand All @@ -26,16 +26,16 @@
$y-offset: $hamburger-layer-spacing + $hamburger-layer-height;

transform: translate3d(0, $y-offset, 0) rotate(-135deg);
transition-delay: 0.075s;
transition-delay: ($hamburger-scale-speed * 0.075s);

&::before {
transition-delay: 0s;
transition-delay: ($hamburger-scale-speed * 0s);
opacity: 0;
}

&::after {
transform: translate3d(0, $y-offset * -2, 0) rotate(270deg);
transition-delay: 0.075s;
transition-delay: ($hamburger-scale-speed * 0.075s);
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions _sass/hamburgers/types/_elastic.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
.hamburger--elastic {
.hamburger-inner {
top: math.div($hamburger-layer-height, 2);
transition-duration: 0.275s;
transition-duration: ($hamburger-scale-speed * 0.275s);
transition-timing-function: cubic-bezier(0.68, -0.55, 0.265, 1.55);

&::before {
top: $hamburger-layer-height + $hamburger-layer-spacing;
transition: opacity 0.125s 0.275s ease;
transition: opacity ($hamburger-scale-speed * 0.125s) ($hamburger-scale-speed * 0.275s) ease;
}

&::after {
top: ($hamburger-layer-height * 2) + ($hamburger-layer-spacing * 2);
transition: transform 0.275s cubic-bezier(0.68, -0.55, 0.265, 1.55);
transition: transform ($hamburger-scale-speed * 0.275s) cubic-bezier(0.68, -0.55, 0.265, 1.55);
}
}

Expand All @@ -26,16 +26,16 @@
$y-offset: $hamburger-layer-spacing + $hamburger-layer-height;

transform: translate3d(0, $y-offset, 0) rotate(135deg);
transition-delay: 0.075s;
transition-delay: ($hamburger-scale-speed * 0.075s);

&::before {
transition-delay: 0s;
transition-delay: ($hamburger-scale-speed * 0s);
opacity: 0;
}

&::after {
transform: translate3d(0, $y-offset * -2, 0) rotate(-270deg);
transition-delay: 0.075s;
transition-delay: ($hamburger-scale-speed * 0.075s);
}
}
}
Expand Down
Loading