Skip to content

Instantly share code, notes, and snippets.

@candelatech
Last active August 25, 2020 16:07
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save candelatech/4a663db3af4d43ebbe6fded00d290f08 to your computer and use it in GitHub Desktop.
Save candelatech/4a663db3af4d43ebbe6fded00d290f08 to your computer and use it in GitHub Desktop.
<!-- this should be on codepen... lets do that instead -->
<svg>
</svg>
<style>
#test svg #anim * {
transition: stroke-dashoffset 1s ease;
stroke-dashoffset: 0!important;
}
</style>
<script>
$("#test svg #anim path").each(function(index, line){
pathPrepare(line)
})
setTimeout(function(){
$("#test").addClass("active")
},100)
//for prepping SVGs for animation
function pathPrepare (e) {
var lineLength = e.getTotalLength();
$(e).css("stroke-dasharray", lineLength);
$(e).css("stroke-dashoffset", lineLength);
}
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment