A Pen by Alberto Schiabel on CodePen.
Created
February 28, 2020 00:41
-
-
Save dalthonmh/2cde6102e118d3a408f624bfc431a7c2 to your computer and use it in GitHub Desktop.
Pure CSS ReactJS Logo Animation
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
<div class="circles"> | |
<div></div> | |
<div></div> | |
<div></div> | |
<span></span> | |
</div> |
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
$width: 333px; | |
$x: 3; | |
* { | |
box-sizing: border-box; | |
} | |
html, body { | |
width: 100%; | |
height: 100%; | |
overflow: hidden; | |
} | |
body { | |
display: flex; | |
justify-content: center; | |
align-items: center; | |
background: #2A2C2E; | |
} | |
.circles { | |
width: $width; | |
height: $width; | |
position: relative; | |
perspective: 50000px; | |
color: #61DAFB; | |
span { | |
position: absolute; | |
top: 50%; | |
left: 50%; | |
transform: translate(-50%, -50%); | |
display: block; | |
width: 18.4%; | |
height: 18.4%; | |
border-radius: 100%; | |
background: currentColor; | |
} | |
div { | |
position: absolute; | |
width: 100%; | |
height: 100%; | |
border-left: $width / 25 solid; | |
border-right: $width / 65 solid; | |
border-top: $width / 25 solid transparent; | |
border-radius: 100%; | |
@for $i from 1 through $x { | |
&:nth-child(#{$i}) { | |
animation: anim-#{$i} 1s linear infinite; | |
} | |
} | |
} | |
} | |
@for $i from 1 through $x { | |
@keyframes anim-#{$i} { | |
from { | |
transform: | |
rotateZ(360deg / $x * $i) | |
rotateX(66deg) | |
rotateZ(0deg); | |
} | |
to { | |
transform: | |
rotateZ(360deg / $x * $i) | |
rotateX(66deg) | |
rotateZ(360deg); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment