Created
April 6, 2023 01:36
-
-
Save mfrancois3k/74bed356cf8fa38fc23d079281534a1e to your computer and use it in GitHub Desktop.
text loading circle #CSS #effects
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
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <style> | |
| * { | |
| margin: 0; | |
| padding: 0; | |
| box-sizing: border-box; | |
| } | |
| body { | |
| background: #012; | |
| min-height: 100vh; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .circle { | |
| position: relative; | |
| width: 200px; | |
| height: 200px; | |
| border-radius: 100vmax; | |
| display: flex; | |
| align-items: center; | |
| justify-content: center; | |
| } | |
| .logo { | |
| position: absolute; | |
| width: 140px; | |
| height: 140px; | |
| background: url("https://assets.codepen.io/7344750/internal/avatars/users/default.png?fit=crop&format=auto&height=512&version=1657025755&width=512"); | |
| background-size: cover; | |
| border-radius: 100vmax; | |
| background-position: center; | |
| } | |
| .text { | |
| position: absolute; | |
| width: 100%; | |
| height: 100%; | |
| font-family: consolas; | |
| color: #fff; | |
| text-shadow: 0 0 10px #0ff; | |
| font-size: 17px; | |
| animation: textRotation 8s linear infinite; | |
| } | |
| @keyframes textRotation { | |
| to { | |
| transform: rotate(360deg); | |
| } | |
| } | |
| .text span { | |
| position: absolute; | |
| left: 50%; | |
| font-size: 1.2em; | |
| transform-origin: 0 100px; | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="circle"> | |
| <div class="logo"></div> | |
| <div class="text"> | |
| <p> | |
| Some text - Animated circle text - | |
| </p> | |
| </div> | |
| </div> | |
| <script> | |
| const text = document.querySelector(".text"); | |
| text.innerHTML = text.innerText | |
| .split("") | |
| .map( | |
| (char, i) => `<span style="transform:rotate(${i * 10.3}deg)">${char}</span>` | |
| ) | |
| .join(""); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment