SVG Animation - Circle Fill

Developer
Size
3,322 Kb
Views
46,552

How do I make an svg animation - circle fill?

Click the buttons to fill/un-fill the circular path. What is a svg animation - circle fill? How do you make a svg animation - circle fill? This script and codes were developed by Adam Grayson on 10 November 2022, Thursday.

SVG Animation - Circle Fill Previews

SVG Animation - Circle Fill - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>SVG Animation - Circle Fill</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="circle"> <svg class="circleFill"> <circle cx="43" cy="43" r="39" stroke="#888888" stroke-width="6" fill="none"></circle> </svg> <svg class="circleTrack"> <circle cx="43" cy="43" r="39" stroke="#cccccc" stroke-width="6" fill="none"></circle> </svg>
</div>
<div class="fillBtn">Fill</div>
<div class="unfillBtn">Unfill</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

SVG Animation - Circle Fill - Script Codes CSS Codes

html, body { font-family: "Helvetica", helvetica, sans-serif;
}
.circle { position: relative; width: 85px; height: 85px; margin: 20px auto;
}
.circle svg { position: absolute; width: 100%; height: 100%;
}
.circle svg.circleFill { z-index: 1; stroke-dasharray: 322; stroke-dashoffset: 322; -webkit-transition: all 3s; transition: all 3s; -webkit-transform: rotate(-90deg); transform: rotate(-90deg);
}
.circle svg.circleFill.filled { stroke-dashoffset: 38.5;
}
.circle svg.circleTrack { z-index: 0;
}
.fillBtn,
.unfillBtn { width: 150px; padding: 10px 0; margin: 20px auto; text-align: center; background: #cccccc; color: #888888; border-radius: 4px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none;
}
.fillBtn:hover,
.unfillBtn:hover { color: #ffffff; cursor: pointer;
}

SVG Animation - Circle Fill - Script Codes JS Codes

(function() { $(document).ready(function() { var animPolice, animTime; animTime = 3000; animPolice = false; $('.fillBtn').click(function() { if (animPolice) { return; } animPolice = true; $(".circleFill").attr("class", "circleFill filled"); return setTimeout(function() { return animPolice = false; }, animTime); }); return $('.unfillBtn').click(function() { if (animPolice) { return; } animPolice = true; $(".circleFill").attr("class", "circleFill"); return setTimeout(function() { return animPolice = false; }, animTime); }); });
}).call(this);
SVG Animation - Circle Fill - Script Codes
SVG Animation - Circle Fill - Script Codes
Home Page Home
Developer Adam Grayson
Username agrayson
Uploaded November 10, 2022
Rating 4.5
Size 3,322 Kb
Views 46,552
Do you need developer help for SVG Animation - Circle Fill?

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!

Adam Grayson (agrayson) Script Codes
Create amazing blog posts with AI!

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!