Skip to content

Instantly share code, notes, and snippets.

@daryledesilva
Created June 25, 2013 11:21
Show Gist options
  • Select an option

  • Save daryledesilva/5857737 to your computer and use it in GitHub Desktop.

Select an option

Save daryledesilva/5857737 to your computer and use it in GitHub Desktop.
A CodePen by daryledesilva. test - for tin :P
Tshirt's text: <input type="text" id="input_text"> <input type="button" onclick="loadText()" value="load text"><br/>
<svg width="640" height="480" xmlns="http://www.w3.org/2000/svg">
<!-- Created with SVG-edit - http://svg-edit.googlecode.com/ -->
<g>
<title>Layer 1</title>
<path d="m240,121c0,1 0,2 1,4c1,2 1.87766,4.06601 3,6c1.80972,3.11848 3.513,4.59399 5,7c1.66251,2.68999 1.82375,5.48625 4,6c1.9465,0.4595 6.06134,1.82462 12,4c5.05658,1.85226 8,2 12,3c4,1 7,1 10,1c3,0 6,0 9,0c3,0 5.22836,1.14806 8,0c2.61313,-1.0824 4.50424,-2.03552 9,-5c2.3613,-1.55702 3.57111,-3.67947 8,-6c2.80109,-1.46764 4.72961,-3.22885 9,-8c0.94318,-1.05377 1.61731,-3.07613 2,-4c0.5412,-1.30656 1.29291,-2.29289 2,-3c0.70709,-0.70711 0,-2 1,-2c1,0 2.07611,-0.38268 3,0c1.30655,0.5412 2,1 3,1c2,0 3,0 4,0c1,0 2.29291,0.29289 3,1c0.70709,0.70711 2.07611,-0.38268 3,0c1.30655,0.5412 2,1 3,1c2,0 4,0 5,0c1,0 1.82376,0.48626 4,1c1.9465,0.4595 3,0 4,0c2,0 3,0 4,0c1,0 3,0 4,0c1,0 1.29291,0.29289 2,1c0.70709,0.70711 0.61731,2.07613 1,3c1.0824,2.61313 2.69254,3.186 4,5c1.65381,2.29454 2.79489,4.22021 6,7c3.77728,3.27602 7,6 9,8c2,2 5,4 7,6c2,2 2.76395,4.76393 5,7c2.23605,2.23607 3.90634,3.10341 5,4c2.78833,2.28587 5.32367,3.52016 7,5c2.703,2.38617 4.31,4.33749 7,6c2.40601,1.487 4.07843,4.78986 7,6c2.06586,0.85571 3,3 4,3c1,0 1.29291,0.29289 2,1c0.70709,0.70711 1.69345,1.4588 3,2c0.92389,0.38269 2,1 3,2c2,2 4.22977,2.02675 4,3c-0.51373,2.17625 -3.41885,1.41885 -5,3c-1.58115,1.58115 -3.41885,3.41885 -5,5c-1.58115,1.58115 -4.70547,3.34619 -7,5c-1.814,1.30745 -4.20682,3.81265 -6,6c-2.28589,2.78833 -4,5 -6,7c-1,1 -2.69345,2.4588 -4,3c-0.92389,0.38269 -2,1 -4,3c-1,1 -1.82376,2.48625 -4,3c-0.97324,0.22975 -1.29291,1.29289 -2,2c-0.70709,0.70711 -2,0 -3,0c-1,0 -2.0535,0.4595 -4,0c-2.17624,-0.51375 -3.59399,-2.513 -6,-4c-2.69,-1.66251 -5.2565,-2.797 -6,-4c-1.66251,-2.68999 -1.94855,-3.29869 -3,-5c-1.17557,-1.90211 -2.0979,-2.82443 -4,-4c-0.85065,-0.52573 -2.07611,-0.61731 -3,-1c-1.30655,-0.5412 -2.69345,-2.4588 -4,-3c-0.92389,-0.38269 -1.69254,0.186 -3,2c-0.8269,1.14726 -0.51944,4.03874 -1,7c-0.50653,3.12144 -2,7 -3,11c-1,4 -1.3804,9.90326 -4,21c-1.17151,4.96262 -2.24356,11.07217 -3,15c-1.01837,5.28799 -3.1604,8.96329 -4,13c-1.23862,5.95532 -1.49622,9.90778 -2,14c-0.48874,3.97003 0.4595,6.0535 0,8c-0.51373,2.17624 -1,7 -1,10c0,3 0,8 0,11c0,2 0,5 0,6c0,2 0,3 0,5c0,2 0,5 0,8c0,2 0,5 0,7c0,2 -0.4595,4.0535 0,6c0.51373,2.17624 2,3 2,5c0,1 -1,1 -2,1c-1,0 -3,0 -5,0c-1,0 -4,0 -7,0c-3,0 -12,0 -17,0c-4,0 -9.01703,-0.41241 -14,0c-6.06204,0.50171 -11,1 -21,1c-6,0 -10,0 -15,0c-5,0 -9,0 -13,0c-4,0 -9,0 -12,0c-4,0 -7.90779,0.49622 -12,1c-4.96254,0.61093 -9,1 -13,1c-3,0 -8.08025,0.31073 -11,1c-2.17625,0.51373 -5.4305,0.867 -4,-3c0.7758,-2.09717 2.14897,-4.94696 6,-16c2.08087,-5.97244 4.99658,-12.87592 6,-25c0.57736,-6.97614 2.49873,-11.94672 3,-19c0.42534,-5.98489 2.18565,-12.9581 3,-17c2.59779,-12.89386 4.09544,-18.97736 5,-23c1.11867,-4.97479 1.49623,-7.90778 2,-12c0.48874,-3.97003 0.83981,-6.01291 1,-7c0.50655,-3.12144 1,-5 1,-6c0,-2 -1,-2 -2,-2c-1,0 -2.797,0.2565 -4,1c-2.68999,1.66251 -6.797,4.2565 -8,5c-2.68999,1.66251 -4.88152,3.19028 -8,5c-3.868,2.24469 -5.59399,4.513 -8,6c-2.68999,1.66251 -4.02675,2.77023 -5,3c-2.17625,0.51373 -3,3 -4,4c-2,2 -3,2 -4,3c-1,1 -2.61731,3.07611 -3,4c-0.5412,1.30655 -4,3 -3,3c1,0 0.4595,-2.0535 0,-4c-3.08246,-13.05751 -10.75378,-16.08521 -17,-22c-4.64935,-4.40266 -6.94736,-11.62 -17,-17c-2.7881,-1.49214 -5.07613,-2.61731 -6,-3c-1.30656,-0.5412 -1.77025,-1.02675 -2,-2c-0.51375,-2.17625 4.88152,-2.19028 8,-4c7.73599,-4.48936 14.51665,-8.21559 27,-17c5.23656,-3.68491 6.87744,-9.15085 13,-14c1.75288,-1.38831 6.9176,-8.38687 8,-11c0.76537,-1.84776 2.77025,-10.02675 3,-11c1.02748,-4.35251 1.69255,-6.186 3,-8c1.65381,-2.29454 1.42043,-3.08582 2,-5c1.04483,-3.45085 2.48625,-4.82375 3,-7c0.4595,-1.9465 1.83981,-4.01291 2,-5c0.50655,-3.12144 2.1731,-4.85274 3,-6c1.30745,-1.814 1.1731,-2.85274 2,-4c1.30745,-1.814 1.09789,-3.82443 3,-5c0.85065,-0.52573 1.38687,-0.91761 4,-2c1.84776,-0.76537 4.186,0.30745 6,-1c1.14726,-0.8269 2.15224,-0.23463 4,-1c1.30656,-0.5412 2,-1 3,-2l1,0" id="tshirt"/>
<ellipse ry="34" rx="59" id="tshirt_logo" cy="202" cx="302"/>
<text xml:space="preserve" text-anchor="middle" font-family="serif" font-size="24" id="tshirt_text" y="206" x="301" >TIN</text>
</g>
</svg>
function loadText(){
var input_text = document.getElementById('input_text').value;
svgText = document.getElementById("tshirt_text").firstChild;
svgText.nodeValue = input_text;
}
#tshirt{
fill: red;
stroke-width:2;
stroke:#000000;
}
#tshirt_logo{
stroke-linecap:null;
stroke-linejoin:null;
stroke-dasharray:null;
stroke-width:1;
stroke:gray;
fill:white;
}
#tshirt_text{
stroke-linecap:null;
stroke-linejoin:null;
stroke-dasharray:null;
stroke-width:0;
stroke:#000000;
fill:#000000;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment