-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Implement hexagon spinner (new structure) #144
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,6 +2,7 @@ | |
| :root { | ||
| --sk-size: 40px; | ||
| --sk-color: #333; | ||
| --sk-hex-scale: (0.0096153846153846 * var(--sk-size)); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Where does this number come from? Why is it so exact? Can we get rid of if (if we get rid of the parent element)? |
||
| } | ||
|
|
||
|
|
||
|
|
@@ -572,4 +573,100 @@ | |
| } 100% { | ||
| transform: rotate(-360deg); | ||
| } | ||
| } | ||
|
|
||
| /* Hexagon | ||
|
|
||
| <div class="sk-hexagon"> | ||
| <div class="sk-hex-parent"> | ||
| <div class="sk-hex-child"></div> | ||
| <div class="sk-hex-child"></div> | ||
| <div class="sk-hex-child"></div> | ||
| </div> | ||
| </div> | ||
| */ | ||
| .sk-hexagon { | ||
| height: var(--sk-size); | ||
| overflow: hidden; | ||
| position: relative; | ||
| width: var(--sk-size); | ||
| } | ||
|
|
||
| .sk-hex-parent { | ||
| left: calc(27 * var(--sk-hex-scale)); | ||
| position: relative; | ||
| top: calc(16 * var(--sk-hex-scale)); | ||
| } | ||
|
|
||
| .sk-hex-child { | ||
| animation: sk-hexagonAnimation 2s infinite cubic-bezier(.19, 1.6, .4, 1); | ||
| background-color: var(--sk-color); | ||
| display: block; | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't need |
||
| height: calc(26 * var(--sk-hex-scale)); | ||
| opacity: 0; | ||
| position: absolute; | ||
| transform: scale(0); | ||
| transform-origin: center center; | ||
| width: calc(48 * var(--sk-hex-scale)); | ||
| } | ||
|
|
||
| .sk-hex-child::before, | ||
| .sk-hex-child::after { | ||
| border-left: calc(24 * var(--sk-hex-scale)) solid transparent; | ||
| border-right: calc(24 * var(--sk-hex-scale)) solid transparent; | ||
| content: ""; | ||
| height: 0; | ||
| position: absolute; | ||
| width: 0; | ||
| } | ||
|
|
||
| .sk-hex-child::before { | ||
| border-bottom: calc(13 * var(--sk-hex-scale)) solid var(--sk-color); | ||
| top: calc(-13 * var(--sk-hex-scale)); | ||
| } | ||
|
|
||
| .sk-hex-child::after { | ||
| border-top: calc(13 * var(--sk-hex-scale)) solid var(--sk-color); | ||
| bottom: calc(-13 * var(--sk-hex-scale)); | ||
| } | ||
|
|
||
| .sk-hex-child:nth-child(2), | ||
| .sk-hex-child:nth-child(3) { | ||
| top: calc(45 * var(--sk-hex-scale)); | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There's a lot of |
||
| } | ||
|
|
||
| .sk-hex-child:nth-child(1) { | ||
| animation-delay: .1s; | ||
| } | ||
|
|
||
| .sk-hex-child:nth-child(2) { | ||
| animation-delay: 0s; | ||
| left: calc(-27 * var(--sk-hex-scale)); | ||
| } | ||
|
|
||
| .sk-hex-child:nth-child(3) { | ||
| animation-delay: .2s; | ||
| left: calc(27 * var(--sk-hex-scale)); | ||
| } | ||
|
|
||
| @keyframes sk-hexagonAnimation { | ||
| 0% { | ||
| opacity: 0; | ||
| transform: scale(0) translateZ(0); | ||
| } | ||
|
|
||
| 40% { | ||
| opacity: 1; | ||
| transform: scale(1) translateZ(0); | ||
| } | ||
|
|
||
| 60% { | ||
| opacity: 1; | ||
| transform: scale(1) translateZ(0); | ||
| } | ||
|
|
||
| 100% { | ||
| opacity: 0; | ||
| transform: scale(0) translateZ(0); | ||
| } | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All keyframes that share all properties (like 100% and 0% can be defined on the same row 🙏 |
||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we get rid of this
sk-hex-parentelement? It's only used for positioning that could be applied directly to the children, right?