Skip to content

Commit

Permalink
Check for attribute first to prevent SVG attributes being interpreted…
Browse files Browse the repository at this point in the history
… as transforms #314 + timeline tweaks
  • Loading branch information
juliangarnier committed Jan 20, 2018
1 parent 1c18b1f commit 660974d
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 33 deletions.
7 changes: 4 additions & 3 deletions anime.js
Original file line number Diff line number Diff line change
Expand Up @@ -438,8 +438,8 @@
}

function getAnimationType(el, prop) {
if (is.dom(el) && arrayContains(validTransforms, prop)) return 'transform';
if (is.dom(el) && (getAttribute(el, prop) || (is.svg(el) && el[prop]))) return 'attribute';
if (is.dom(el) && arrayContains(validTransforms, prop)) return 'transform';
if (is.dom(el) && (prop !== 'transform' && getCSSValue(el, prop))) return 'css';
if (el[prop] != null) return 'object';
}
Expand Down Expand Up @@ -1063,6 +1063,7 @@
tl.pause();
tl.duration = 0;
tl.add = function(instanceParams, timelineOffset) {
const currentTime = tl.currentTime;
function passThrough(ins) { ins.began = true; ins.completed = true; };
tl.children.forEach(passThrough);
let insParams = mergeObjects(instanceParams, replaceObjectProps(defaultTweenSettings, params));
Expand All @@ -1079,9 +1080,9 @@
if (is.fnc(tl.delay)) tl.delay = ins.delay;
if (is.fnc(tlDuration) || totalDuration > tlDuration) tl.duration = totalDuration;
tl.children.push(ins);
tl.seek(0);
tl.reset();
if (tl.autoplay) tl.restart();
tl.seek(currentTime);
if (tl.autoplay) tl.play();
return tl;
}
return tl;
Expand Down
Loading

0 comments on commit 660974d

Please sign in to comment.