Created
December 14, 2013 08:01
-
-
Save gcchaan/7956686 to your computer and use it in GitHub Desktop.
when you input a path of SVG ,'Online SVG path Viewer' rend the vector the path code quickly!
This file contains 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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8" /> | |
<title>SVGプレビュワー</title> | |
<script src="jquery-2.0.3.min.js"></script> | |
<script> | |
$(function(){ | |
$('textarea').bind('keypress blur change',function(){ | |
$('path').attr("d",$(this).val()); | |
getSvgBBox(); | |
var vectorsize = bbox.x+" "+bbox.y+" "+bbox.width+" "+bbox.height; | |
$('svg')[0].setAttribute("viewBox",vectorsize); | |
}); | |
}); | |
function getSvgBBox(){ | |
var svgElement = document.getElementById('bbox'); | |
bbox = svgElement.getBBox(); | |
} | |
</script> | |
</head> | |
<body> | |
<header><h1>SVGプレビュワー</h1></header> | |
<article> | |
<form> | |
<p>ベクターのpathを入力してください</p> | |
<textarea></textarea> | |
</form> | |
<svg width="300" height="300"> | |
<path id="bbox" stroke="#555" fill="#FFF" d /> | |
</svg> | |
</article> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment