Last active
August 24, 2016 03:07
-
-
Save cjwinchester/9ceb87a9b28285c7709860c02b46e9b5 to your computer and use it in GitHub Desktop.
experimenting with svg path animation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<style> | |
@-moz-keyframes draw { | |
50% { | |
stroke-dashoffset: 0; | |
} | |
} | |
@-webkit-keyframes draw { | |
50% { | |
stroke-dashoffset: 0; | |
} | |
} | |
@keyframes draw { | |
50% { | |
stroke-dashoffset: 0; | |
} | |
} | |
#hookem { | |
animation: draw 5s infinite ease-in-out; | |
stroke: #BF5700; | |
stroke-width: 1; | |
stroke-linejoin: round; | |
stroke-linecap: round; | |
stroke-miterlimit: 10; | |
fill: none; | |
} | |
</style> | |
<?xml version="1.0" encoding="utf-8"?> | |
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd"> | |
<svg version="1.1" id="longhorn-icon" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" | |
width="176px" height="89px" viewBox="0 0 176 89" enable-background="new 0 0 176 89" | |
xml:space="preserve"> | |
<g id="XMLID_1_"> | |
<path id="hookem" d="M174.991,2.329c0.059,0.631-0.138,3.098-2.367,3.039c-4.401-0.118-8.842,0.652-13.162,1.757 | |
c-3.276,1.065-6.414,3.453-9.256,5.643c-6.136,4.756-30.271,18.884-28.948,18.569c-0.099,0.394,0.395,0.434,0.493,0.691 | |
c1.776,0.75,7.874,3.453,8.07,3.531c0.079,0.258,1.736,1.756-0.513,3.849c-2.764,1.815-6.038,3.118-9.591,2.901 | |
c-4.833-0.316-10.872-4.302-10.557-2.625c0,0-0.196,8.703-5.544,15.433c-2.625,3.314-3.81,7.754-3.83,12.194 | |
c-0.019,3.453,1.007,5.762,1.007,5.762c0.06,0.572,1.106,6.314,0.455,8.19c-0.356,1.006-6.138,7.103-7.913,6.886 | |
c-3.316,0.118-7.303,0.276-10.558-0.1l-0.217-0.078c-8.13-6.019-6.788-7.814-6.848-9.984c-0.099-4.383,2.388-7.283,1.954-11.761 | |
c-0.158-3.849-1.736-7.46-3.236-10.657c-2.151-3.63-4.164-7.399-4.913-11.74c-0.415-1.54,0-3.02-0.612-4.46 | |
c-1.243-0.927-5.447,1.915-7.5,2.369c-1.243,1.065-6.058,0.236-8.762-0.553c-1.913-0.769-7.458-2.96-4.577-5.446v-0.178 | |
c2.368-1.558,8.584-3.729,8.584-4.34c-16.3-7.835-36.25-22.358-38.677-23.601C16.948,7.322,8.562,5.091,3.608,5.645 | |
C2.503,5.368,1.103,5.664,0.412,4.46c-2.013-3.986,4.005-4.105,4.005-4.105c1.697-0.217,3.276-0.434,5.25-0.198v0.079 | |
c15.51,0.02,31.317,16.734,50.892,21.667c2.427,0.612,5.17,1.264,7.656,0.06c2.329-0.632,4.52-1.421,6.907-2.131 | |
c0.888-0.256,3.078-0.75,5.604,0.394c2.23,0.02,4.46-0.631,5.447-0.394c1.894,0.73,2.999,0.651,5.091-0.277 | |
c2.21,0.71,5.368,0.454,6.197,0.277c1.774-1.342,5.958,0.612,7.616,0.947c3.038,0.77,5.467,2.486,8.762,1.757 | |
c9.02-2.052,17.444-6.473,25.416-11.446c4.795-2.723,9.867-6.274,15.116-8.604h0.079c3.985-1.598,8.88-2.25,13.479-2.487 | |
C169.348,0.1,173.768,0.139,174.991,2.329z"/> | |
</g> | |
</svg> | |
<script> | |
var path = document.getElementById('hookem'); | |
var len = path.getTotalLength(); | |
path.style.strokeDasharray = len + ' ' + len; | |
path.style.strokeDashoffset = len; | |
</script> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment