javascript - .animate step TypeError: object is not a function -
i building svg animations using raphael.js. trying build pie chart. call function within step option through .animate() method.
the error get: uncaught typeerror: object not function line: pie_fill.attrs({'path': arc(1, 2, 3, 4)});
it doesn't understand arc() function @ within step option. have no idea why, please help.
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') };
arc defined after called.
if write function arc(...)
instead of arc = function(...)
should work.
Comments
Post a Comment