DmitryBaranovskiy / raphael

JavaScript Vector Library
https://dmitrybaranovskiy.github.io/raphael/
MIT License
11.27k stars 1.67k forks source link

Animated Paper.customAttributes with object-parameter #655

Open swiftyone opened 11 years ago

swiftyone commented 11 years ago

You can use Paper.customAttributes and pass an object as parameter:

paper.customAttributes.hue = function (object) {
   console.log(object);
   return {fill: "hsb(" + (object.hue%1)  + ", 0.75, 1)"};
};

var c = paper.circle(10, 10, 10).attr({hue: [{hue: .45}]});

But any animation of the custom attribute fails, as the attribute function is invoked without the object. (Logs either NaN or undefined).

mfiedorowicz commented 10 years ago

Same problem here: i try to pass string as a parameter of customAttributes function, but it's NaN while animation runs, Any ideas?