Home  >  Article  >  Web Front-end  >  ProgressBar.js – Beautiful responsive SVG progress bar

ProgressBar.js – Beautiful responsive SVG progress bar

高洛峰
高洛峰Original
2016-12-16 16:35:351599browse

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 = '';
 
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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn