ProgressBar.js – 漂亮的响应式 SVG 进度条

ProgressBar.js 是一个借助动态 SVG 路径的漂亮的,响应式的进度条效果。使用 ProgressBar.js 可以很容易地创建任意形状的进度条。这个 JavaScript 库提供线条,圆形和方形等几个内置的形状,但你可使用 Illustrator 或任何其它的矢量图形编辑器创建自己的进度条效果。

 

 

在线演示      插件下载

 

线条进度条:

1
2
3
4
5
var  line = new  ProgressBar.Line( '#example-line-container' , {
     color: '#FCB03C'
});
 
line.animate(1);

圆形进度条:

1
2
3
4
5
6
7
8
9
var  circle = new  ProgressBar.Circle( '#example-circle-container' , {
     color: '#FCB03C' ,
     strokeWidth: 2,
     fill: '#aaa'
});
 
circle.animate(1, function () {
     circle.animate(0);
})

自定义形状和路径:

1
2
3
4
5
6
7
8
9
10
11
12
13
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);
     });
});

转载于:https://www.cnblogs.com/sunshinelaila/p/4119367.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值