progressbar.js 是一个借助动态 svg 路径的漂亮的,响应式的进度条效果。使用 progressbar.js 可以很容易地创建任意形状的进度条。这个 javascript 库提供线条,圆形和方形等几个内置的形状,但你可使用 illustrator 或任何其它的矢量图形编辑器创建自己的进度条效果。
线条进度条:
var line = new ProgressBar.Line('#example-line-container', {
color: '#FCB03C'
});
line.animate(1);圆形进度条:
var circle = new ProgressBar.Circle('#example-circle-container', {
color: '#FCB03C',
strokeWidth: 2,
fill: '#aaa'
});
circle.animate(1, function() {
circle.animate(0);
})自定义形状和路径:
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);
});
});更多ProgressBar.js – 漂亮的响应式 SVG 进度条相关文章请关注PHP中文网!
每个人都需要一台速度更快、更稳定的 PC。随着时间的推移,垃圾文件、旧注册表数据和不必要的后台进程会占用资源并降低性能。幸运的是,许多工具可以让 Windows 保持平稳运行。
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号