mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-01-01 02:38:43 -05:00
Created an SVGRect.html to test exporting and modified SVGCircles.html for
easier testing.
This commit is contained in:
parent
2750b07189
commit
6c1c6bc2d5
5 changed files with 58 additions and 7 deletions
BIN
examples/Tools/.SVGCircles.html.swp
Normal file
BIN
examples/Tools/.SVGCircles.html.swp
Normal file
Binary file not shown.
BIN
examples/Tools/.SVGRect.html.swp
Normal file
BIN
examples/Tools/.SVGRect.html.swp
Normal file
Binary file not shown.
|
@ -2,7 +2,7 @@
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||||
<title>Circles</title>
|
<title>SVGCircles</title>
|
||||||
<link rel="stylesheet" href="../css/style.css">
|
<link rel="stylesheet" href="../css/style.css">
|
||||||
<script type="text/javascript" src="../../dist/paper.js"></script>
|
<script type="text/javascript" src="../../dist/paper.js"></script>
|
||||||
<script type="text/javascript" src="../../src/svg/ExportSVG.js"></script>
|
<script type="text/javascript" src="../../src/svg/ExportSVG.js"></script>
|
||||||
|
@ -15,15 +15,34 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
var path;
|
var path;
|
||||||
function onMouseDrag(event) {
|
function onMouseDown(event)
|
||||||
// The radius is the distance between the position
|
{
|
||||||
// where the user clicked and the current position
|
var radius = 100;
|
||||||
// of the mouse.
|
path = new Path.Circle(event.point, radius);
|
||||||
var radius = (event.downPoint - event.point).length;
|
path.selected = true;
|
||||||
path = new Path.Circle(event.downPoint, radius);
|
|
||||||
var svg = new ExportSVG();
|
var svg = new ExportSVG();
|
||||||
var svgout = svg.exportPath(path);
|
var svgout = svg.exportPath(path);
|
||||||
console.log(svgout);
|
console.log(svgout);
|
||||||
|
|
||||||
|
//making A new circle at a certain point
|
||||||
|
leftPoint = new Point(44,107);
|
||||||
|
|
||||||
|
var leftToTopHandle = new Point(0,55.22847);
|
||||||
|
var leftToTopHandle2 = new Point(0, -55.228);
|
||||||
|
|
||||||
|
rightPoint = new Point(244,107);
|
||||||
|
|
||||||
|
bottomPoint = new Point(144,207);
|
||||||
|
|
||||||
|
topPoint = new Point(144,7);
|
||||||
|
|
||||||
|
path2 = new Path(leftPoint);
|
||||||
|
path2.arcTo(topPoint, true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
path.removeOnDrag();
|
path.removeOnDrag();
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
32
examples/Tools/SVGRect.html
Normal file
32
examples/Tools/SVGRect.html
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
<!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>
|
BIN
src/path/.Path.Constructors.js.swp
Normal file
BIN
src/path/.Path.Constructors.js.swp
Normal file
Binary file not shown.
Loading…
Reference in a new issue