SVG PIE Chart with CSS animation
How do I make an svg pie chart with css animation?
Pie percentage made by stroke-dasharray. stroke-dasharray format is below. keyframe 100% : 0 offset this-percentage rest. What is a svg pie chart with css animation? How do you make a svg pie chart with css animation? This script and codes were developed by Keisuke Takahashi on 19 November 2022, Saturday.
SVG PIE Chart with CSS animation - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>SVG PIE Chart with CSS animation</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <figure> <figcaption>SVG PIE Chart with CSS animation</figcaption> <svg viewBox="0 0 63.6619772368 63.6619772368"> <circle class="pie1" cx="31.8309886184" cy="31.8309886184" r="15.9154943092"/> <circle class="pie2" cx="31.8309886184" cy="31.8309886184" r="15.9154943092"/> <circle class="pie3" cx="31.8309886184" cy="31.8309886184" r="15.9154943092"/> <circle class="pie4" cx="31.8309886184" cy="31.8309886184" r="15.9154943092"/> </svg>
</figure>
</body>
</html>
SVG PIE Chart with CSS animation - Script Codes CSS Codes
figure { background-color: #eee; display: block; height: 0; margin: 0 auto; position: relative; font-size:16px; font-size:1vw; width: 40em; padding-bottom: 40em;
}
figcaption { font-size:1rem; text-align:center; color:#fff; width: 100%; position: absolute; left: 0; top:40%; z-index:2;
}
svg { display: block; height: 100%; width: 100%; position: absolute; top: 0; left: 0; overflow: visible;
}
circle { fill:rgba(0,0,0,0); stroke-width:31.8309886184; stroke-dasharray: 0,0,0,100; stroke-dashoffset: 25; -webkit-animation: pie1 3s infinite ease both; animation: pie1 6s infinite ease both;
}
.pie1 { stroke:hsl(180,70%,30%);
}
.pie2 { stroke:hsl(180,70%,50%); -webkit-animation-name: pie2; animation-name: pie2;
}
.pie3 { stroke:hsl(180,70%,20%); -webkit-animation-name: pie3; animation-name: pie3;
}
.pie4 { stroke:hsl(180,0%,70%); -webkit-animation-name: pie4; animation-name: pie4;
}
/* pie percentage made by stroke-dasharray. stroke-dasharray format is... keyframe 100% : 0 offset this-percentage rest I added keyframe 50% for infinite presentation.
*/
/* 1st pie is 40% */
@-webkit-keyframes pie1 { 50%,100% {stroke-dasharray: 40,60,0,0;}
}
@keyframes pie1 { 50%,100% {stroke-dasharray: 40,60,0,0;}
}
/* 2nd pie is 30% */
@-webkit-keyframes pie2 { 50%,100% {stroke-dasharray: 0,40,30,30;}
}
@keyframes pie2 { 50%,100% {stroke-dasharray: 0,40,30,30;}
}
/* 3rd pie is 30% */
@-webkit-keyframes pie3 { 50%,100% {stroke-dasharray: 0,70,20,10;}
}
@keyframes pie3 { 50%,100% {stroke-dasharray: 0,70,20,10;}
}
/* 4th pie is 10% */
@-webkit-keyframes pie4 { 50%,100% {stroke-dasharray: 0,90,10,0;}
}
@keyframes pie4 { 50%,100% {stroke-dasharray: 0,90,10,0;}
}
Developer | Keisuke Takahashi |
Username | ksksoft |
Uploaded | November 19, 2022 |
Rating | 4 |
Size | 2,107 Kb |
Views | 30,360 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
TEMARI Sphere | 2,369 Kb |
Pure css Dialogue UI | 2,457 Kb |
Pure css thumbnails hover 2 | 1,940 Kb |
One div DORAEMON | 2,448 Kb |
One Element Girl | 2,768 Kb |
Box-shadow hexagon mask | 2,196 Kb |
Gooey text melt away... | 2,420 Kb |
Pure css thumbnails hover | 1,773 Kb |
Pure CSS drower menu with transition-delay | 1,898 Kb |
The mount | 3,444 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Box Shadow Effects | Retrofuturistic | 2,143 Kb |
Css3 slide | Nakome | 3,190 Kb |
Starting out with Ember.JS | Cfleschhut | 4,808 Kb |
Caputre Cam with JS | KimmoCommit | 2,795 Kb |
SVG Animation | Pollardld | 3,133 Kb |
Vue.js Lazy Loading | Kjbrum | 3,620 Kb |
Portfolio Layout Flex | Lahvjal | 3,489 Kb |
Playing with FlexBox | _Billy_Brown | 3,162 Kb |
Drifting Clouds | Benedikte | 2,247 Kb |
Random Gradients - JS | Aldlevine | 2,026 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!