Home >Web Front-end >JS Tutorial >ProgressBar.js – Beautiful responsive SVG progress bar
ProgressBar.js is a beautiful, responsive progress bar effect using dynamic SVG paths. Progress bars of any shape can be easily created using ProgressBar.js. This JavaScript library provides several built-in shapes such as lines, circles, and squares, but you can create your own progress bar effects using Illustrator or any other vector graphics editor.
Line progress bar:
var line = new ProgressBar.Line('#example-line-container', { color: '#FCB03C' }); line.animate(1);
Circular progress bar:
var circle = new ProgressBar.Circle('#example-circle-container', { color: '#FCB03C', strokeWidth: 2, fill: '#aaa' }); circle.animate(1, function() { circle.animate(0); })
Custom shape and path:
var container = document.getElementById('example-custom-container'); container.innerHTML = '<object id="scene" type="image/svg+xml" data="images/moon-scene.svg"></object>'; var scene = document.getElementById('scene'); scene.addEventListener('load', function() { var path = new ProgressBar.Path(scene.contentDocument.querySelector('#asterism-path'), { duration: 1000 }); path.animate(1, function() { path.animate(0); }); });
For more ProgressBar.js – beautiful responsive SVG progress bar related articles please pay attention to PHP Chinese website!