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

ProgressBar.js – Beautiful responsive SVG progress bar

高洛峰
Release: 2016-12-16 16:35:35
Original
1754 people have browsed it

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);
Copy after login

Circular progress bar:

var circle = new ProgressBar.Circle('#example-circle-container', {
    color: '#FCB03C',
    strokeWidth: 2,
    fill: '#aaa'
});
 
circle.animate(1, function() {
    circle.animate(0);
})
Copy after login

Custom shape and path:

var container = document.getElementById('example-custom-container');
container.innerHTML = &#39;<object id="scene" type="image/svg+xml" data="images/moon-scene.svg"></object>&#39;;
 
var scene = document.getElementById(&#39;scene&#39;);
scene.addEventListener(&#39;load&#39;, function() {
    var path = new ProgressBar.Path(scene.contentDocument.querySelector(&#39;#asterism-path&#39;), {
        duration: 1000
    });
 
    path.animate(1, function() {
        path.animate(0);
    });
});
Copy after login



For more ProgressBar.js – beautiful responsive SVG progress bar related articles please pay attention to PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template