Created
August 12, 2020 23:55
-
-
Save shvchk/73dd9ca962e95ff4c014ace3027f18d5 to your computer and use it in GitHub Desktop.
Growing rings spinner / loader
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 lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Growing rings</title> | |
| <style> | |
| :root { | |
| --pi: 3.141592653589793; | |
| } | |
| body { | |
| background: #000; | |
| } | |
| svg { | |
| overflow: visible; | |
| } | |
| .loading { | |
| width: 94px; /* +1px stroke width on all sides */ | |
| height: 94px; /* +1px stroke width on all sides */ | |
| padding: 50px; | |
| transform: rotate(-90deg); | |
| } | |
| .ring { | |
| fill: none; | |
| stroke: #fff; | |
| stroke-width: 1.25; | |
| stroke-dasharray: 0, calc(2 * var(--pi) * var(--r)); | |
| stroke-dashoffset: 0; | |
| animation: dash 2.5s cubic-bezier(0, .5, 1, 1) infinite; | |
| } | |
| .ring-0 { | |
| --r: 1%; | |
| animation-delay: 1.4s; | |
| } | |
| .ring-1 { | |
| --r: 8%; | |
| animation-delay: 1.2s; | |
| } | |
| .ring-2 { | |
| --r: 15%; | |
| animation-delay: 1s; | |
| } | |
| .ring-3 { | |
| --r: 22%; | |
| animation-delay: .8s; | |
| } | |
| .ring-4 { | |
| --r: 29%; | |
| animation-delay: .6s; | |
| } | |
| .ring-5 { | |
| --r: 36%; | |
| animation-delay: .4s; | |
| } | |
| .ring-6 { | |
| --r: 43%; | |
| animation-delay: .2s; | |
| } | |
| .ring-7 { | |
| --r: 50%; | |
| } | |
| @keyframes dash { | |
| 0% { | |
| stroke-dasharray: 0, calc(2 * var(--pi) * var(--r)); | |
| stroke-dashoffset: 0; | |
| } | |
| 50% { | |
| stroke-dasharray: calc(2 * var(--pi) * var(--r)); | |
| stroke-dashoffset: 0; | |
| } | |
| 100% { | |
| stroke-dasharray: calc(2 * var(--pi) * var(--r)); | |
| stroke-dashoffset: calc(-2 * var(--pi) * var(--r)); | |
| } | |
| } | |
| </style> | |
| </head> | |
| <body> | |
| <div class="item loading"> | |
| <svg class="rings" viewBox="0 0 100 100"> | |
| <svg class="ring ring-0" > | |
| <circle cx="50%" cy="50%" r="1%"></circle> | |
| </svg> | |
| <svg class="ring ring-1" > | |
| <circle cx="50%" cy="50%" r="8%"></circle> | |
| </svg> | |
| <svg class="ring ring-2" > | |
| <circle cx="50%" cy="50%" r="15%"></circle> | |
| </svg> | |
| <svg class="ring ring-3" > | |
| <circle cx="50%" cy="50%" r="22%"></circle> | |
| </svg> | |
| <svg class="ring ring-4" > | |
| <circle cx="50%" cy="50%" r="29%"></circle> | |
| </svg> | |
| <svg class="ring ring-5"> | |
| <circle cx="50%" cy="50%" r="36%"></circle> | |
| </svg> | |
| <svg class="ring ring-6"> | |
| <circle cx="50%" cy="50%" r="43%"></circle> | |
| </svg> | |
| <svg class="ring ring-7"> | |
| <circle cx="50%" cy="50%" r="50%"></circle> | |
| </svg> | |
| </svg> | |
| </div> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment