paper.js/examples/Tools/SVGRect.html

32 lines
757 B
HTML

<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>SVGRect</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper.js"></script>
<script type="text/javascript" src="../../src/svg/ExportSVG.js"></script>
<script type="text/paperscript" canvas="canvas">
project.currentStyle =
{
fillColor: 'white',
strokeColor: 'black'
};
var path;
function onMouseDown(event)
{
var size = new Size(100,100);
path = new Path.Rectangle(event.point,size);
var svg = new ExportSVG();
var svgout = svg.exportPath(path);
console.log(svgout);
};
</script>
</head>
<body>
<canvas id="canvas" resize></canvas>
</body>
</html>