【问题标题】:.animate step TypeError: object is not a function.animate step TypeError:对象不是函数
【发布时间】:2013-10-06 18:39:18
【问题描述】:

我正在使用 raphael.js 构建一些 svg 动画。我正在尝试构建一个饼图。我通过 .animate() 方法在 step 选项中调用一个函数。

我得到的错误:Uncaught TypeError: object is not a function 这是哪一行:pie_fill.attrs({'path': arc(1, 2, 3, 4)});

它甚至根本不将 arc() 理解为 step 选项中的函数。但是我不知道为什么,请帮忙。

var R = Raphael("paper");
pie_fill = R.path(("M 150 77 L77 77 Z")).attr({'fill':'#009bca', 'stroke':'#1c1c1c', 'stroke-opacity':'1', 'stroke-width':'1'});

var pie = new Raphael($('#paper'), 300, 154);
    $('#paper').animate({
            'margin': '0'
        }, {
            'duration': 1500,
            step: function( now, fx ) {
                pie_fill.attr({'path': arc(1, 2, 3, 4)});
            }
        });

    arc =function(center, radius, startAngle, endAngle) {
        console.log('ran')
    };

【问题讨论】:

    标签: javascript jquery svg


    【解决方案1】:

    arc 是在调用它之后定义的。

    如果你写 function arc(...) 而不是 arc = function(...) 它应该可以工作。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-10-28
      • 1970-01-01
      • 2019-09-19
      • 1970-01-01
      • 1970-01-01
      • 2013-06-14
      相关资源
      最近更新 更多