【发布时间】:2018-02-12 07:57:25
【问题描述】:
我正在使用progressbar.js 插件,它可以帮助我使用svg 创建漂亮的进度条。这是小提琴:
https://jsfiddle.net/vaxobasilidze/xqge4cew/1/
在#container1 中,我使用十六进制颜色来设置svg 的样式,但在#container 中,我需要使用渐变设置样式。如您所见,它不起作用。有没有办法使用渐变来设置 svg 样式?
// progressbar.js@1.0.0 version is used
// Docs: http://progressbarjs.readthedocs.org/en/1.0.0/
var bar = new ProgressBar.SemiCircle(container, {
strokeWidth: 6,
easing: 'easeInOut',
duration: 1400,
color: 'linear-gradient(to bottom, #1e5799 0%,#2989d8 50%,#7db9e8 100%)',
trailColor: '#eee',
trailWidth: 1,
svgStyle: null
});
bar.animate(1.0); // Number from 0.0 to 1.0
var bar1 = new ProgressBar.SemiCircle(container1, {
strokeWidth: 6,
easing: 'easeInOut',
duration: 1400,
color: '#eee',
trailColor: '#eee',
trailWidth: 1,
svgStyle: null
});
bar1.animate(1.0);
#container {
margin: 20px;
width: 200px;
height: 100px;
}
#container1 {
margin: 20px;
width: 200px;
height: 100px;
}
<script src="https://rawgit.com/kimmobrunfeldt/progressbar.js/1.0.0/dist/progressbar.js"></script>
<div id="container"></div>
<div id="container1"></div>
【问题讨论】:
标签: javascript html css svg progress-bar