Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@gcchaan
Created December 14, 2013 08:01
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 gcchaan/7956686 to your computer and use it in GitHub Desktop.
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!
<!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