paper 0.14.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 +252 -0
  2. package/README.md +3 -1
  3. package/dist/docs/assets/js/paper.js +6997 -1658
  4. package/dist/docs/classes/AreaText.html +8658 -0
  5. package/dist/docs/classes/ChangeFlag.html +2 -1
  6. package/dist/docs/classes/Color.html +2 -1
  7. package/dist/docs/classes/CompoundPath.html +152 -67
  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 +117 -15
  14. package/dist/docs/classes/HitResult.html +2 -1
  15. package/dist/docs/classes/HostItem.html +80 -15
  16. package/dist/docs/classes/Item.html +137 -15
  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 +114 -15
  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 +4 -2
  23. package/dist/docs/classes/PaperScript.html +5 -2
  24. package/dist/docs/classes/Path.html +126 -67
  25. package/dist/docs/classes/PathItem.html +270 -185
  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 +1346 -59
  29. package/dist/docs/classes/Project.html +40 -7
  30. package/dist/docs/classes/Raster.html +80 -15
  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 +80 -15
  34. package/dist/docs/classes/Size.html +4 -2
  35. package/dist/docs/classes/Style.html +767 -14
  36. package/dist/docs/classes/SymbolDefinition.html +2 -1
  37. package/dist/docs/classes/SymbolItem.html +80 -15
  38. package/dist/docs/classes/TextItem.html +1469 -179
  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 +2 -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 +9 -8
  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 +6832 -1637
  49. package/dist/paper-core.min.js +3 -3
  50. package/dist/paper-full.js +6997 -1658
  51. package/dist/paper-full.min.js +3 -3
  52. package/dist/{paper-sourced.js → paper-hosted.js} +7109 -1682
  53. package/dist/paper.d.ts +1727 -163
  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 +3 -2
@@ -17,6 +17,7 @@
17
17
 
18
18
 
19
19
 
20
+
20
21
  </div>
21
22
 
22
23
 
@@ -375,7 +376,7 @@
375
376
 
376
377
  <!-- =========================== copyright notice ========================== -->
377
378
  <p class="footer">
378
- Paper.js v0.14.0<br>
379
+ Paper.js v0.15.0<br>
379
380
  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>
380
381
  <div class="content-end"></div>
381
382
 
@@ -58,6 +58,7 @@ circle.fillColor = '#ff0000';
58
58
  </div>
59
59
 
60
60
 
61
+
61
62
  </div>
62
63
 
63
64
  <!-- =============================== constructors ========================== -->
@@ -2195,7 +2196,7 @@ circle.fillColor = Color.random();
2195
2196
 
2196
2197
  <!-- =========================== copyright notice ========================== -->
2197
2198
  <p class="footer">
2198
- Paper.js v0.14.0<br>
2199
+ Paper.js v0.15.0<br>
2199
2200
  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>
2200
2201
  <div class="content-end"></div>
2201
2202
 
@@ -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 ========================== -->
@@ -410,7 +411,7 @@ path.fillColor = 'black';
410
411
  <div class="member-description hidden">
411
412
 
412
413
  <div class="member-text">
413
- <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#source"><tt>project.source</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>
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>
414
415
 
415
416
 
416
417
 
@@ -775,7 +776,7 @@ path.visible = false;
775
776
  <div class="member-description hidden">
776
777
 
777
778
  <div class="member-text">
778
- <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>
779
780
 
780
781
 
781
782
  <ul class="member-list">
@@ -928,6 +929,42 @@ circle2.opacity = 0.5;
928
929
  </div>
929
930
 
930
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
+
931
968
  <div id="selected" class="member">
932
969
  <div class="member-link">
933
970
  <a name="selected" href="#selected"><tt><b>selected</b></tt></a>
@@ -985,6 +1022,32 @@ path.selected = true; // Select the path
985
1022
  </div>
986
1023
 
987
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
+
988
1051
  </div>
989
1052
 
990
1053
  </div>
@@ -1224,6 +1287,7 @@ circle.position.x += 100;
1224
1287
 
1225
1288
  <div class="member-text">
1226
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>
1227
1291
 
1228
1292
 
1229
1293
 
@@ -3363,9 +3427,9 @@ for (var i = 0; i < 20; i++) {
3363
3427
  <p>Rasterizes the item into a newly created Raster object. The item itself is not removed after rasterization.</p>
3364
3428
  <ul class="member-list">
3365
3429
  <h4>Options:</h4>
3366
- <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>
3367
- <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>
3368
- <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>
3369
3433
  </ul>
3370
3434
 
3371
3435
  <ul class="member-list">
@@ -3550,7 +3614,7 @@ function onMouseDown(event) {
3550
3614
  </div>
3551
3615
  <div class="member-description hidden">
3552
3616
  <div class="member-text">
3553
-
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>
3554
3618
 
3555
3619
 
3556
3620
  <ul class="member-list">
@@ -3570,7 +3634,7 @@ function onMouseDown(event) {
3570
3634
  <h4>Returns:</h4>
3571
3635
 
3572
3636
  <li>
3573
- <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
3574
3638
  </li>
3575
3639
 
3576
3640
 
@@ -4066,6 +4130,7 @@ function onMouseDown(event) {
4066
4130
  <div class="member-text">
4067
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>
4068
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>
4069
4134
  <ul class="member-list">
4070
4135
  <h4>Options:</h4>
4071
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>
@@ -4619,11 +4684,11 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4619
4684
 
4620
4685
  <div id="replacewith-item" class="member">
4621
4686
  <div class="member-link">
4622
- <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>
4623
4688
  </div>
4624
4689
  <div class="member-description hidden">
4625
4690
  <div class="member-text">
4626
- <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>
4627
4692
 
4628
4693
 
4629
4694
  <ul class="member-list">
@@ -4632,7 +4697,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4632
4697
  <li>
4633
4698
  <tt>item:</tt>
4634
4699
  <a href="../classes/Item.html"><tt>Item</tt></a>
4635
- &mdash;&nbsp;the item that will replace this item
4700
+ &mdash;&nbsp;the items that will replace this item
4636
4701
 
4637
4702
  </li>
4638
4703
 
@@ -6447,10 +6512,10 @@ function onMouseDown(event) {
6447
6512
  <p>Removes the item when the events specified in the passed options object occur.</p>
6448
6513
  <ul class="member-list">
6449
6514
  <h4>Options:</h4>
6450
- <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>
6451
- <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>
6452
- <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>
6453
- <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>
6454
6519
  </ul>
6455
6520
 
6456
6521
  <ul class="member-list">
@@ -7184,10 +7249,10 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7184
7249
  </div>
7185
7250
  <div class="member-description hidden">
7186
7251
  <div class="member-text">
7187
- <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>
7188
7253
  <ul class="member-list">
7189
7254
  <h4>Options:</h4>
7190
- <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>
7191
7256
  </ul>
7192
7257
 
7193
7258
  <ul class="member-list">
@@ -7195,8 +7260,8 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7195
7260
 
7196
7261
  <li>
7197
7262
  <tt>path:</tt>
7198
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7199
- &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
7200
7265
 
7201
7266
  </li>
7202
7267
 
@@ -7240,6 +7305,26 @@ result.fillColor = 'red';
7240
7305
  </div>
7241
7306
 
7242
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
+
7243
7328
  </div>
7244
7329
  </div>
7245
7330
  </div>
@@ -7251,11 +7336,11 @@ result.fillColor = 'red';
7251
7336
  </div>
7252
7337
  <div class="member-description hidden">
7253
7338
  <div class="member-text">
7254
- <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>
7255
7340
  <ul class="member-list">
7256
7341
  <h4>Options:</h4>
7257
- <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>
7258
- <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>
7259
7344
  </ul>
7260
7345
 
7261
7346
  <ul class="member-list">
@@ -7263,8 +7348,8 @@ result.fillColor = 'red';
7263
7348
 
7264
7349
  <li>
7265
7350
  <tt>path:</tt>
7266
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7267
- &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
7268
7353
 
7269
7354
  </li>
7270
7355
 
@@ -7299,12 +7384,12 @@ result.fillColor = 'red';
7299
7384
  <div class="button run">Run</div>
7300
7385
  </div>
7301
7386
 
7302
- <script type="text/paperscript" canvas="canvas-62">
7387
+ <script type="text/paperscript" canvas="canvas-63">
7303
7388
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7304
7389
  .intersect(new Path.Circle([50, 50], 25));
7305
7390
  result.fillColor = 'red';
7306
7391
  </script>
7307
- <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>
7308
7393
  </div>
7309
7394
 
7310
7395
 
@@ -7319,11 +7404,11 @@ result.fillColor = 'red';
7319
7404
  </div>
7320
7405
  <div class="member-description hidden">
7321
7406
  <div class="member-text">
7322
- <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>
7323
7408
  <ul class="member-list">
7324
7409
  <h4>Options:</h4>
7325
- <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>
7326
- <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>
7327
7412
  </ul>
7328
7413
 
7329
7414
  <ul class="member-list">
@@ -7331,8 +7416,8 @@ result.fillColor = 'red';
7331
7416
 
7332
7417
  <li>
7333
7418
  <tt>path:</tt>
7334
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7335
- &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
7336
7421
 
7337
7422
  </li>
7338
7423
 
@@ -7367,12 +7452,12 @@ result.fillColor = 'red';
7367
7452
  <div class="button run">Run</div>
7368
7453
  </div>
7369
7454
 
7370
- <script type="text/paperscript" canvas="canvas-63">
7455
+ <script type="text/paperscript" canvas="canvas-64">
7371
7456
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7372
7457
  .subtract(new Path.Circle([50, 50], 25));
7373
7458
  result.fillColor = 'red';
7374
7459
  </script>
7375
- <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>
7376
7461
  </div>
7377
7462
 
7378
7463
 
@@ -7387,10 +7472,10 @@ result.fillColor = 'red';
7387
7472
  </div>
7388
7473
  <div class="member-description hidden">
7389
7474
  <div class="member-text">
7390
- <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>
7391
7476
  <ul class="member-list">
7392
7477
  <h4>Options:</h4>
7393
- <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>
7394
7479
  </ul>
7395
7480
 
7396
7481
  <ul class="member-list">
@@ -7398,8 +7483,8 @@ result.fillColor = 'red';
7398
7483
 
7399
7484
  <li>
7400
7485
  <tt>path:</tt>
7401
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7402
- &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
7403
7488
 
7404
7489
  </li>
7405
7490
 
@@ -7434,12 +7519,12 @@ result.fillColor = 'red';
7434
7519
  <div class="button run">Run</div>
7435
7520
  </div>
7436
7521
 
7437
- <script type="text/paperscript" canvas="canvas-64">
7522
+ <script type="text/paperscript" canvas="canvas-65">
7438
7523
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7439
7524
  .exclude(new Path.Circle([50, 50], 25));
7440
7525
  result.fillColor = 'red';
7441
7526
  </script>
7442
- <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>
7443
7528
  </div>
7444
7529
 
7445
7530
 
@@ -7607,7 +7692,7 @@ result.fillColor = 'red';
7607
7692
  <div class="button run">Run</div>
7608
7693
  </div>
7609
7694
 
7610
- <script type="text/paperscript" canvas="canvas-65">
7695
+ <script type="text/paperscript" canvas="canvas-66">
7611
7696
  var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
7612
7697
  path.strokeColor = 'black';
7613
7698
 
@@ -7630,7 +7715,7 @@ function onFrame(event) {
7630
7715
  }
7631
7716
  }
7632
7717
  </script>
7633
- <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>
7634
7719
  </div>
7635
7720
 
7636
7721
 
@@ -7771,7 +7856,7 @@ function onFrame(event) {
7771
7856
  <div class="button run">Run</div>
7772
7857
  </div>
7773
7858
 
7774
- <script type="text/paperscript" canvas="canvas-66">
7859
+ <script type="text/paperscript" canvas="canvas-67">
7775
7860
  var star = new Path.Star({
7776
7861
  center: view.center,
7777
7862
  points: 10,
@@ -7795,7 +7880,7 @@ function onMouseMove(event) {
7795
7880
  circle.position = nearestPoint;
7796
7881
  }
7797
7882
  </script>
7798
- <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>
7799
7884
  </div>
7800
7885
 
7801
7886
 
@@ -7858,7 +7943,7 @@ function onMouseMove(event) {
7858
7943
  <div class="button run">Run</div>
7859
7944
  </div>
7860
7945
 
7861
- <script type="text/paperscript" canvas="canvas-67">
7946
+ <script type="text/paperscript" canvas="canvas-68">
7862
7947
  // Create a circle shaped path at { x: 80, y: 50 }
7863
7948
  // with a radius of 35:
7864
7949
  var path = new Path.Circle({
@@ -7876,7 +7961,7 @@ copy.position.x += 150;
7876
7961
  // Flatten the copied path, with a maximum error of 4 points:
7877
7962
  copy.flatten(4);
7878
7963
  </script>
7879
- <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>
7880
7965
  </div>
7881
7966
 
7882
7967
 
@@ -7954,7 +8039,7 @@ copy.flatten(4);
7954
8039
  <div class="button run">Run</div>
7955
8040
  </div>
7956
8041
 
7957
- <script type="text/paperscript" canvas="canvas-68">
8042
+ <script type="text/paperscript" canvas="canvas-69">
7958
8043
  // Create a rectangular path with its top-left point at
7959
8044
  // {x: 30, y: 25} and a size of {width: 50, height: 50}:
7960
8045
  var path = new Path.Rectangle({
@@ -7973,7 +8058,7 @@ copy.position.x += 100;
7973
8058
  // Smooth the segments of the copy:
7974
8059
  copy.smooth({ type: 'continuous' });
7975
8060
  </script>
7976
- <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>
7977
8062
  </div>
7978
8063
 
7979
8064
 
@@ -7985,7 +8070,7 @@ copy.smooth({ type: 'continuous' });
7985
8070
  <div class="button run">Run</div>
7986
8071
  </div>
7987
8072
 
7988
- <script type="text/paperscript" canvas="canvas-69">
8073
+ <script type="text/paperscript" canvas="canvas-70">
7989
8074
  var path = new Path();
7990
8075
  path.strokeColor = 'black';
7991
8076
 
@@ -8010,7 +8095,7 @@ copy.fullySelected = true;
8010
8095
  // Smooth the path using centripetal Catmull-Rom splines:
8011
8096
  copy.smooth({ type: 'catmull-rom', factor: 0.5 });
8012
8097
  </script>
8013
- <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>
8014
8099
  </div>
8015
8100
 
8016
8101
 
@@ -8022,7 +8107,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
8022
8107
  <div class="button run">Run</div>
8023
8108
  </div>
8024
8109
 
8025
- <script type="text/paperscript" canvas="canvas-70">
8110
+ <script type="text/paperscript" canvas="canvas-71">
8026
8111
  // Create 5 rectangles, next to each other:
8027
8112
  var paths = [];
8028
8113
  for (var i = 0; i < 5; i++) {
@@ -8052,7 +8137,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
8052
8137
  // Smooth a range, using negative indices:
8053
8138
  paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8054
8139
  </script>
8055
- <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>
8056
8141
  </div>
8057
8142
 
8058
8143
 
@@ -8105,7 +8190,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8105
8190
  <div class="button run">Run</div>
8106
8191
  </div>
8107
8192
 
8108
- <script type="text/paperscript" canvas="canvas-71">
8193
+ <script type="text/paperscript" canvas="canvas-72">
8109
8194
  var path;
8110
8195
  function onMouseDown(event) {
8111
8196
  // If we already made a path before, deselect it:
@@ -8135,7 +8220,7 @@ function onMouseUp(event) {
8135
8220
  path.selected = true;
8136
8221
  }
8137
8222
  </script>
8138
- <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>
8139
8224
  </div>
8140
8225
 
8141
8226
 
@@ -8334,7 +8419,7 @@ function onMouseUp(event) {
8334
8419
  <div class="button run">Run</div>
8335
8420
  </div>
8336
8421
 
8337
- <script type="text/paperscript" canvas="canvas-72">
8422
+ <script type="text/paperscript" canvas="canvas-73">
8338
8423
  var path = new Path();
8339
8424
  path.strokeColor = 'black';
8340
8425
 
@@ -8354,7 +8439,7 @@ path.arcTo(throughPoint, toPoint);
8354
8439
  var circle = new Path.Circle(throughPoint, 3);
8355
8440
  circle.fillColor = 'red';
8356
8441
  </script>
8357
- <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>
8358
8443
  </div>
8359
8444
 
8360
8445
 
@@ -8366,7 +8451,7 @@ circle.fillColor = 'red';
8366
8451
  <div class="button run">Run</div>
8367
8452
  </div>
8368
8453
 
8369
- <script type="text/paperscript" canvas="canvas-73">
8454
+ <script type="text/paperscript" canvas="canvas-74">
8370
8455
  var myPath;
8371
8456
  function onMouseDrag(event) {
8372
8457
  // If we created a path before, remove it:
@@ -8394,7 +8479,7 @@ function onMouseUp(event) {
8394
8479
  myPath.fillColor = 'black';
8395
8480
  }
8396
8481
  </script>
8397
- <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>
8398
8483
  </div>
8399
8484
 
8400
8485
 
@@ -8443,7 +8528,7 @@ function onMouseUp(event) {
8443
8528
  <div class="button run">Run</div>
8444
8529
  </div>
8445
8530
 
8446
- <script type="text/paperscript" canvas="canvas-74">
8531
+ <script type="text/paperscript" canvas="canvas-75">
8447
8532
  var path = new Path();
8448
8533
  path.strokeColor = 'black';
8449
8534
 
@@ -8458,7 +8543,7 @@ path2.add(new Point(180, 25));
8458
8543
  // we pass `false` as the second argument to arcTo:
8459
8544
  path2.arcTo(new Point(280, 25), false);
8460
8545
  </script>
8461
- <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>
8462
8547
  </div>
8463
8548
 
8464
8549
 
@@ -8470,7 +8555,7 @@ path2.arcTo(new Point(280, 25), false);
8470
8555
  <div class="button run">Run</div>
8471
8556
  </div>
8472
8557
 
8473
- <script type="text/paperscript" canvas="canvas-75">
8558
+ <script type="text/paperscript" canvas="canvas-76">
8474
8559
  var myPath;
8475
8560
 
8476
8561
  // The mouse has to move at least 20 points before
@@ -8491,7 +8576,7 @@ function onMouseDrag(event) {
8491
8576
  myPath.arcTo(event.point);
8492
8577
  }
8493
8578
  </script>
8494
- <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>
8495
8580
  </div>
8496
8581
 
8497
8582
 
@@ -8547,7 +8632,7 @@ function onMouseDrag(event) {
8547
8632
  <div class="button run">Run</div>
8548
8633
  </div>
8549
8634
 
8550
- <script type="text/paperscript" canvas="canvas-76">
8635
+ <script type="text/paperscript" canvas="canvas-77">
8551
8636
  var myPath;
8552
8637
  function onMouseMove(event) {
8553
8638
  // If we created a path before, remove it:
@@ -8568,7 +8653,7 @@ function onMouseMove(event) {
8568
8653
  myPath.selected = true;
8569
8654
  }
8570
8655
  </script>
8571
- <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>
8572
8657
  </div>
8573
8658
 
8574
8659
 
@@ -8753,7 +8838,7 @@ function onMouseMove(event) {
8753
8838
  <div class="button run">Run</div>
8754
8839
  </div>
8755
8840
 
8756
- <script type="text/paperscript" canvas="canvas-77">
8841
+ <script type="text/paperscript" canvas="canvas-78">
8757
8842
  var path = new Path();
8758
8843
  path.strokeColor = 'black';
8759
8844
 
@@ -8767,7 +8852,7 @@ path.lineBy(50, 0);
8767
8852
  // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
8768
8853
  path.lineBy(0, 50);
8769
8854
  </script>
8770
- <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>
8771
8856
  </div>
8772
8857
 
8773
8858
 
@@ -8779,7 +8864,7 @@ path.lineBy(0, 50);
8779
8864
  <div class="button run">Run</div>
8780
8865
  </div>
8781
8866
 
8782
- <script type="text/paperscript" canvas="canvas-78">
8867
+ <script type="text/paperscript" canvas="canvas-79">
8783
8868
  var path = new Path();
8784
8869
  path.strokeColor = 'black';
8785
8870
 
@@ -8805,7 +8890,7 @@ path.smooth();
8805
8890
  // the construction of the path:
8806
8891
  // path.selected = true;
8807
8892
  </script>
8808
- <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>
8809
8894
  </div>
8810
8895
 
8811
8896
 
@@ -9024,7 +9109,7 @@ path.smooth();
9024
9109
 
9025
9110
  <!-- =========================== copyright notice ========================== -->
9026
9111
  <p class="footer">
9027
- Paper.js v0.14.0<br>
9112
+ Paper.js v0.15.0<br>
9028
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>
9029
9114
  <div class="content-end"></div>
9030
9115