mirror of
https://github.com/scratchfoundation/paper.js.git
synced 2025-08-13 14:38:49 -04:00
Implement Path#toShape(), Segment#isColinear(), Segment#isOrthogonal() and Segment#isArc().
This commit is contained in:
parent
0129080a08
commit
c4c7a37993
4 changed files with 180 additions and 2 deletions
examples/Scripts
55
examples/Scripts/Shapes.html
Normal file
55
examples/Scripts/Shapes.html
Normal 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>
|
Loading…
Add table
Add a link
Reference in a new issue