【问题标题】:jQuery: How to make Progress Bar animate from one to another colorjQuery:如何使进度条从一种颜色变为另一种颜色
【发布时间】:2018-11-17 09:12:10
【问题描述】:

我喜欢改变 barColor 以在开始和结束时使用不同的颜色。

var EasyPieChart = function(el, opts) {
    var defaultOptions = {
        barColor: '#FFEA82',
        trackColor: '#e1e1e3',
        scaleColor: '#e1e1e3',
        scaleLength: 0,
        lineCap: 'round',
        lineWidth: 15,
        size: 152,
        rotate: 0,
        animate: 1000,
        easing: function (x, t, b, c, d) {

我尝试了类似的方法,但没有成功。

from: {barColor: '#FFEA82', a:0},
to: {barColor: '#ED6A5A', a:1},

我需要这样的东西

【问题讨论】:

  • 尝试类似:如果进度 > 25%:更新颜色等。

标签: javascript jquery charts jquery-animate progress-bar


【解决方案1】:

这可行,并且在他们的 GitHub 页面 https://rendro.github.io/easy-pie-chart/ 中也提到过 - “您还可以传递一个接受当前百分比作为值的函数以返回动态生成的颜色”

barColor: function(percent){
		  if(percent<=60)
			return "#ffe500";
		  else
			return "#ff7f50";
		 },
trackColor: '#e1e1e3',

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2012-02-18
    • 1970-01-01
    • 1970-01-01
    • 2019-01-29
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-08-15
    相关资源
    最近更新 更多