Snap.svg
Snap.svg copied to clipboard
Cannot assing attr fill when hover on element
I'm getting an error when trying to add fill on animate, it works fine with fillOpacity.
TypeError: eq is undefined[Learn More] snap.svg.js:3686:17
elproto.animate
And the code:
seat24.hover(() => { seat24.animate({ fill: "#808080" }, 200, mina.easeinout); }, () => { seat24.animate({ fill: "#FFFFFF" }, 200, mina.easeinout); });
And the error happens here in snap.svg:
elproto.animate = function (attrs, ms, easing, callback) {
if (typeof easing == "function" && !easing.length) {
callback = easing;
easing = mina.linear;
}
if (attrs instanceof Animation) {
callback = attrs.callback;
easing = attrs.easing;
ms = attrs.dur;
attrs = attrs.attr;
}
var fkeys = [], tkeys = [], keys = {}, from, to, f, eq,
el = this;
for (var key in attrs) if (attrs[has](key)) {
if (el.equal) {
eq = el.equal(key, Str(attrs[key]));
from = eq.from;
to = eq.to;
f = eq.f;
} else {
from = +el.attr(key);
to = +attrs[key];
}
var len = is(from, "array") ? from.length : 1;
keys[key] = slice(fkeys.length, fkeys.length + len, f);
fkeys = fkeys.concat(from);
tkeys = tkeys.concat(to);
}
Have you tried it with the dev branch 0.5.2 ?
@ibrierley nope, I will try with that.
@ibrierley that worked! can I use dev 0.5.2 on production?