-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added new "Arrow" burger menu animation
- Loading branch information
Showing
5 changed files
with
93 additions
and
16 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
<script lang="ts"> | ||
import { DIRECTION } from "./enums"; | ||
export let open = false; | ||
export let duration = 0.5; | ||
export let direction = DIRECTION.LEFT; | ||
</script> | ||
|
||
<svg | ||
role="button" | ||
tabindex="-1" | ||
viewBox="0 0 100 100" | ||
on:click={() => (open = !open)} | ||
on:keypress={() => (open = !open)} | ||
style:--duration="{duration}s" | ||
style:--direction="{direction}deg" | ||
> | ||
<g class:open> | ||
<path /> | ||
</g> | ||
</svg> | ||
|
||
<style lang="scss"> | ||
svg { | ||
cursor: pointer; | ||
fill: none; | ||
outline: transparent; | ||
transform: rotate(var(--direction)); | ||
} | ||
g { | ||
transform-origin: center; | ||
} | ||
path { | ||
stroke-linecap: round; | ||
d: path("M8 18L92 18M8 50H92M8 82L92 82"); | ||
stroke: currentcolor; | ||
stroke-width: 16; | ||
} | ||
.open { | ||
transform: rotate(180deg); | ||
path { | ||
d: path("M60 18L92 50M8 50H92M60 82L92 50"); | ||
} | ||
} | ||
@media (prefers-reduced-motion: no-preference) { | ||
g, | ||
path { | ||
transition: var(--duration); | ||
} | ||
} | ||
</style> |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export const DIRECTION = { | ||
LEFT: 0, | ||
UP: 90, | ||
RIGHT: 180, | ||
DOWN: 270, | ||
}; |
This file contains 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
This file contains 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