paper 0.13.0 → 0.15.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/CHANGELOG.md +337 -0
  2. package/README.md +19 -14
  3. package/dist/docs/assets/js/paper.js +7351 -1706
  4. package/dist/docs/classes/AreaText.html +8658 -0
  5. package/dist/docs/classes/ChangeFlag.html +385 -0
  6. package/dist/docs/classes/Color.html +2 -1
  7. package/dist/docs/classes/CompoundPath.html +208 -69
  8. package/dist/docs/classes/Curve.html +2 -1
  9. package/dist/docs/classes/CurveLocation.html +2 -1
  10. package/dist/docs/classes/Event.html +5 -4
  11. package/dist/docs/classes/Gradient.html +2 -1
  12. package/dist/docs/classes/GradientStop.html +2 -1
  13. package/dist/docs/classes/Group.html +204 -17
  14. package/dist/docs/classes/HitResult.html +4 -2
  15. package/dist/docs/classes/HostItem.html +6786 -0
  16. package/dist/docs/classes/Item.html +193 -17
  17. package/dist/docs/classes/Key.html +2 -1
  18. package/dist/docs/classes/KeyEvent.html +5 -4
  19. package/dist/docs/classes/Layer.html +201 -17
  20. package/dist/docs/classes/Matrix.html +2 -1
  21. package/dist/docs/classes/MouseEvent.html +5 -4
  22. package/dist/docs/classes/PaperScope.html +5 -2
  23. package/dist/docs/classes/PaperScript.html +6 -2
  24. package/dist/docs/classes/Path.html +183 -70
  25. package/dist/docs/classes/PathItem.html +326 -187
  26. package/dist/docs/classes/PathText.html +8528 -0
  27. package/dist/docs/classes/Point.html +13 -2
  28. package/dist/docs/classes/PointText.html +1404 -63
  29. package/dist/docs/classes/Project.html +221 -1
  30. package/dist/docs/classes/Raster.html +136 -17
  31. package/dist/docs/classes/Rectangle.html +3 -2
  32. package/dist/docs/classes/Segment.html +2 -1
  33. package/dist/docs/classes/Shape.html +136 -17
  34. package/dist/docs/classes/Size.html +4 -2
  35. package/dist/docs/classes/Style.html +768 -15
  36. package/dist/docs/classes/SymbolDefinition.html +2 -1
  37. package/dist/docs/classes/SymbolItem.html +136 -17
  38. package/dist/docs/classes/TextItem.html +1566 -222
  39. package/dist/docs/classes/TextRange.html +186 -0
  40. package/dist/docs/classes/TextStory.html +355 -0
  41. package/dist/docs/classes/Tool.html +127 -1
  42. package/dist/docs/classes/ToolEvent.html +57 -4
  43. package/dist/docs/classes/Tween.html +17 -1
  44. package/dist/docs/classes/View.html +148 -5
  45. package/dist/docs/classes/global.html +2 -1
  46. package/dist/docs/classes/index.html +2 -2
  47. package/dist/docs/index.html +1 -1
  48. package/dist/paper-core.js +7160 -1663
  49. package/dist/paper-core.min.js +3 -3
  50. package/dist/paper-full.js +7351 -1706
  51. package/dist/paper-full.min.js +3 -3
  52. package/dist/paper-hosted.js +24058 -0
  53. package/dist/paper.d.ts +1996 -155
  54. package/examples/Scripts/AreaText.html +65 -0
  55. package/examples/Scripts/PathText.html +48 -0
  56. package/examples/Scripts/TextRanges.html +51 -0
  57. package/package.json +8 -11
@@ -20,6 +20,7 @@
20
20
  <p>A compound path is a complex path that is made up of one or more simple sub-paths. It can have the <code>nonzero</code> fill rule, or the <code>evenodd</code> rule applied. Both rules use mathematical equations to determine if any region is outside or inside the final shape. The <code>evenodd</code> rule is more predictable: Every other region within a such a compound path is a hole, regardless of path direction.</p>
21
21
  <p>All the paths in a compound path take on the style of the compound path and can be accessed through its <a href="../classes/Item.html#children"><tt>item.children</tt></a> list.</p>
22
22
 
23
+
23
24
  </div>
24
25
 
25
26
  <!-- =============================== constructors ========================== -->
@@ -403,6 +404,32 @@ path.fillColor = 'black';
403
404
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
404
405
 
405
406
 
407
+ <div id="key" class="member">
408
+ <div class="member-link">
409
+ <a name="key" href="#key"><tt><b>key</b></tt></a>
410
+ </div>
411
+ <div class="member-description hidden">
412
+
413
+ <div class="member-text">
414
+ <p>The key of the host&rsquo;s node that the item represents, in a project backed by a host document, see <a href="../classes/Project.html#host"><tt>project.host</tt></a>. It can only be set once, on an item created by a script, to register the key that the host gave its new node.</p>
415
+
416
+
417
+
418
+ <ul class="member-list">
419
+ <h4>Type:</h4>
420
+ <li>
421
+ <tt>Number</tt>
422
+ </li>
423
+ </ul>
424
+
425
+
426
+
427
+ </div>
428
+
429
+ </div>
430
+ </div>
431
+
432
+
406
433
  <div id="id" class="member">
407
434
  <div class="member-link">
408
435
  <a name="id" href="#id"><tt><b>id</b></tt></a>
@@ -749,7 +776,7 @@ path.visible = false;
749
776
  <div class="member-description hidden">
750
777
 
751
778
  <div class="member-text">
752
- <p>The blend mode with which the item is composited onto the canvas. Both the standard canvas compositing modes, as well as the new CSS blend modes are supported. If blend-modes cannot be rendered natively, they are emulated. Be aware that emulation can have an impact on performance.</p>
779
+ <p>The blend mode with which the item is composited onto the canvas. Both the standard canvas compositing modes, as well as the new CSS blend modes are supported. Where the canvas doesn&rsquo;t support a CSS blend mode natively, it draws as <code>&#39;normal&#39;</code>. Paper.js&rsquo;s own modes <code>&#39;add&#39;</code>, <code>&#39;subtract&#39;</code>, <code>&#39;average&#39;</code>, <code>&#39;pin-light&#39;</code> and <code>&#39;negation&#39;</code> are emulated, which can have an impact on performance.</p>
753
780
 
754
781
 
755
782
  <ul class="member-list">
@@ -902,6 +929,42 @@ circle2.opacity = 0.5;
902
929
  </div>
903
930
 
904
931
 
932
+ <div id="textwrap" class="member">
933
+ <div class="member-link">
934
+ <a name="textwrap" href="#textwrap"><tt><b>textWrap</b></tt></a>
935
+ </div>
936
+ <div class="member-description hidden">
937
+
938
+ <div class="member-text">
939
+ <p>Specifies whether, and how, the item pushes aside the text of the <a href="../classes/AreaText.html"><tt>AreaText</tt></a> items below it in its layer: <code>null</code>, or an object with <code>offset</code>, the space kept between them, and <code>invert</code>, to let the text flow inside it instead. <code>true</code> sets the defaults.</p>
940
+
941
+
942
+
943
+ <ul class="member-list">
944
+ <h4>Default:</h4>
945
+ <li><tt>null</tt></li>
946
+ </ul>
947
+
948
+ <ul class="member-list">
949
+ <h4>Type:</h4>
950
+ <li>
951
+ <tt>Object</tt>
952
+ </li>
953
+ </ul>
954
+
955
+
956
+ <h4>Example:</h4>
957
+
958
+
959
+ <pre><code>var circle = new Path.Circle({ center: [100, 100], radius: 40 });
960
+ circle.textWrap = { offset: 10 };</code></pre>
961
+
962
+ </div>
963
+
964
+ </div>
965
+ </div>
966
+
967
+
905
968
  <div id="selected" class="member">
906
969
  <div class="member-link">
907
970
  <a name="selected" href="#selected"><tt><b>selected</b></tt></a>
@@ -959,6 +1022,32 @@ path.selected = true; // Select the path
959
1022
  </div>
960
1023
 
961
1024
 
1025
+ </div>
1026
+
1027
+ </div>
1028
+ </div>
1029
+
1030
+
1031
+ <div id="fullyselected" class="member">
1032
+ <div class="member-link">
1033
+ <a name="fullyselected" href="#fullyselected"><tt><b>fullySelected</b></tt></a>
1034
+ </div>
1035
+ <div class="member-description hidden">
1036
+
1037
+ <div class="member-text">
1038
+ <p>Specifies whether the item and all its descendants are selected. Setting it selects or deselects them all.</p>
1039
+
1040
+
1041
+
1042
+ <ul class="member-list">
1043
+ <h4>Type:</h4>
1044
+ <li>
1045
+ <tt>Boolean</tt>
1046
+ </li>
1047
+ </ul>
1048
+
1049
+
1050
+
962
1051
  </div>
963
1052
 
964
1053
  </div>
@@ -1198,6 +1287,7 @@ circle.position.x += 100;
1198
1287
 
1199
1288
  <div class="member-text">
1200
1289
  <p>The bounding rectangle of the item including stroke width.</p>
1290
+ <p>Setting it fits the item&rsquo;s <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> into the given rectangle minus the extent of the stroke on each side, also where this extent changes with the item&rsquo;s proportions, as with miters. A rectangle smaller than the stroke itself shrinks the bounds to its center.</p>
1201
1291
 
1202
1292
 
1203
1293
 
@@ -1486,6 +1576,34 @@ circle.position.x += 100;
1486
1576
 
1487
1577
 
1488
1578
 
1579
+ </div>
1580
+
1581
+ </div>
1582
+ </div>
1583
+
1584
+
1585
+ <div id="scope" class="member">
1586
+ <div class="member-link">
1587
+ <a name="scope" href="#scope"><tt><b>scope</b></tt></a>
1588
+ </div>
1589
+ <div class="member-description hidden">
1590
+
1591
+ <div class="member-text">
1592
+ <p>The scope that this item belongs to, through its project.</p>
1593
+
1594
+ <p>Read only.</p>
1595
+
1596
+
1597
+
1598
+ <ul class="member-list">
1599
+ <h4>Type:</h4>
1600
+ <li>
1601
+ <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
1602
+ </li>
1603
+ </ul>
1604
+
1605
+
1606
+
1489
1607
  </div>
1490
1608
 
1491
1609
  </div>
@@ -2101,7 +2219,7 @@ path3.strokeJoin = 'bevel';
2101
2219
  <div class="member-description hidden">
2102
2220
 
2103
2221
  <div class="member-text">
2104
- <p>Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke.</p>
2222
+ <p>Specifies whether the stroke is to be drawn taking the current affine transformation into account (the default behavior), or whether it should appear as a non-scaling stroke. On text, non-scaling strokes are exact for uniform scaling only, as the glyphs are always stroked through the transformation.</p>
2105
2223
 
2106
2224
 
2107
2225
 
@@ -3309,9 +3427,9 @@ for (var i = 0; i < 20; i++) {
3309
3427
  <p>Rasterizes the item into a newly created Raster object. The item itself is not removed after rasterization.</p>
3310
3428
  <ul class="member-list">
3311
3429
  <h4>Options:</h4>
3312
- <li><tt>resolution: <tt>Number</tt></tt> &mdash; the desired resolution to be used when rasterizing, in pixels per inch (DPI). If not specified, the value of <code>view.resolution</code> is used by default. &mdash;&nbsp;default: <tt>view.resolution</tt></li>
3313
- <li><tt>raster: <a href="../classes/Raster.html"><tt>Raster</tt></a></tt> &mdash; specifies a raster to be reused when rasterizing. If the raster has the desired size already, then the underlying canvas is reused and no new memory needs to be allocated. If no raster is provided, a new raster item is created and returned instead. &mdash;&nbsp;default: <tt>null</tt></li>
3314
- <li><tt>insert: <tt>Boolean</tt></tt> &mdash; specifies whether the raster should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the rasterized item. &mdash;&nbsp;default: <tt>true</tt></li>
3430
+ <li><tt>options.resolution: <tt>Number</tt></tt> &mdash; the desired resolution to be used when rasterizing, in pixels per inch (DPI). If not specified, the value of <code>view.resolution</code> is used by default. &mdash;&nbsp;default: <tt>view.resolution</tt></li>
3431
+ <li><tt>options.raster: <a href="../classes/Raster.html"><tt>Raster</tt></a></tt> &mdash; specifies a raster to be reused when rasterizing. If the raster has the desired size already, then the underlying canvas is reused and no new memory needs to be allocated. If no raster is provided, a new raster item is created and returned instead. &mdash;&nbsp;default: <tt>null</tt></li>
3432
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; specifies whether the raster should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the rasterized item. &mdash;&nbsp;default: <tt>true</tt></li>
3315
3433
  </ul>
3316
3434
 
3317
3435
  <ul class="member-list">
@@ -3496,7 +3614,7 @@ function onMouseDown(event) {
3496
3614
  </div>
3497
3615
  <div class="member-description hidden">
3498
3616
  <div class="member-text">
3499
-
3617
+ <p>Checks whether the item overlaps with the given item: whether their outlines cross, or one contains the other, as <a href="../classes/Rectangle.html#intersects-rect"><tt>rectangle.intersects(rect)</tt></a> does for rectangles. Items other than paths and shapes are checked through their bounds. To only check whether outlines cross, use <a href="../classes/PathItem.html#getintersections-path"><tt>pathItem.getIntersections(path)</tt></a>.</p>
3500
3618
 
3501
3619
 
3502
3620
  <ul class="member-list">
@@ -3516,7 +3634,7 @@ function onMouseDown(event) {
3516
3634
  <h4>Returns:</h4>
3517
3635
 
3518
3636
  <li>
3519
- <tt><tt>Boolean</tt></tt>
3637
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the items overlap, <tt>false</tt> otherwise
3520
3638
  </li>
3521
3639
 
3522
3640
 
@@ -4012,6 +4130,7 @@ function onMouseDown(event) {
4012
4130
  <div class="member-text">
4013
4131
  <p>Converts the provided SVG content into Paper.js items and adds them to the this item&rsquo;s children list. Note that the item is not cleared first. You can call <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>() to do so.</p>
4014
4132
  <p><code>&lt;symbol&gt;</code> elements are imported as <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> items, and the <code>&lt;use&gt;</code> elements that place them as <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> items. The styles that <code>&lt;use&gt;</code> elements inherit don&rsquo;t reach the symbols&rsquo; content.</p>
4133
+ <p>URLs are fetched as they are, so validate URLs that come from untrusted sources first, especially on servers, where they could reach internal addresses.</p>
4015
4134
  <ul class="member-list">
4016
4135
  <h4>Options:</h4>
4017
4136
  <li><tt>options.expandShapes: <tt>Boolean</tt></tt> &mdash; whether imported shape items should be expanded to path items &mdash;&nbsp;default: <tt>false</tt></li>
@@ -4565,11 +4684,11 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4565
4684
 
4566
4685
  <div id="replacewith-item" class="member">
4567
4686
  <div class="member-link">
4568
- <a name="replacewith-item" href="#replacewith-item"><tt><b>replaceWith</b>(item)</tt></a>
4687
+ <a name="replacewith-item" href="#replacewith-item"><tt><b>replaceWith</b>(...item)</tt></a>
4569
4688
  </div>
4570
4689
  <div class="member-description hidden">
4571
4690
  <div class="member-text">
4572
- <p>Replaces this item with the provided new item which will takes its place in the project hierarchy instead.</p>
4691
+ <p>Replaces this item with the provided new items which will take its place in the project hierarchy instead, in the given order. This also ungroups a group, e.g. <code>group.replaceWith(…group.children)</code>, but note that the items keep their own matrices, see <a href="../classes/Group.html#ungroup"><tt>group.ungroup</tt></a>().</p>
4573
4692
 
4574
4693
 
4575
4694
  <ul class="member-list">
@@ -4578,7 +4697,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4578
4697
  <li>
4579
4698
  <tt>item:</tt>
4580
4699
  <a href="../classes/Item.html"><tt>Item</tt></a>
4581
- &mdash;&nbsp;the item that will replace this item
4700
+ &mdash;&nbsp;the items that will replace this item
4582
4701
 
4583
4702
  </li>
4584
4703
 
@@ -4751,7 +4870,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4751
4870
  </div>
4752
4871
  <div class="member-description hidden">
4753
4872
  <div class="member-text">
4754
- <p>Checks whether the item has a fill.</p>
4873
+ <p>Checks whether the item has a visible fill, a fill color with an alpha above 0. Hit-tests also hit transparent fills, see <a href="../classes/Item.html#hittest"><tt>hitTest</tt></a>.</p>
4755
4874
 
4756
4875
 
4757
4876
 
@@ -4759,7 +4878,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4759
4878
  <h4>Returns:</h4>
4760
4879
 
4761
4880
  <li>
4762
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a fill, <tt>false</tt> otherwise
4881
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a visible fill, <tt>false</tt> otherwise
4763
4882
  </li>
4764
4883
 
4765
4884
 
@@ -6393,10 +6512,10 @@ function onMouseDown(event) {
6393
6512
  <p>Removes the item when the events specified in the passed options object occur.</p>
6394
6513
  <ul class="member-list">
6395
6514
  <h4>Options:</h4>
6396
- <li><tt>options.move: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmousemove"><tt>tool.onMouseMove</tt></a> event is fired.</li>
6397
- <li><tt>options.drag: undefined</tt> &mdash; {Boolena) remove the item when the next <a href="../classes/Tool.html#onmousedrag"><tt>tool.onMouseDrag</tt></a> event is fired.</li>
6398
- <li><tt>options.down: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmousedown"><tt>tool.onMouseDown</tt></a> event is fired.</li>
6399
- <li><tt>options.up: undefined</tt> &mdash; {Boolean) remove the item when the next <a href="../classes/Tool.html#onmouseup"><tt>tool.onMouseUp</tt></a> event is fired.</li>
6515
+ <li><tt>options.move: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmousemove"><tt>tool.onMouseMove</tt></a> event is fired.</li>
6516
+ <li><tt>options.drag: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmousedrag"><tt>tool.onMouseDrag</tt></a> event is fired.</li>
6517
+ <li><tt>options.down: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmousedown"><tt>tool.onMouseDown</tt></a> event is fired.</li>
6518
+ <li><tt>options.up: <tt>Boolean</tt></tt> &mdash; remove the item when the next <a href="../classes/Tool.html#onmouseup"><tt>tool.onMouseUp</tt></a> event is fired.</li>
6400
6519
  </ul>
6401
6520
 
6402
6521
  <ul class="member-list">
@@ -7130,10 +7249,10 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7130
7249
  </div>
7131
7250
  <div class="member-description hidden">
7132
7251
  <div class="member-text">
7133
- <p>Unites the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item.</p>
7252
+ <p>Unites the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside any of them or this path. Each path keeps its own fill rule.</p>
7134
7253
  <ul class="member-list">
7135
7254
  <h4>Options:</h4>
7136
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7255
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7137
7256
  </ul>
7138
7257
 
7139
7258
  <ul class="member-list">
@@ -7141,8 +7260,8 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7141
7260
 
7142
7261
  <li>
7143
7262
  <tt>path:</tt>
7144
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7145
- &mdash;&nbsp;the path to unite with
7263
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
7264
+ &mdash;&nbsp;the path or paths to unite with
7146
7265
 
7147
7266
  </li>
7148
7267
 
@@ -7186,6 +7305,26 @@ result.fillColor = 'red';
7186
7305
  </div>
7187
7306
 
7188
7307
 
7308
+ <h4>Example:<span class="description">Uniting many paths at once:</span></h4>
7309
+
7310
+ <div class="paperscript split">
7311
+
7312
+ <div class="buttons">
7313
+ <div class="button run">Run</div>
7314
+ </div>
7315
+
7316
+ <script type="text/paperscript" canvas="canvas-62">
7317
+ var circles = [];
7318
+ for (var i = 0; i < 6; i++) {
7319
+ circles.push(new Path.Circle([30 + i * 20, 50], 20));
7320
+ }
7321
+ var result = circles[0].unite(circles.slice(1));
7322
+ result.fillColor = 'red';
7323
+ </script>
7324
+ <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7325
+ </div>
7326
+
7327
+
7189
7328
  </div>
7190
7329
  </div>
7191
7330
  </div>
@@ -7197,11 +7336,11 @@ result.fillColor = 'red';
7197
7336
  </div>
7198
7337
  <div class="member-description hidden">
7199
7338
  <div class="member-text">
7200
- <p>Intersects the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item.</p>
7339
+ <p>Intersects the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside all of them and this path. Each path keeps its own fill rule.</p>
7201
7340
  <ul class="member-list">
7202
7341
  <h4>Options:</h4>
7203
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7204
- <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, keeping the parts of the curves that intersect with the area of the second path. &mdash;&nbsp;default: <tt>true</tt></li>
7342
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7343
+ <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating all paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, keeping the parts of the curves that intersect with the areas of all other paths. &mdash;&nbsp;default: <tt>true</tt></li>
7205
7344
  </ul>
7206
7345
 
7207
7346
  <ul class="member-list">
@@ -7209,8 +7348,8 @@ result.fillColor = 'red';
7209
7348
 
7210
7349
  <li>
7211
7350
  <tt>path:</tt>
7212
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7213
- &mdash;&nbsp;the path to intersect with
7351
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
7352
+ &mdash;&nbsp;the path or paths to intersect with
7214
7353
 
7215
7354
  </li>
7216
7355
 
@@ -7245,12 +7384,12 @@ result.fillColor = 'red';
7245
7384
  <div class="button run">Run</div>
7246
7385
  </div>
7247
7386
 
7248
- <script type="text/paperscript" canvas="canvas-62">
7387
+ <script type="text/paperscript" canvas="canvas-63">
7249
7388
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7250
7389
  .intersect(new Path.Circle([50, 50], 25));
7251
7390
  result.fillColor = 'red';
7252
7391
  </script>
7253
- <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7392
+ <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7254
7393
  </div>
7255
7394
 
7256
7395
 
@@ -7265,11 +7404,11 @@ result.fillColor = 'red';
7265
7404
  </div>
7266
7405
  <div class="member-description hidden">
7267
7406
  <div class="member-text">
7268
- <p>Subtracts the geometry of the specified path from this path&rsquo;s geometry and returns the result as a new path item.</p>
7407
+ <p>Subtracts the geometry of the specified path from this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside this path and outside all of them. Each path keeps its own fill rule.</p>
7269
7408
  <ul class="member-list">
7270
7409
  <h4>Options:</h4>
7271
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7272
- <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, removing the parts of the curves that intersect with the area of the second path. &mdash;&nbsp;default: <tt>true</tt></li>
7410
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7411
+ <li><tt>options.trace: <tt>Boolean</tt></tt> &mdash; whether the tracing method is used, treating all paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections, removing the parts of the curves that intersect with the area of any other path. &mdash;&nbsp;default: <tt>true</tt></li>
7273
7412
  </ul>
7274
7413
 
7275
7414
  <ul class="member-list">
@@ -7277,8 +7416,8 @@ result.fillColor = 'red';
7277
7416
 
7278
7417
  <li>
7279
7418
  <tt>path:</tt>
7280
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7281
- &mdash;&nbsp;the path to subtract
7419
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
7420
+ &mdash;&nbsp;the path or paths to subtract
7282
7421
 
7283
7422
  </li>
7284
7423
 
@@ -7313,12 +7452,12 @@ result.fillColor = 'red';
7313
7452
  <div class="button run">Run</div>
7314
7453
  </div>
7315
7454
 
7316
- <script type="text/paperscript" canvas="canvas-63">
7455
+ <script type="text/paperscript" canvas="canvas-64">
7317
7456
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7318
7457
  .subtract(new Path.Circle([50, 50], 25));
7319
7458
  result.fillColor = 'red';
7320
7459
  </script>
7321
- <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7460
+ <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7322
7461
  </div>
7323
7462
 
7324
7463
 
@@ -7333,10 +7472,10 @@ result.fillColor = 'red';
7333
7472
  </div>
7334
7473
  <div class="member-description hidden">
7335
7474
  <div class="member-text">
7336
- <p>Excludes the intersection of the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item.</p>
7475
+ <p>Excludes the intersection of the geometry of the specified path with this path&rsquo;s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside an odd number of the paths, this one included. Each path keeps its own fill rule.</p>
7337
7476
  <ul class="member-list">
7338
7477
  <h4>Options:</h4>
7339
- <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7478
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation &mdash;&nbsp;default: <tt>true</tt></li>
7340
7479
  </ul>
7341
7480
 
7342
7481
  <ul class="member-list">
@@ -7344,8 +7483,8 @@ result.fillColor = 'red';
7344
7483
 
7345
7484
  <li>
7346
7485
  <tt>path:</tt>
7347
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7348
- &mdash;&nbsp;the path to exclude the intersection of
7486
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
7487
+ &mdash;&nbsp;the path or paths to exclude the intersection of
7349
7488
 
7350
7489
  </li>
7351
7490
 
@@ -7380,12 +7519,12 @@ result.fillColor = 'red';
7380
7519
  <div class="button run">Run</div>
7381
7520
  </div>
7382
7521
 
7383
- <script type="text/paperscript" canvas="canvas-64">
7522
+ <script type="text/paperscript" canvas="canvas-65">
7384
7523
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7385
7524
  .exclude(new Path.Circle([50, 50], 25));
7386
7525
  result.fillColor = 'red';
7387
7526
  </script>
7388
- <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7527
+ <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
7389
7528
  </div>
7390
7529
 
7391
7530
 
@@ -7553,7 +7692,7 @@ result.fillColor = 'red';
7553
7692
  <div class="button run">Run</div>
7554
7693
  </div>
7555
7694
 
7556
- <script type="text/paperscript" canvas="canvas-65">
7695
+ <script type="text/paperscript" canvas="canvas-66">
7557
7696
  var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
7558
7697
  path.strokeColor = 'black';
7559
7698
 
@@ -7576,7 +7715,7 @@ function onFrame(event) {
7576
7715
  }
7577
7716
  }
7578
7717
  </script>
7579
- <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
7718
+ <div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
7580
7719
  </div>
7581
7720
 
7582
7721
 
@@ -7717,7 +7856,7 @@ function onFrame(event) {
7717
7856
  <div class="button run">Run</div>
7718
7857
  </div>
7719
7858
 
7720
- <script type="text/paperscript" canvas="canvas-66">
7859
+ <script type="text/paperscript" canvas="canvas-67">
7721
7860
  var star = new Path.Star({
7722
7861
  center: view.center,
7723
7862
  points: 10,
@@ -7741,7 +7880,7 @@ function onMouseMove(event) {
7741
7880
  circle.position = nearestPoint;
7742
7881
  }
7743
7882
  </script>
7744
- <div class="canvas"><canvas width="516" height="200" id="canvas-66"></canvas></div>
7883
+ <div class="canvas"><canvas width="516" height="200" id="canvas-67"></canvas></div>
7745
7884
  </div>
7746
7885
 
7747
7886
 
@@ -7804,7 +7943,7 @@ function onMouseMove(event) {
7804
7943
  <div class="button run">Run</div>
7805
7944
  </div>
7806
7945
 
7807
- <script type="text/paperscript" canvas="canvas-67">
7946
+ <script type="text/paperscript" canvas="canvas-68">
7808
7947
  // Create a circle shaped path at { x: 80, y: 50 }
7809
7948
  // with a radius of 35:
7810
7949
  var path = new Path.Circle({
@@ -7822,7 +7961,7 @@ copy.position.x += 150;
7822
7961
  // Flatten the copied path, with a maximum error of 4 points:
7823
7962
  copy.flatten(4);
7824
7963
  </script>
7825
- <div class="canvas"><canvas width="516" height="100" id="canvas-67"></canvas></div>
7964
+ <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
7826
7965
  </div>
7827
7966
 
7828
7967
 
@@ -7900,7 +8039,7 @@ copy.flatten(4);
7900
8039
  <div class="button run">Run</div>
7901
8040
  </div>
7902
8041
 
7903
- <script type="text/paperscript" canvas="canvas-68">
8042
+ <script type="text/paperscript" canvas="canvas-69">
7904
8043
  // Create a rectangular path with its top-left point at
7905
8044
  // {x: 30, y: 25} and a size of {width: 50, height: 50}:
7906
8045
  var path = new Path.Rectangle({
@@ -7919,7 +8058,7 @@ copy.position.x += 100;
7919
8058
  // Smooth the segments of the copy:
7920
8059
  copy.smooth({ type: 'continuous' });
7921
8060
  </script>
7922
- <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
8061
+ <div class="canvas"><canvas width="516" height="100" id="canvas-69"></canvas></div>
7923
8062
  </div>
7924
8063
 
7925
8064
 
@@ -7931,7 +8070,7 @@ copy.smooth({ type: 'continuous' });
7931
8070
  <div class="button run">Run</div>
7932
8071
  </div>
7933
8072
 
7934
- <script type="text/paperscript" canvas="canvas-69">
8073
+ <script type="text/paperscript" canvas="canvas-70">
7935
8074
  var path = new Path();
7936
8075
  path.strokeColor = 'black';
7937
8076
 
@@ -7956,7 +8095,7 @@ copy.fullySelected = true;
7956
8095
  // Smooth the path using centripetal Catmull-Rom splines:
7957
8096
  copy.smooth({ type: 'catmull-rom', factor: 0.5 });
7958
8097
  </script>
7959
- <div class="canvas"><canvas width="516" height="220" id="canvas-69"></canvas></div>
8098
+ <div class="canvas"><canvas width="516" height="220" id="canvas-70"></canvas></div>
7960
8099
  </div>
7961
8100
 
7962
8101
 
@@ -7968,7 +8107,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
7968
8107
  <div class="button run">Run</div>
7969
8108
  </div>
7970
8109
 
7971
- <script type="text/paperscript" canvas="canvas-70">
8110
+ <script type="text/paperscript" canvas="canvas-71">
7972
8111
  // Create 5 rectangles, next to each other:
7973
8112
  var paths = [];
7974
8113
  for (var i = 0; i < 5; i++) {
@@ -7998,7 +8137,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
7998
8137
  // Smooth a range, using negative indices:
7999
8138
  paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8000
8139
  </script>
8001
- <div class="canvas"><canvas width="516" height="110" id="canvas-70"></canvas></div>
8140
+ <div class="canvas"><canvas width="516" height="110" id="canvas-71"></canvas></div>
8002
8141
  </div>
8003
8142
 
8004
8143
 
@@ -8051,7 +8190,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8051
8190
  <div class="button run">Run</div>
8052
8191
  </div>
8053
8192
 
8054
- <script type="text/paperscript" canvas="canvas-71">
8193
+ <script type="text/paperscript" canvas="canvas-72">
8055
8194
  var path;
8056
8195
  function onMouseDown(event) {
8057
8196
  // If we already made a path before, deselect it:
@@ -8081,7 +8220,7 @@ function onMouseUp(event) {
8081
8220
  path.selected = true;
8082
8221
  }
8083
8222
  </script>
8084
- <div class="canvas"><canvas width="516" height="300" id="canvas-71"></canvas></div>
8223
+ <div class="canvas"><canvas width="516" height="300" id="canvas-72"></canvas></div>
8085
8224
  </div>
8086
8225
 
8087
8226
 
@@ -8280,7 +8419,7 @@ function onMouseUp(event) {
8280
8419
  <div class="button run">Run</div>
8281
8420
  </div>
8282
8421
 
8283
- <script type="text/paperscript" canvas="canvas-72">
8422
+ <script type="text/paperscript" canvas="canvas-73">
8284
8423
  var path = new Path();
8285
8424
  path.strokeColor = 'black';
8286
8425
 
@@ -8300,7 +8439,7 @@ path.arcTo(throughPoint, toPoint);
8300
8439
  var circle = new Path.Circle(throughPoint, 3);
8301
8440
  circle.fillColor = 'red';
8302
8441
  </script>
8303
- <div class="canvas"><canvas width="516" height="100" id="canvas-72"></canvas></div>
8442
+ <div class="canvas"><canvas width="516" height="100" id="canvas-73"></canvas></div>
8304
8443
  </div>
8305
8444
 
8306
8445
 
@@ -8312,7 +8451,7 @@ circle.fillColor = 'red';
8312
8451
  <div class="button run">Run</div>
8313
8452
  </div>
8314
8453
 
8315
- <script type="text/paperscript" canvas="canvas-73">
8454
+ <script type="text/paperscript" canvas="canvas-74">
8316
8455
  var myPath;
8317
8456
  function onMouseDrag(event) {
8318
8457
  // If we created a path before, remove it:
@@ -8340,7 +8479,7 @@ function onMouseUp(event) {
8340
8479
  myPath.fillColor = 'black';
8341
8480
  }
8342
8481
  </script>
8343
- <div class="canvas"><canvas width="516" height="300" id="canvas-73"></canvas></div>
8482
+ <div class="canvas"><canvas width="516" height="300" id="canvas-74"></canvas></div>
8344
8483
  </div>
8345
8484
 
8346
8485
 
@@ -8389,7 +8528,7 @@ function onMouseUp(event) {
8389
8528
  <div class="button run">Run</div>
8390
8529
  </div>
8391
8530
 
8392
- <script type="text/paperscript" canvas="canvas-74">
8531
+ <script type="text/paperscript" canvas="canvas-75">
8393
8532
  var path = new Path();
8394
8533
  path.strokeColor = 'black';
8395
8534
 
@@ -8404,7 +8543,7 @@ path2.add(new Point(180, 25));
8404
8543
  // we pass `false` as the second argument to arcTo:
8405
8544
  path2.arcTo(new Point(280, 25), false);
8406
8545
  </script>
8407
- <div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
8546
+ <div class="canvas"><canvas width="516" height="100" id="canvas-75"></canvas></div>
8408
8547
  </div>
8409
8548
 
8410
8549
 
@@ -8416,7 +8555,7 @@ path2.arcTo(new Point(280, 25), false);
8416
8555
  <div class="button run">Run</div>
8417
8556
  </div>
8418
8557
 
8419
- <script type="text/paperscript" canvas="canvas-75">
8558
+ <script type="text/paperscript" canvas="canvas-76">
8420
8559
  var myPath;
8421
8560
 
8422
8561
  // The mouse has to move at least 20 points before
@@ -8437,7 +8576,7 @@ function onMouseDrag(event) {
8437
8576
  myPath.arcTo(event.point);
8438
8577
  }
8439
8578
  </script>
8440
- <div class="canvas"><canvas width="516" height="300" id="canvas-75"></canvas></div>
8579
+ <div class="canvas"><canvas width="516" height="300" id="canvas-76"></canvas></div>
8441
8580
  </div>
8442
8581
 
8443
8582
 
@@ -8493,7 +8632,7 @@ function onMouseDrag(event) {
8493
8632
  <div class="button run">Run</div>
8494
8633
  </div>
8495
8634
 
8496
- <script type="text/paperscript" canvas="canvas-76">
8635
+ <script type="text/paperscript" canvas="canvas-77">
8497
8636
  var myPath;
8498
8637
  function onMouseMove(event) {
8499
8638
  // If we created a path before, remove it:
@@ -8514,7 +8653,7 @@ function onMouseMove(event) {
8514
8653
  myPath.selected = true;
8515
8654
  }
8516
8655
  </script>
8517
- <div class="canvas"><canvas width="516" height="300" id="canvas-76"></canvas></div>
8656
+ <div class="canvas"><canvas width="516" height="300" id="canvas-77"></canvas></div>
8518
8657
  </div>
8519
8658
 
8520
8659
 
@@ -8699,7 +8838,7 @@ function onMouseMove(event) {
8699
8838
  <div class="button run">Run</div>
8700
8839
  </div>
8701
8840
 
8702
- <script type="text/paperscript" canvas="canvas-77">
8841
+ <script type="text/paperscript" canvas="canvas-78">
8703
8842
  var path = new Path();
8704
8843
  path.strokeColor = 'black';
8705
8844
 
@@ -8713,7 +8852,7 @@ path.lineBy(50, 0);
8713
8852
  // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
8714
8853
  path.lineBy(0, 50);
8715
8854
  </script>
8716
- <div class="canvas"><canvas width="516" height="100" id="canvas-77"></canvas></div>
8855
+ <div class="canvas"><canvas width="516" height="100" id="canvas-78"></canvas></div>
8717
8856
  </div>
8718
8857
 
8719
8858
 
@@ -8725,7 +8864,7 @@ path.lineBy(0, 50);
8725
8864
  <div class="button run">Run</div>
8726
8865
  </div>
8727
8866
 
8728
- <script type="text/paperscript" canvas="canvas-78">
8867
+ <script type="text/paperscript" canvas="canvas-79">
8729
8868
  var path = new Path();
8730
8869
  path.strokeColor = 'black';
8731
8870
 
@@ -8751,7 +8890,7 @@ path.smooth();
8751
8890
  // the construction of the path:
8752
8891
  // path.selected = true;
8753
8892
  </script>
8754
- <div class="canvas"><canvas width="516" height="300" id="canvas-78"></canvas></div>
8893
+ <div class="canvas"><canvas width="516" height="300" id="canvas-79"></canvas></div>
8755
8894
  </div>
8756
8895
 
8757
8896
 
@@ -8970,7 +9109,7 @@ path.smooth();
8970
9109
 
8971
9110
  <!-- =========================== copyright notice ========================== -->
8972
9111
  <p class="footer">
8973
- Paper.js v0.13.0<br>
9112
+ Paper.js v0.15.0<br>
8974
9113
  Copyright &#169; 2011—2026 <a href="http://www.lehni.org" target="_blank">J&uuml;rg Lehni</a> &amp; <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
8975
9114
  <div class="content-end"></div>
8976
9115