mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2024-12-29 09:22:22 -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>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
|
||||
<title>Circles</title>
|
||||
<title>SVGCircles</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>
|
||||
|
@ -15,15 +15,34 @@
|
|||
};
|
||||
|
||||
var path;
|
||||
function onMouseDrag(event) {
|
||||
// The radius is the distance between the position
|
||||
// where the user clicked and the current position
|
||||
// of the mouse.
|
||||
var radius = (event.downPoint - event.point).length;
|
||||
path = new Path.Circle(event.downPoint, radius);
|
||||
function onMouseDown(event)
|
||||
{
|
||||
var radius = 100;
|
||||
path = new Path.Circle(event.point, radius);
|
||||
path.selected = true;
|
||||
var svg = new ExportSVG();
|
||||
var svgout = svg.exportPath(path);
|
||||
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();
|
||||
|
||||
};
|
||||
|
|
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