Skip to content

Instantly share code, notes, and snippets.

@ZAYEC77
Created June 6, 2018 15:50
Show Gist options
  • Save ZAYEC77/67319cd2830b7aa09721b23a64910c45 to your computer and use it in GitHub Desktop.
Save ZAYEC77/67319cd2830b7aa09721b23a64910c45 to your computer and use it in GitHub Desktop.
svg css animation generation
var buff = "";
var perc = 0;
var step = 1;
buff2 = "";
document.getElementById('largeFire').childNodes.forEach(function(item) {
if (item.attributes && item.attributes.d) {
buff += perc + "% {\n";
buff += "\t d: path('" + item.attributes.d.value + "');\n";
buff += "}\n";
perc += step;
buff2tmp = (100-perc) + "% {\n";
buff2tmp += "\t d: path('" + item.attributes.d.value + "');\n";
buff2tmp += "}\n";
buff2 = buff2tmp + buff2;
}
})
console.log(buff + buff2);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment