Skip to content

Instantly share code, notes, and snippets.

@biwac-nico
Created November 9, 2021 00:16
Show Gist options
  • Save biwac-nico/dd0c869946ddb902d839ade26f6eb6d6 to your computer and use it in GitHub Desktop.
Save biwac-nico/dd0c869946ddb902d839ade26f6eb6d6 to your computer and use it in GitHub Desktop.
SVG circle border animation
<svg height="200" width="200">
<circle class="circle" cx="100" cy="100" r="95" stroke="#231f20" stroke-width="10" fill-opacity="0" />
</svg>
<div class="logo"></div>
body {
height: 100vh;
position: relative;
background-color: #f5f5f5;
}
svg,
.logo {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%,-50%);
}
.logo {
width: 140px;
height: 140px;
background-color: #231f20;
border-radius: 100px;
opacity: 0;
animation: fadeIn 0.75s linear forwards;
animation-delay: 1s;
}
.circle {
stroke-dasharray: 1000;
stroke-dashoffset: 1000;
animation: stroke 2s ease-out forwards;
}
@keyframes stroke {
to {
stroke-dashoffset: 0;
}
}
@keyframes fadeIn {
to {
opacity: 1;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment