paper 0.12.20 → 0.14.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 (54) hide show
  1. package/CHANGELOG.md +318 -0
  2. package/README.md +45 -26
  3. package/dist/docs/assets/js/paper.js +1210 -481
  4. package/dist/docs/classes/ChangeFlag.html +384 -0
  5. package/dist/docs/classes/Color.html +63 -47
  6. package/dist/docs/classes/CompoundPath.html +219 -62
  7. package/dist/docs/classes/Curve.html +9 -7
  8. package/dist/docs/classes/CurveLocation.html +1 -1
  9. package/dist/docs/classes/Event.html +1 -1
  10. package/dist/docs/classes/Gradient.html +1 -1
  11. package/dist/docs/classes/GradientStop.html +1 -1
  12. package/dist/docs/classes/Group.html +151 -27
  13. package/dist/docs/classes/HitResult.html +3 -2
  14. package/dist/docs/classes/HostItem.html +6721 -0
  15. package/dist/docs/classes/Item.html +120 -27
  16. package/dist/docs/classes/Key.html +1 -1
  17. package/dist/docs/classes/KeyEvent.html +1 -1
  18. package/dist/docs/classes/Layer.html +151 -27
  19. package/dist/docs/classes/Matrix.html +1 -1
  20. package/dist/docs/classes/MouseEvent.html +1 -1
  21. package/dist/docs/classes/PaperScope.html +88 -1
  22. package/dist/docs/classes/PaperScript.html +2 -1
  23. package/dist/docs/classes/Path.html +232 -72
  24. package/dist/docs/classes/PathItem.html +337 -180
  25. package/dist/docs/classes/Point.html +143 -21
  26. package/dist/docs/classes/PointText.html +151 -27
  27. package/dist/docs/classes/Project.html +201 -8
  28. package/dist/docs/classes/Raster.html +150 -38
  29. package/dist/docs/classes/Rectangle.html +12 -11
  30. package/dist/docs/classes/Segment.html +1 -1
  31. package/dist/docs/classes/Shape.html +120 -27
  32. package/dist/docs/classes/Size.html +81 -21
  33. package/dist/docs/classes/Style.html +35 -3
  34. package/dist/docs/classes/SymbolDefinition.html +1 -1
  35. package/dist/docs/classes/SymbolItem.html +121 -28
  36. package/dist/docs/classes/TextItem.html +151 -27
  37. package/dist/docs/classes/Tool.html +127 -1
  38. package/dist/docs/classes/ToolEvent.html +27 -1
  39. package/dist/docs/classes/Tween.html +1 -1
  40. package/dist/docs/classes/View.html +345 -10
  41. package/dist/docs/classes/global.html +1 -1
  42. package/dist/docs/classes/index.html +2 -2
  43. package/dist/docs/index.html +1 -1
  44. package/dist/node/canvas.js +1 -1
  45. package/dist/node/self.js +4 -3
  46. package/dist/paper-core.js +1182 -465
  47. package/dist/paper-core.min.js +3 -3
  48. package/dist/paper-full.js +1210 -481
  49. package/dist/paper-full.min.js +3 -3
  50. package/dist/paper-sourced.js +18631 -0
  51. package/dist/paper.d.ts +606 -78
  52. package/examples/Rasters/Smoothing.html +1 -1
  53. package/package.json +6 -17
  54. package/dist/node/xml.js +0 -40
@@ -403,6 +403,32 @@ path.fillColor = 'black';
403
403
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
404
404
 
405
405
 
406
+ <div id="key" class="member">
407
+ <div class="member-link">
408
+ <a name="key" href="#key"><tt><b>key</b></tt></a>
409
+ </div>
410
+ <div class="member-description hidden">
411
+
412
+ <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
+
415
+
416
+
417
+ <ul class="member-list">
418
+ <h4>Type:</h4>
419
+ <li>
420
+ <tt>Number</tt>
421
+ </li>
422
+ </ul>
423
+
424
+
425
+
426
+ </div>
427
+
428
+ </div>
429
+ </div>
430
+
431
+
406
432
  <div id="id" class="member">
407
433
  <div class="member-link">
408
434
  <a name="id" href="#id"><tt><b>id</b></tt></a>
@@ -522,6 +548,7 @@ group.children['example'].fillColor = 'red';
522
548
 
523
549
  <div class="member-text">
524
550
  <p>The path style of the item.</p>
551
+ <p>Styles set on a <a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a> are applied to the children that it contains at that moment. Items added to it later do not receive them.</p>
525
552
 
526
553
 
527
554
 
@@ -864,6 +891,37 @@ circle2.opacity = 0.5;
864
891
  </div>
865
892
 
866
893
 
894
+ </div>
895
+
896
+ </div>
897
+ </div>
898
+
899
+
900
+ <div id="guide" class="member">
901
+ <div class="member-link">
902
+ <a name="guide" href="#guide"><tt><b>guide</b></tt></a>
903
+ </div>
904
+ <div class="member-description hidden">
905
+
906
+ <div class="member-text">
907
+ <p>Specifies whether the item functions as a guide. When set to <code>true</code>, the item is drawn as usual, but left out of hit-tests and mouse interactions. Hit-tests only find guides when <code>options.guides</code> is set, and then only them, see <a href="../classes/Item.html#hittest-point"><tt>hitTest(point[, options])</tt></a>.</p>
908
+
909
+
910
+
911
+ <ul class="member-list">
912
+ <h4>Default:</h4>
913
+ <li><tt>false</tt></li>
914
+ </ul>
915
+
916
+ <ul class="member-list">
917
+ <h4>Type:</h4>
918
+ <li>
919
+ <tt>Boolean</tt>
920
+ </li>
921
+ </ul>
922
+
923
+
924
+
867
925
  </div>
868
926
 
869
927
  </div>
@@ -1454,6 +1512,34 @@ circle.position.x += 100;
1454
1512
 
1455
1513
 
1456
1514
 
1515
+ </div>
1516
+
1517
+ </div>
1518
+ </div>
1519
+
1520
+
1521
+ <div id="scope" class="member">
1522
+ <div class="member-link">
1523
+ <a name="scope" href="#scope"><tt><b>scope</b></tt></a>
1524
+ </div>
1525
+ <div class="member-description hidden">
1526
+
1527
+ <div class="member-text">
1528
+ <p>The scope that this item belongs to, through its project.</p>
1529
+
1530
+ <p>Read only.</p>
1531
+
1532
+
1533
+
1534
+ <ul class="member-list">
1535
+ <h4>Type:</h4>
1536
+ <li>
1537
+ <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a>
1538
+ </li>
1539
+ </ul>
1540
+
1541
+
1542
+
1457
1543
  </div>
1458
1544
 
1459
1545
  </div>
@@ -1567,6 +1653,7 @@ console.log(group.children[0] == path); // true</code></pre>
1567
1653
 
1568
1654
  <div class="member-text">
1569
1655
  <p>The children items contained within this item. Items that define a <a href="../classes/Item.html#name"><tt>name</tt></a> can also be accessed by name.</p>
1656
+ <p>Only <a href="../classes/Group.html"><tt>Group</tt></a>, <a href="../classes/Layer.html"><tt>Layer</tt></a> and <a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a> items can have children. On all other items, such as <a href="../classes/Path.html"><tt>Path</tt></a>, <a href="../classes/Shape.html"><tt>Shape</tt></a>, <a href="../classes/Raster.html"><tt>Raster</tt></a>, <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> and <a href="../classes/PointText.html"><tt>PointText</tt></a>, <code>children</code> is <code>undefined</code>.</p>
1570
1657
  <p><b>Please note:</b> The children array should not be modified directly using array functions. To remove single items from the children list, use <a href="../classes/Item.html#remove"><tt>item.remove</tt></a>(), to remove all items from the children list, use <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>(). To add items to the children list, use <a href="../classes/Item.html#addchild-item"><tt>item.addChild(item)</tt></a> or <a href="../classes/Item.html#insertchild-index-item"><tt>item.insertChild(index, item)</tt></a>.</p>
1571
1658
 
1572
1659
 
@@ -2068,7 +2155,7 @@ path3.strokeJoin = 'bevel';
2068
2155
  <div class="member-description hidden">
2069
2156
 
2070
2157
  <div class="member-text">
2071
- <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>
2158
+ <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>
2072
2159
 
2073
2160
 
2074
2161
 
@@ -3507,22 +3594,22 @@ function onMouseDown(event) {
3507
3594
  <div class="member-description hidden">
3508
3595
  <div class="member-text">
3509
3596
  <p>Performs a hit-test on the item and its children (if it is a <a href="../classes/Group.html"><tt>Group</tt></a> or <a href="../classes/Layer.html"><tt>Layer</tt></a>) at the location of the specified point, returning the first found hit.</p>
3510
- <p>The options object allows you to control the specifics of the hit- test and may contain a combination of the following values:</p>
3597
+ <p>The options object allows you to control the specifics of the hit-test. Without options, <code>fill</code>, <code>stroke</code> and <code>segments</code> are hit-tested. As soon as an options object is passed, only the hit-tests that it sets to <code>true</code> are performed. It may contain a combination of the following values:</p>
3511
3598
  <ul class="member-list">
3512
3599
  <h4>Options:</h4>
3513
- <li><tt>options.tolerance: <tt>Number</tt></tt> &mdash; the tolerance of the hit-test &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.hitTolerance</tt></li>
3600
+ <li><tt>options.tolerance: <tt>Number</tt></tt> &mdash; the tolerance of the hit-test, in project coordinates &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.hitTolerance</tt></li>
3514
3601
  <li><tt>options.class: <tt>Function</tt></tt> &mdash; only hit-test against a specific item class, or any of its sub-classes, by providing the constructor function against which an <code>instanceof</code> check is performed: <tt>Group</tt>, <tt>Layer</tt>, <tt>Path</tt>, <tt>CompoundPath</tt>, <tt>Shape</tt>, <tt>Raster</tt>, <tt>SymbolItem</tt>, <tt>PointText</tt>, &hellip;</li>
3515
3602
  <li><tt>options.match: <tt>Function</tt></tt> &mdash; a match function to be called for each found hit result: Return <code>true</code> to return the result, <code>false</code> to keep searching</li>
3516
- <li><tt>options.fill: <tt>Boolean</tt></tt> &mdash; hit-test the fill of items &mdash;&nbsp;default: <tt>true</tt></li>
3517
- <li><tt>options.stroke: <tt>Boolean</tt></tt> &mdash; hit-test the stroke of path items, taking into account the setting of stroke color and width &mdash;&nbsp;default: <tt>true</tt></li>
3518
- <li><tt>options.segments: <tt>Boolean</tt></tt> &mdash; hit-test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of <a href="../classes/Path.html"><tt>Path</tt></a> items &mdash;&nbsp;default: <tt>true</tt></li>
3603
+ <li><tt>options.fill: <tt>Boolean</tt></tt> &mdash; hit-test the fill of items</li>
3604
+ <li><tt>options.stroke: <tt>Boolean</tt></tt> &mdash; hit-test the stroke of path items, taking into account the setting of stroke color and width</li>
3605
+ <li><tt>options.segments: <tt>Boolean</tt></tt> &mdash; hit-test for <a href="../classes/Segment.html#point"><tt>segment.point</tt></a> of <a href="../classes/Path.html"><tt>Path</tt></a> items</li>
3519
3606
  <li><tt>options.curves: <tt>Boolean</tt></tt> &mdash; hit-test the curves of path items, without taking the stroke color or width into account</li>
3520
3607
  <li><tt>options.handles: <tt>Boolean</tt></tt> &mdash; hit-test for the handles (<a href="../classes/Segment.html#handlein"><tt>segment.handleIn</tt></a> / <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a>) of path segments.</li>
3521
3608
  <li><tt>options.ends: <tt>Boolean</tt></tt> &mdash; only hit-test for the first or last segment points of open path items</li>
3522
3609
  <li><tt>options.position: <tt>Boolean</tt></tt> &mdash; hit-test the <a href="../classes/Item.html#position"><tt>item.position</tt></a> of of items, which depends on the setting of <a href="../classes/Item.html#pivot"><tt>item.pivot</tt></a></li>
3523
3610
  <li><tt>options.center: <tt>Boolean</tt></tt> &mdash; hit-test the <a href="../classes/Rectangle.html#center"><tt>rectangle.center</tt></a> of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>)</li>
3524
3611
  <li><tt>options.bounds: <tt>Boolean</tt></tt> &mdash; hit-test the corners and side-centers of the bounding rectangle of items (<a href="../classes/Item.html#bounds"><tt>item.bounds</tt></a>)</li>
3525
- <li><tt>options.guides: <tt>Boolean</tt></tt> &mdash; hit-test items that have <tt>Item#guide</tt> set to <code>true</code></li>
3612
+ <li><tt>options.guides: <tt>Boolean</tt></tt> &mdash; only hit-test items that have <a href="../classes/Item.html#guide"><tt>item.guide</tt></a> set to <code>true</code></li>
3526
3613
  <li><tt>options.selected: <tt>Boolean</tt></tt> &mdash; only hit selected items</li>
3527
3614
  </ul>
3528
3615
 
@@ -3761,7 +3848,7 @@ function onMouseDown(event) {
3761
3848
  <h4>Returns:</h4>
3762
3849
 
3763
3850
  <li>
3764
- <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the list of matching descendant items
3851
+ <tt>Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the list of matching descendant items, in their stacking order from bottom to top, with each item listed before its own descendants
3765
3852
  </li>
3766
3853
 
3767
3854
 
@@ -3934,6 +4021,8 @@ function onMouseDown(event) {
3934
4021
  <li><tt>options.precision: <tt>Number</tt></tt> &mdash; the amount of fractional digits in numbers used in SVG data &mdash;&nbsp;default: <tt>5</tt></li>
3935
4022
  <li><tt>options.matchShapes: <tt>Boolean</tt></tt> &mdash; whether path items should tried to be converted to SVG shape items (rect, circle, ellipse, line, polyline, polygon), if their geometries match &mdash;&nbsp;default: <tt>false</tt></li>
3936
4023
  <li><tt>options.embedImages: <tt>Boolean</tt></tt> &mdash; whether raster images should be embedded as base64 data inlined in the xlink:href attribute, or kept as a link to their external URL. &mdash;&nbsp;default: <tt>true</tt></li>
4024
+ <li><tt>options.reuseImages: <tt>Boolean</tt></tt> &mdash; whether raster images with the same content should only be exported once into the <code>&lt;defs&gt;</code> element, and placed through <code>&lt;use&gt;</code> elements referencing it &mdash;&nbsp;default: <tt>false</tt></li>
4025
+ <li><tt>options.idPrefix: <tt>String</tt></tt> &mdash; a prefix for the ids generated for definitions such as gradients, clip paths and symbols, to keep them unique when several exported SVGs are placed in one document &mdash;&nbsp;default: <tt>&rsquo;&rsquo;</tt></li>
3937
4026
  <li><tt>options.reduceAttributes: <tt>Boolean</tt></tt> &mdash; wether to only include style attributes in the SVG output that differ from their parents, or to always include them (much faster but leading to redundancies). &mdash;&nbsp;default: <tt>true</tt></li>
3938
4027
  </ul>
3939
4028
 
@@ -3976,9 +4065,13 @@ function onMouseDown(event) {
3976
4065
  <div class="member-description hidden">
3977
4066
  <div class="member-text">
3978
4067
  <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
+ <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>
3979
4069
  <ul class="member-list">
3980
4070
  <h4>Options:</h4>
3981
4071
  <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>
4072
+ <li>[options.crossOrigin] {String} the {@link Raster#crossOrigin}
4073
+ value of the rasters created for `<image>` elements, to load their
4074
+ images with CORS</li>
3982
4075
  <li><tt>options.onLoad: <tt>Function</tt></tt> &mdash; the callback function to call once the SVG content is loaded from the given URL receiving two arguments: the converted <code>item</code> and the original <code>svg</code> data as a string. Only required when loading from external resources.</li>
3983
4076
  <li><tt>options.onError: <tt>Function</tt></tt> &mdash; the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
3984
4077
  <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the imported items should be added to the item that <code>importSVG()</code> is called on &mdash;&nbsp;default: <tt>true</tt></li>
@@ -4454,9 +4547,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4454
4547
  </div>
4455
4548
 
4456
4549
 
4457
- <div id="reduce-options" class="member">
4550
+ <div id="reduce" class="member">
4458
4551
  <div class="member-link">
4459
- <a name="reduce-options" href="#reduce-options"><tt><b>reduce</b>(options)</tt></a>
4552
+ <a name="reduce" href="#reduce"><tt><b>reduce</b>([options])</tt></a>
4460
4553
  </div>
4461
4554
  <div class="member-description hidden">
4462
4555
  <div class="member-text">
@@ -4468,9 +4561,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4468
4561
 
4469
4562
  <li>
4470
4563
  <tt>options:</tt>
4471
-
4472
-
4473
-
4564
+ <tt>Object</tt>
4565
+ &mdash;&nbsp;the options passed on to <a href="../classes/Path.html#reduce-options"><tt>path.reduce(options)</tt></a>
4566
+ &mdash;&nbsp;optional
4474
4567
  </li>
4475
4568
 
4476
4569
  </ul>
@@ -4712,7 +4805,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4712
4805
  </div>
4713
4806
  <div class="member-description hidden">
4714
4807
  <div class="member-text">
4715
- <p>Checks whether the item has a fill.</p>
4808
+ <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>
4716
4809
 
4717
4810
 
4718
4811
 
@@ -4720,7 +4813,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4720
4813
  <h4>Returns:</h4>
4721
4814
 
4722
4815
  <li>
4723
- <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a fill, <tt>false</tt> otherwise
4816
+ <tt><tt>Boolean</tt></tt>&nbsp;&mdash;&nbsp;<tt>true</tt> if the item has a visible fill, <tt>false</tt> otherwise
4724
4817
  </li>
4725
4818
 
4726
4819
 
@@ -4859,7 +4952,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4859
4952
  </div>
4860
4953
  <div class="member-description hidden">
4861
4954
  <div class="member-text">
4862
- <p>Checks if this item is above the specified item in the stacking order of the project.</p>
4955
+ <p>Checks if this item is above the specified item in the stacking order of the project. If one item is a descendant of the other, neither is above the other and <code>false</code> is returned.</p>
4863
4956
 
4864
4957
 
4865
4958
  <ul class="member-list">
@@ -4900,7 +4993,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4900
4993
  </div>
4901
4994
  <div class="member-description hidden">
4902
4995
  <div class="member-text">
4903
- <p>Checks if the item is below the specified item in the stacking order of the project.</p>
4996
+ <p>Checks if the item is below the specified item in the stacking order of the project. If one item is a descendant of the other, neither is below the other and <code>false</code> is returned.</p>
4904
4997
 
4905
4998
 
4906
4999
  <ul class="member-list">
@@ -5858,11 +5951,11 @@ circle.scale(3, 1);
5858
5951
 
5859
5952
  <div id="fitbounds-rectangle" class="member">
5860
5953
  <div class="member-link">
5861
- <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fill])</tt></a>
5954
+ <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fit])</tt></a>
5862
5955
  </div>
5863
5956
  <div class="member-description hidden">
5864
5957
  <div class="member-text">
5865
- <p>Transform the item so that its <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> fit within the specified rectangle, without changing its aspect ratio.</p>
5958
+ <p>Transform the item so that its <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> are centered in the specified rectangle and fitted to it as described by <code>fit</code>.</p>
5866
5959
 
5867
5960
 
5868
5961
  <ul class="member-list">
@@ -5876,10 +5969,10 @@ circle.scale(3, 1);
5876
5969
  </li>
5877
5970
 
5878
5971
  <li>
5879
- <tt>fill:</tt>
5880
- <tt>Boolean</tt>
5881
-
5882
- &mdash;&nbsp;optional, default: <tt>false</tt>
5972
+ <tt>fit:</tt>
5973
+ <tt>String</tt>⟋<tt>Boolean</tt>
5974
+ &mdash;&nbsp;how to fit the item, as in CSS&rsquo;s <code>object-fit</code>: <code>&#39;contain&#39;</code> fits all of it within the rectangle, <code>&#39;cover&#39;</code> makes it cover the whole rectangle, and <code>&#39;fill&#39;</code> stretches it to the rectangle, changing its aspect ratio. The deprecated <code>true</code> and <code>false</code> stand for <code>&#39;cover&#39;</code> and <code>&#39;contain&#39;</code>.
5975
+ &mdash;&nbsp;optional, default: <tt>&lsquo;contain&rsquo;</tt>
5883
5976
  </li>
5884
5977
 
5885
5978
  </ul>
@@ -5921,7 +6014,7 @@ circlePath.fitBounds(path.bounds);
5921
6014
  </div>
5922
6015
 
5923
6016
 
5924
- <h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle with the fill parameter set to true:</span></h4>
6017
+ <h4>Example:<span class="description">Fitting an item to the bounding rectangle of another item's bounding rectangle, covering all of it:</span></h4>
5925
6018
 
5926
6019
  <div class="paperscript split">
5927
6020
 
@@ -5948,7 +6041,7 @@ var circlePath = new Path.Circle({
5948
6041
 
5949
6042
  // Fit the circlePath to the bounding rectangle of
5950
6043
  // the rectangular path:
5951
- circlePath.fitBounds(path.bounds, true);
6044
+ circlePath.fitBounds(path.bounds, 'cover');
5952
6045
  </script>
5953
6046
  <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
5954
6047
  </div>
@@ -6598,7 +6691,7 @@ function onMouseDown(event) {
6598
6691
  <ul class="member-list">
6599
6692
  <h4>Options:</h4>
6600
6693
  <li><tt>options.duration: <tt>Number</tt></tt> &mdash; the duration of the tweening</li>
6601
- <li><tt>options.easing: <tt>Function</tt>⟋<tt>String</tt></tt> &mdash; an easing function or the type of the easing: <tt>&lsquo;linear&rsquo; &lsquo;easeInQuad&rsquo; &lsquo;easeOutQuad&rsquo; &lsquo;easeInOutQuad&rsquo; &lsquo;easeInCubic&rsquo; &lsquo;easeOutCubic&rsquo; &lsquo;easeInOutCubic&rsquo; &lsquo;easeInQuart&rsquo; &lsquo;easeOutQuart&rsquo; &lsquo;easeInOutQuart&rsquo; &lsquo;easeInQuint&rsquo; &lsquo;easeOutQuint&rsquo; &lsquo;easeInOutQuint&rsquo;</tt> &mdash;&nbsp;default: <tt>&lsquo;linear&rsquo;</tt></li>
6694
+ <li><tt>options.easing: <tt>Function</tt>⟋<tt>String</tt></tt> &mdash; an easing function or the type of the easing: <tt>&lsquo;linear&rsquo; &lsquo;easeInQuad&rsquo; &lsquo;easeOutQuad&rsquo; &lsquo;easeInOutQuad&rsquo; &lsquo;easeInCubic&rsquo; &lsquo;easeOutCubic&rsquo; &lsquo;easeInOutCubic&rsquo; &lsquo;easeInQuart&rsquo; &lsquo;easeOutQuart&rsquo; &lsquo;easeInOutQuart&rsquo; &lsquo;easeInQuint&rsquo; &lsquo;easeOutQuint&rsquo; &lsquo;easeInOutQuint&rsquo; &lsquo;easeInSine&rsquo; &lsquo;easeOutSine&rsquo; &lsquo;easeInOutSine&rsquo; &lsquo;easeInExpo&rsquo; &lsquo;easeOutExpo&rsquo; &lsquo;easeInOutExpo&rsquo; &lsquo;easeInCirc&rsquo; &lsquo;easeOutCirc&rsquo; &lsquo;easeInOutCirc&rsquo;</tt> &mdash;&nbsp;default: <tt>&lsquo;linear&rsquo;</tt></li>
6602
6695
  <li><tt>options.start: <tt>Boolean</tt></tt> &mdash; whether to start tweening automatically &mdash;&nbsp;default: <tt>true</tt></li>
6603
6696
  </ul>
6604
6697
 
@@ -7130,7 +7223,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7130
7223
 
7131
7224
 
7132
7225
 
7133
-
7226
+ <h4>Example:</h4>
7227
+
7228
+ <div class="paperscript split">
7229
+
7230
+ <div class="buttons">
7231
+ <div class="button run">Run</div>
7232
+ </div>
7233
+
7234
+ <script type="text/paperscript" canvas="canvas-61">
7235
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7236
+ .unite(new Path.Circle([50, 50], 25));
7237
+ result.fillColor = 'red';
7238
+ </script>
7239
+ <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
7240
+ </div>
7241
+
7242
+
7134
7243
  </div>
7135
7244
  </div>
7136
7245
  </div>
@@ -7182,7 +7291,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7182
7291
 
7183
7292
 
7184
7293
 
7185
-
7294
+ <h4>Example:</h4>
7295
+
7296
+ <div class="paperscript split">
7297
+
7298
+ <div class="buttons">
7299
+ <div class="button run">Run</div>
7300
+ </div>
7301
+
7302
+ <script type="text/paperscript" canvas="canvas-62">
7303
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7304
+ .intersect(new Path.Circle([50, 50], 25));
7305
+ result.fillColor = 'red';
7306
+ </script>
7307
+ <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7308
+ </div>
7309
+
7310
+
7186
7311
  </div>
7187
7312
  </div>
7188
7313
  </div>
@@ -7234,7 +7359,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7234
7359
 
7235
7360
 
7236
7361
 
7237
-
7362
+ <h4>Example:</h4>
7363
+
7364
+ <div class="paperscript split">
7365
+
7366
+ <div class="buttons">
7367
+ <div class="button run">Run</div>
7368
+ </div>
7369
+
7370
+ <script type="text/paperscript" canvas="canvas-63">
7371
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7372
+ .subtract(new Path.Circle([50, 50], 25));
7373
+ result.fillColor = 'red';
7374
+ </script>
7375
+ <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7376
+ </div>
7377
+
7378
+
7238
7379
  </div>
7239
7380
  </div>
7240
7381
  </div>
@@ -7285,7 +7426,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7285
7426
 
7286
7427
 
7287
7428
 
7288
-
7429
+ <h4>Example:</h4>
7430
+
7431
+ <div class="paperscript split">
7432
+
7433
+ <div class="buttons">
7434
+ <div class="button run">Run</div>
7435
+ </div>
7436
+
7437
+ <script type="text/paperscript" canvas="canvas-64">
7438
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7439
+ .exclude(new Path.Circle([50, 50], 25));
7440
+ result.fillColor = 'red';
7441
+ </script>
7442
+ <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7443
+ </div>
7444
+
7445
+
7289
7446
  </div>
7290
7447
  </div>
7291
7448
  </div>
@@ -7393,9 +7550,9 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7393
7550
 
7394
7551
  <h3>Path Intersections and Locations</h3>
7395
7552
 
7396
- <div id="getintersections-path" class="member">
7553
+ <div id="getintersections" class="member">
7397
7554
  <div class="member-link">
7398
- <a name="getintersections-path" href="#getintersections-path"><tt><b>getIntersections</b>(path[, include])</tt></a>
7555
+ <a name="getintersections" href="#getintersections"><tt><b>getIntersections</b>([path[, include]])</tt></a>
7399
7556
  </div>
7400
7557
  <div class="member-description hidden">
7401
7558
  <div class="member-text">
@@ -7409,7 +7566,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7409
7566
  <tt>path:</tt>
7410
7567
  <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7411
7568
  &mdash;&nbsp;the other item to find the intersections with
7412
-
7569
+ &mdash;&nbsp;optional
7413
7570
  </li>
7414
7571
 
7415
7572
  <li>
@@ -7450,7 +7607,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7450
7607
  <div class="button run">Run</div>
7451
7608
  </div>
7452
7609
 
7453
- <script type="text/paperscript" canvas="canvas-61">
7610
+ <script type="text/paperscript" canvas="canvas-65">
7454
7611
  var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
7455
7612
  path.strokeColor = 'black';
7456
7613
 
@@ -7473,7 +7630,7 @@ function onFrame(event) {
7473
7630
  }
7474
7631
  }
7475
7632
  </script>
7476
- <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
7633
+ <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
7477
7634
  </div>
7478
7635
 
7479
7636
 
@@ -7614,7 +7771,7 @@ function onFrame(event) {
7614
7771
  <div class="button run">Run</div>
7615
7772
  </div>
7616
7773
 
7617
- <script type="text/paperscript" canvas="canvas-62">
7774
+ <script type="text/paperscript" canvas="canvas-66">
7618
7775
  var star = new Path.Star({
7619
7776
  center: view.center,
7620
7777
  points: 10,
@@ -7638,7 +7795,7 @@ function onMouseMove(event) {
7638
7795
  circle.position = nearestPoint;
7639
7796
  }
7640
7797
  </script>
7641
- <div class="canvas"><canvas width="516" height="200" id="canvas-62"></canvas></div>
7798
+ <div class="canvas"><canvas width="516" height="200" id="canvas-66"></canvas></div>
7642
7799
  </div>
7643
7800
 
7644
7801
 
@@ -7701,7 +7858,7 @@ function onMouseMove(event) {
7701
7858
  <div class="button run">Run</div>
7702
7859
  </div>
7703
7860
 
7704
- <script type="text/paperscript" canvas="canvas-63">
7861
+ <script type="text/paperscript" canvas="canvas-67">
7705
7862
  // Create a circle shaped path at { x: 80, y: 50 }
7706
7863
  // with a radius of 35:
7707
7864
  var path = new Path.Circle({
@@ -7719,7 +7876,7 @@ copy.position.x += 150;
7719
7876
  // Flatten the copied path, with a maximum error of 4 points:
7720
7877
  copy.flatten(4);
7721
7878
  </script>
7722
- <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7879
+ <div class="canvas"><canvas width="516" height="100" id="canvas-67"></canvas></div>
7723
7880
  </div>
7724
7881
 
7725
7882
 
@@ -7797,7 +7954,7 @@ copy.flatten(4);
7797
7954
  <div class="button run">Run</div>
7798
7955
  </div>
7799
7956
 
7800
- <script type="text/paperscript" canvas="canvas-64">
7957
+ <script type="text/paperscript" canvas="canvas-68">
7801
7958
  // Create a rectangular path with its top-left point at
7802
7959
  // {x: 30, y: 25} and a size of {width: 50, height: 50}:
7803
7960
  var path = new Path.Rectangle({
@@ -7816,7 +7973,7 @@ copy.position.x += 100;
7816
7973
  // Smooth the segments of the copy:
7817
7974
  copy.smooth({ type: 'continuous' });
7818
7975
  </script>
7819
- <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7976
+ <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
7820
7977
  </div>
7821
7978
 
7822
7979
 
@@ -7828,7 +7985,7 @@ copy.smooth({ type: 'continuous' });
7828
7985
  <div class="button run">Run</div>
7829
7986
  </div>
7830
7987
 
7831
- <script type="text/paperscript" canvas="canvas-65">
7988
+ <script type="text/paperscript" canvas="canvas-69">
7832
7989
  var path = new Path();
7833
7990
  path.strokeColor = 'black';
7834
7991
 
@@ -7853,7 +8010,7 @@ copy.fullySelected = true;
7853
8010
  // Smooth the path using centripetal Catmull-Rom splines:
7854
8011
  copy.smooth({ type: 'catmull-rom', factor: 0.5 });
7855
8012
  </script>
7856
- <div class="canvas"><canvas width="516" height="220" id="canvas-65"></canvas></div>
8013
+ <div class="canvas"><canvas width="516" height="220" id="canvas-69"></canvas></div>
7857
8014
  </div>
7858
8015
 
7859
8016
 
@@ -7865,7 +8022,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
7865
8022
  <div class="button run">Run</div>
7866
8023
  </div>
7867
8024
 
7868
- <script type="text/paperscript" canvas="canvas-66">
8025
+ <script type="text/paperscript" canvas="canvas-70">
7869
8026
  // Create 5 rectangles, next to each other:
7870
8027
  var paths = [];
7871
8028
  for (var i = 0; i < 5; i++) {
@@ -7895,7 +8052,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
7895
8052
  // Smooth a range, using negative indices:
7896
8053
  paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
7897
8054
  </script>
7898
- <div class="canvas"><canvas width="516" height="110" id="canvas-66"></canvas></div>
8055
+ <div class="canvas"><canvas width="516" height="110" id="canvas-70"></canvas></div>
7899
8056
  </div>
7900
8057
 
7901
8058
 
@@ -7948,7 +8105,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
7948
8105
  <div class="button run">Run</div>
7949
8106
  </div>
7950
8107
 
7951
- <script type="text/paperscript" canvas="canvas-67">
8108
+ <script type="text/paperscript" canvas="canvas-71">
7952
8109
  var path;
7953
8110
  function onMouseDown(event) {
7954
8111
  // If we already made a path before, deselect it:
@@ -7978,7 +8135,7 @@ function onMouseUp(event) {
7978
8135
  path.selected = true;
7979
8136
  }
7980
8137
  </script>
7981
- <div class="canvas"><canvas width="516" height="300" id="canvas-67"></canvas></div>
8138
+ <div class="canvas"><canvas width="516" height="300" id="canvas-71"></canvas></div>
7982
8139
  </div>
7983
8140
 
7984
8141
 
@@ -8177,7 +8334,7 @@ function onMouseUp(event) {
8177
8334
  <div class="button run">Run</div>
8178
8335
  </div>
8179
8336
 
8180
- <script type="text/paperscript" canvas="canvas-68">
8337
+ <script type="text/paperscript" canvas="canvas-72">
8181
8338
  var path = new Path();
8182
8339
  path.strokeColor = 'black';
8183
8340
 
@@ -8197,7 +8354,7 @@ path.arcTo(throughPoint, toPoint);
8197
8354
  var circle = new Path.Circle(throughPoint, 3);
8198
8355
  circle.fillColor = 'red';
8199
8356
  </script>
8200
- <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
8357
+ <div class="canvas"><canvas width="516" height="100" id="canvas-72"></canvas></div>
8201
8358
  </div>
8202
8359
 
8203
8360
 
@@ -8209,7 +8366,7 @@ circle.fillColor = 'red';
8209
8366
  <div class="button run">Run</div>
8210
8367
  </div>
8211
8368
 
8212
- <script type="text/paperscript" canvas="canvas-69">
8369
+ <script type="text/paperscript" canvas="canvas-73">
8213
8370
  var myPath;
8214
8371
  function onMouseDrag(event) {
8215
8372
  // If we created a path before, remove it:
@@ -8237,7 +8394,7 @@ function onMouseUp(event) {
8237
8394
  myPath.fillColor = 'black';
8238
8395
  }
8239
8396
  </script>
8240
- <div class="canvas"><canvas width="516" height="300" id="canvas-69"></canvas></div>
8397
+ <div class="canvas"><canvas width="516" height="300" id="canvas-73"></canvas></div>
8241
8398
  </div>
8242
8399
 
8243
8400
 
@@ -8286,7 +8443,7 @@ function onMouseUp(event) {
8286
8443
  <div class="button run">Run</div>
8287
8444
  </div>
8288
8445
 
8289
- <script type="text/paperscript" canvas="canvas-70">
8446
+ <script type="text/paperscript" canvas="canvas-74">
8290
8447
  var path = new Path();
8291
8448
  path.strokeColor = 'black';
8292
8449
 
@@ -8301,7 +8458,7 @@ path2.add(new Point(180, 25));
8301
8458
  // we pass `false` as the second argument to arcTo:
8302
8459
  path2.arcTo(new Point(280, 25), false);
8303
8460
  </script>
8304
- <div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
8461
+ <div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
8305
8462
  </div>
8306
8463
 
8307
8464
 
@@ -8313,7 +8470,7 @@ path2.arcTo(new Point(280, 25), false);
8313
8470
  <div class="button run">Run</div>
8314
8471
  </div>
8315
8472
 
8316
- <script type="text/paperscript" canvas="canvas-71">
8473
+ <script type="text/paperscript" canvas="canvas-75">
8317
8474
  var myPath;
8318
8475
 
8319
8476
  // The mouse has to move at least 20 points before
@@ -8334,7 +8491,7 @@ function onMouseDrag(event) {
8334
8491
  myPath.arcTo(event.point);
8335
8492
  }
8336
8493
  </script>
8337
- <div class="canvas"><canvas width="516" height="300" id="canvas-71"></canvas></div>
8494
+ <div class="canvas"><canvas width="516" height="300" id="canvas-75"></canvas></div>
8338
8495
  </div>
8339
8496
 
8340
8497
 
@@ -8390,7 +8547,7 @@ function onMouseDrag(event) {
8390
8547
  <div class="button run">Run</div>
8391
8548
  </div>
8392
8549
 
8393
- <script type="text/paperscript" canvas="canvas-72">
8550
+ <script type="text/paperscript" canvas="canvas-76">
8394
8551
  var myPath;
8395
8552
  function onMouseMove(event) {
8396
8553
  // If we created a path before, remove it:
@@ -8411,7 +8568,7 @@ function onMouseMove(event) {
8411
8568
  myPath.selected = true;
8412
8569
  }
8413
8570
  </script>
8414
- <div class="canvas"><canvas width="516" height="300" id="canvas-72"></canvas></div>
8571
+ <div class="canvas"><canvas width="516" height="300" id="canvas-76"></canvas></div>
8415
8572
  </div>
8416
8573
 
8417
8574
 
@@ -8596,7 +8753,7 @@ function onMouseMove(event) {
8596
8753
  <div class="button run">Run</div>
8597
8754
  </div>
8598
8755
 
8599
- <script type="text/paperscript" canvas="canvas-73">
8756
+ <script type="text/paperscript" canvas="canvas-77">
8600
8757
  var path = new Path();
8601
8758
  path.strokeColor = 'black';
8602
8759
 
@@ -8610,7 +8767,7 @@ path.lineBy(50, 0);
8610
8767
  // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
8611
8768
  path.lineBy(0, 50);
8612
8769
  </script>
8613
- <div class="canvas"><canvas width="516" height="100" id="canvas-73"></canvas></div>
8770
+ <div class="canvas"><canvas width="516" height="100" id="canvas-77"></canvas></div>
8614
8771
  </div>
8615
8772
 
8616
8773
 
@@ -8622,7 +8779,7 @@ path.lineBy(0, 50);
8622
8779
  <div class="button run">Run</div>
8623
8780
  </div>
8624
8781
 
8625
- <script type="text/paperscript" canvas="canvas-74">
8782
+ <script type="text/paperscript" canvas="canvas-78">
8626
8783
  var path = new Path();
8627
8784
  path.strokeColor = 'black';
8628
8785
 
@@ -8648,7 +8805,7 @@ path.smooth();
8648
8805
  // the construction of the path:
8649
8806
  // path.selected = true;
8650
8807
  </script>
8651
- <div class="canvas"><canvas width="516" height="300" id="canvas-74"></canvas></div>
8808
+ <div class="canvas"><canvas width="516" height="300" id="canvas-78"></canvas></div>
8652
8809
  </div>
8653
8810
 
8654
8811
 
@@ -8867,7 +9024,7 @@ path.smooth();
8867
9024
 
8868
9025
  <!-- =========================== copyright notice ========================== -->
8869
9026
  <p class="footer">
8870
- Paper.js v0.12.20<br>
9027
+ Paper.js v0.14.0<br>
8871
9028
  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>
8872
9029
  <div class="content-end"></div>
8873
9030