Implement Path#toShape(), Segment#isColinear(), Segment#isOrthogonal() and Segment#isArc().

This commit is contained in:
Jürg Lehni 2013-10-16 23:10:03 +02:00
parent 0129080a08
commit c4c7a37993
4 changed files with 180 additions and 2 deletions
examples/Scripts

View file

@ -0,0 +1,55 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Resize</title>
<link rel="stylesheet" href="../css/style.css">
<script type="text/javascript" src="../../dist/paper.js"></script>
<script type="text/paperscript" canvas="canvas">
var path = new Path.Circle({
center: [100, 100],
radius: 50,
fillColor: 'red'
});
var shape = path.toShape();
shape.position += [200, 0];
var path = new Path.Ellipse({
center: [100, 200],
radius: [50, 25],
fillColor: 'blue',
strokeColor: 'black',
strokeWidth: 10
});
path.rotate(20);
var shape = path.toShape();
shape.position += [200, 0];
var path = new Path.Rectangle({
center: [100, 300],
size: [100, 50],
fillColor: 'green',
strokeColor: 'black',
strokeWidth: 10
});
path.rotate(-20);
var shape = path.toShape();
shape.position += [200, 0];
var path = new Path.Rectangle({
center: [100, 400],
size: [50, 100],
radius: [5, 10],
fillColor: 'orange',
strokeColor: 'black',
strokeWidth: 10
});
path.rotate(20);
var shape = path.toShape();
shape.position += [200, 0];
</script>
</head>
<body>
<canvas id="canvas" resize></canvas>
</body>
</html>