paper 0.12.20 → 0.13.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 (51) hide show
  1. package/CHANGELOG.md +233 -0
  2. package/README.md +29 -13
  3. package/dist/docs/assets/js/paper.js +788 -365
  4. package/dist/docs/classes/Color.html +63 -47
  5. package/dist/docs/classes/CompoundPath.html +162 -59
  6. package/dist/docs/classes/Curve.html +9 -7
  7. package/dist/docs/classes/CurveLocation.html +1 -1
  8. package/dist/docs/classes/Event.html +1 -1
  9. package/dist/docs/classes/Gradient.html +1 -1
  10. package/dist/docs/classes/GradientStop.html +1 -1
  11. package/dist/docs/classes/Group.html +63 -24
  12. package/dist/docs/classes/HitResult.html +1 -1
  13. package/dist/docs/classes/Item.html +63 -24
  14. package/dist/docs/classes/Key.html +1 -1
  15. package/dist/docs/classes/KeyEvent.html +1 -1
  16. package/dist/docs/classes/Layer.html +63 -24
  17. package/dist/docs/classes/Matrix.html +1 -1
  18. package/dist/docs/classes/MouseEvent.html +1 -1
  19. package/dist/docs/classes/PaperScope.html +87 -1
  20. package/dist/docs/classes/PaperScript.html +1 -1
  21. package/dist/docs/classes/Path.html +174 -68
  22. package/dist/docs/classes/PathItem.html +280 -177
  23. package/dist/docs/classes/Point.html +143 -21
  24. package/dist/docs/classes/PointText.html +94 -24
  25. package/dist/docs/classes/Project.html +14 -8
  26. package/dist/docs/classes/Raster.html +93 -35
  27. package/dist/docs/classes/Rectangle.html +12 -11
  28. package/dist/docs/classes/Segment.html +1 -1
  29. package/dist/docs/classes/Shape.html +63 -24
  30. package/dist/docs/classes/Size.html +81 -21
  31. package/dist/docs/classes/Style.html +34 -2
  32. package/dist/docs/classes/SymbolDefinition.html +1 -1
  33. package/dist/docs/classes/SymbolItem.html +64 -25
  34. package/dist/docs/classes/TextItem.html +94 -24
  35. package/dist/docs/classes/Tool.html +2 -1
  36. package/dist/docs/classes/ToolEvent.html +27 -1
  37. package/dist/docs/classes/Tween.html +1 -1
  38. package/dist/docs/classes/View.html +203 -10
  39. package/dist/docs/classes/global.html +1 -1
  40. package/dist/docs/classes/index.html +2 -2
  41. package/dist/docs/index.html +1 -1
  42. package/dist/node/canvas.js +1 -1
  43. package/dist/node/self.js +4 -3
  44. package/dist/paper-core.js +769 -354
  45. package/dist/paper-core.min.js +3 -3
  46. package/dist/paper-full.js +788 -365
  47. package/dist/paper-full.min.js +3 -3
  48. package/dist/paper.d.ts +324 -73
  49. package/examples/Rasters/Smoothing.html +1 -1
  50. package/package.json +1 -8
  51. package/dist/node/xml.js +0 -40
@@ -522,6 +522,7 @@ group.children['example'].fillColor = 'red';
522
522
 
523
523
  <div class="member-text">
524
524
  <p>The path style of the item.</p>
525
+ <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
526
 
526
527
 
527
528
 
@@ -864,6 +865,37 @@ circle2.opacity = 0.5;
864
865
  </div>
865
866
 
866
867
 
868
+ </div>
869
+
870
+ </div>
871
+ </div>
872
+
873
+
874
+ <div id="guide" class="member">
875
+ <div class="member-link">
876
+ <a name="guide" href="#guide"><tt><b>guide</b></tt></a>
877
+ </div>
878
+ <div class="member-description hidden">
879
+
880
+ <div class="member-text">
881
+ <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>
882
+
883
+
884
+
885
+ <ul class="member-list">
886
+ <h4>Default:</h4>
887
+ <li><tt>false</tt></li>
888
+ </ul>
889
+
890
+ <ul class="member-list">
891
+ <h4>Type:</h4>
892
+ <li>
893
+ <tt>Boolean</tt>
894
+ </li>
895
+ </ul>
896
+
897
+
898
+
867
899
  </div>
868
900
 
869
901
  </div>
@@ -1567,6 +1599,7 @@ console.log(group.children[0] == path); // true</code></pre>
1567
1599
 
1568
1600
  <div class="member-text">
1569
1601
  <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>
1602
+ <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
1603
  <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
1604
 
1572
1605
 
@@ -3507,22 +3540,22 @@ function onMouseDown(event) {
3507
3540
  <div class="member-description hidden">
3508
3541
  <div class="member-text">
3509
3542
  <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>
3543
+ <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
3544
  <ul class="member-list">
3512
3545
  <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>
3546
+ <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
3547
  <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
3548
  <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>
3549
+ <li><tt>options.fill: <tt>Boolean</tt></tt> &mdash; hit-test the fill of items</li>
3550
+ <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>
3551
+ <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
3552
  <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
3553
  <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
3554
  <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
3555
  <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
3556
  <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
3557
  <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>
3558
+ <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
3559
  <li><tt>options.selected: <tt>Boolean</tt></tt> &mdash; only hit selected items</li>
3527
3560
  </ul>
3528
3561
 
@@ -3761,7 +3794,7 @@ function onMouseDown(event) {
3761
3794
  <h4>Returns:</h4>
3762
3795
 
3763
3796
  <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
3797
+ <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
3798
  </li>
3766
3799
 
3767
3800
 
@@ -3934,6 +3967,8 @@ function onMouseDown(event) {
3934
3967
  <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
3968
  <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
3969
  <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>
3970
+ <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>
3971
+ <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
3972
  <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
3973
  </ul>
3939
3974
 
@@ -3976,9 +4011,13 @@ function onMouseDown(event) {
3976
4011
  <div class="member-description hidden">
3977
4012
  <div class="member-text">
3978
4013
  <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
+ <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
4015
  <ul class="member-list">
3980
4016
  <h4>Options:</h4>
3981
4017
  <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>
4018
+ <li>[options.crossOrigin] {String} the {@link Raster#crossOrigin}
4019
+ value of the rasters created for `<image>` elements, to load their
4020
+ images with CORS</li>
3982
4021
  <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
4022
  <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
4023
  <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 +4493,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4454
4493
  </div>
4455
4494
 
4456
4495
 
4457
- <div id="reduce-options" class="member">
4496
+ <div id="reduce" class="member">
4458
4497
  <div class="member-link">
4459
- <a name="reduce-options" href="#reduce-options"><tt><b>reduce</b>(options)</tt></a>
4498
+ <a name="reduce" href="#reduce"><tt><b>reduce</b>([options])</tt></a>
4460
4499
  </div>
4461
4500
  <div class="member-description hidden">
4462
4501
  <div class="member-text">
@@ -4468,9 +4507,9 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4468
4507
 
4469
4508
  <li>
4470
4509
  <tt>options:</tt>
4471
-
4472
-
4473
-
4510
+ <tt>Object</tt>
4511
+ &mdash;&nbsp;the options passed on to <a href="../classes/Path.html#reduce-options"><tt>path.reduce(options)</tt></a>
4512
+ &mdash;&nbsp;optional
4474
4513
  </li>
4475
4514
 
4476
4515
  </ul>
@@ -4859,7 +4898,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4859
4898
  </div>
4860
4899
  <div class="member-description hidden">
4861
4900
  <div class="member-text">
4862
- <p>Checks if this item is above the specified item in the stacking order of the project.</p>
4901
+ <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
4902
 
4864
4903
 
4865
4904
  <ul class="member-list">
@@ -4900,7 +4939,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
4900
4939
  </div>
4901
4940
  <div class="member-description hidden">
4902
4941
  <div class="member-text">
4903
- <p>Checks if the item is below the specified item in the stacking order of the project.</p>
4942
+ <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
4943
 
4905
4944
 
4906
4945
  <ul class="member-list">
@@ -5858,11 +5897,11 @@ circle.scale(3, 1);
5858
5897
 
5859
5898
  <div id="fitbounds-rectangle" class="member">
5860
5899
  <div class="member-link">
5861
- <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fill])</tt></a>
5900
+ <a name="fitbounds-rectangle" href="#fitbounds-rectangle"><tt><b>fitBounds</b>(rectangle[, fit])</tt></a>
5862
5901
  </div>
5863
5902
  <div class="member-description hidden">
5864
5903
  <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>
5904
+ <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
5905
 
5867
5906
 
5868
5907
  <ul class="member-list">
@@ -5876,10 +5915,10 @@ circle.scale(3, 1);
5876
5915
  </li>
5877
5916
 
5878
5917
  <li>
5879
- <tt>fill:</tt>
5880
- <tt>Boolean</tt>
5881
-
5882
- &mdash;&nbsp;optional, default: <tt>false</tt>
5918
+ <tt>fit:</tt>
5919
+ <tt>String</tt>⟋<tt>Boolean</tt>
5920
+ &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>.
5921
+ &mdash;&nbsp;optional, default: <tt>&lsquo;contain&rsquo;</tt>
5883
5922
  </li>
5884
5923
 
5885
5924
  </ul>
@@ -5921,7 +5960,7 @@ circlePath.fitBounds(path.bounds);
5921
5960
  </div>
5922
5961
 
5923
5962
 
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>
5963
+ <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
5964
 
5926
5965
  <div class="paperscript split">
5927
5966
 
@@ -5948,7 +5987,7 @@ var circlePath = new Path.Circle({
5948
5987
 
5949
5988
  // Fit the circlePath to the bounding rectangle of
5950
5989
  // the rectangular path:
5951
- circlePath.fitBounds(path.bounds, true);
5990
+ circlePath.fitBounds(path.bounds, 'cover');
5952
5991
  </script>
5953
5992
  <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
5954
5993
  </div>
@@ -6598,7 +6637,7 @@ function onMouseDown(event) {
6598
6637
  <ul class="member-list">
6599
6638
  <h4>Options:</h4>
6600
6639
  <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>
6640
+ <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
6641
  <li><tt>options.start: <tt>Boolean</tt></tt> &mdash; whether to start tweening automatically &mdash;&nbsp;default: <tt>true</tt></li>
6603
6642
  </ul>
6604
6643
 
@@ -7130,7 +7169,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7130
7169
 
7131
7170
 
7132
7171
 
7133
-
7172
+ <h4>Example:</h4>
7173
+
7174
+ <div class="paperscript split">
7175
+
7176
+ <div class="buttons">
7177
+ <div class="button run">Run</div>
7178
+ </div>
7179
+
7180
+ <script type="text/paperscript" canvas="canvas-61">
7181
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7182
+ .unite(new Path.Circle([50, 50], 25));
7183
+ result.fillColor = 'red';
7184
+ </script>
7185
+ <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
7186
+ </div>
7187
+
7188
+
7134
7189
  </div>
7135
7190
  </div>
7136
7191
  </div>
@@ -7182,7 +7237,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7182
7237
 
7183
7238
 
7184
7239
 
7185
-
7240
+ <h4>Example:</h4>
7241
+
7242
+ <div class="paperscript split">
7243
+
7244
+ <div class="buttons">
7245
+ <div class="button run">Run</div>
7246
+ </div>
7247
+
7248
+ <script type="text/paperscript" canvas="canvas-62">
7249
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7250
+ .intersect(new Path.Circle([50, 50], 25));
7251
+ result.fillColor = 'red';
7252
+ </script>
7253
+ <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7254
+ </div>
7255
+
7256
+
7186
7257
  </div>
7187
7258
  </div>
7188
7259
  </div>
@@ -7234,7 +7305,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7234
7305
 
7235
7306
 
7236
7307
 
7237
-
7308
+ <h4>Example:</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-63">
7317
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7318
+ .subtract(new Path.Circle([50, 50], 25));
7319
+ result.fillColor = 'red';
7320
+ </script>
7321
+ <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7322
+ </div>
7323
+
7324
+
7238
7325
  </div>
7239
7326
  </div>
7240
7327
  </div>
@@ -7285,7 +7372,23 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7285
7372
 
7286
7373
 
7287
7374
 
7288
-
7375
+ <h4>Example:</h4>
7376
+
7377
+ <div class="paperscript split">
7378
+
7379
+ <div class="buttons">
7380
+ <div class="button run">Run</div>
7381
+ </div>
7382
+
7383
+ <script type="text/paperscript" canvas="canvas-64">
7384
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7385
+ .exclude(new Path.Circle([50, 50], 25));
7386
+ result.fillColor = 'red';
7387
+ </script>
7388
+ <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7389
+ </div>
7390
+
7391
+
7289
7392
  </div>
7290
7393
  </div>
7291
7394
  </div>
@@ -7393,9 +7496,9 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7393
7496
 
7394
7497
  <h3>Path Intersections and Locations</h3>
7395
7498
 
7396
- <div id="getintersections-path" class="member">
7499
+ <div id="getintersections" class="member">
7397
7500
  <div class="member-link">
7398
- <a name="getintersections-path" href="#getintersections-path"><tt><b>getIntersections</b>(path[, include])</tt></a>
7501
+ <a name="getintersections" href="#getintersections"><tt><b>getIntersections</b>([path[, include]])</tt></a>
7399
7502
  </div>
7400
7503
  <div class="member-description hidden">
7401
7504
  <div class="member-text">
@@ -7409,7 +7512,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7409
7512
  <tt>path:</tt>
7410
7513
  <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7411
7514
  &mdash;&nbsp;the other item to find the intersections with
7412
-
7515
+ &mdash;&nbsp;optional
7413
7516
  </li>
7414
7517
 
7415
7518
  <li>
@@ -7450,7 +7553,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7450
7553
  <div class="button run">Run</div>
7451
7554
  </div>
7452
7555
 
7453
- <script type="text/paperscript" canvas="canvas-61">
7556
+ <script type="text/paperscript" canvas="canvas-65">
7454
7557
  var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
7455
7558
  path.strokeColor = 'black';
7456
7559
 
@@ -7473,7 +7576,7 @@ function onFrame(event) {
7473
7576
  }
7474
7577
  }
7475
7578
  </script>
7476
- <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
7579
+ <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
7477
7580
  </div>
7478
7581
 
7479
7582
 
@@ -7614,7 +7717,7 @@ function onFrame(event) {
7614
7717
  <div class="button run">Run</div>
7615
7718
  </div>
7616
7719
 
7617
- <script type="text/paperscript" canvas="canvas-62">
7720
+ <script type="text/paperscript" canvas="canvas-66">
7618
7721
  var star = new Path.Star({
7619
7722
  center: view.center,
7620
7723
  points: 10,
@@ -7638,7 +7741,7 @@ function onMouseMove(event) {
7638
7741
  circle.position = nearestPoint;
7639
7742
  }
7640
7743
  </script>
7641
- <div class="canvas"><canvas width="516" height="200" id="canvas-62"></canvas></div>
7744
+ <div class="canvas"><canvas width="516" height="200" id="canvas-66"></canvas></div>
7642
7745
  </div>
7643
7746
 
7644
7747
 
@@ -7701,7 +7804,7 @@ function onMouseMove(event) {
7701
7804
  <div class="button run">Run</div>
7702
7805
  </div>
7703
7806
 
7704
- <script type="text/paperscript" canvas="canvas-63">
7807
+ <script type="text/paperscript" canvas="canvas-67">
7705
7808
  // Create a circle shaped path at { x: 80, y: 50 }
7706
7809
  // with a radius of 35:
7707
7810
  var path = new Path.Circle({
@@ -7719,7 +7822,7 @@ copy.position.x += 150;
7719
7822
  // Flatten the copied path, with a maximum error of 4 points:
7720
7823
  copy.flatten(4);
7721
7824
  </script>
7722
- <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7825
+ <div class="canvas"><canvas width="516" height="100" id="canvas-67"></canvas></div>
7723
7826
  </div>
7724
7827
 
7725
7828
 
@@ -7797,7 +7900,7 @@ copy.flatten(4);
7797
7900
  <div class="button run">Run</div>
7798
7901
  </div>
7799
7902
 
7800
- <script type="text/paperscript" canvas="canvas-64">
7903
+ <script type="text/paperscript" canvas="canvas-68">
7801
7904
  // Create a rectangular path with its top-left point at
7802
7905
  // {x: 30, y: 25} and a size of {width: 50, height: 50}:
7803
7906
  var path = new Path.Rectangle({
@@ -7816,7 +7919,7 @@ copy.position.x += 100;
7816
7919
  // Smooth the segments of the copy:
7817
7920
  copy.smooth({ type: 'continuous' });
7818
7921
  </script>
7819
- <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7922
+ <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
7820
7923
  </div>
7821
7924
 
7822
7925
 
@@ -7828,7 +7931,7 @@ copy.smooth({ type: 'continuous' });
7828
7931
  <div class="button run">Run</div>
7829
7932
  </div>
7830
7933
 
7831
- <script type="text/paperscript" canvas="canvas-65">
7934
+ <script type="text/paperscript" canvas="canvas-69">
7832
7935
  var path = new Path();
7833
7936
  path.strokeColor = 'black';
7834
7937
 
@@ -7853,7 +7956,7 @@ copy.fullySelected = true;
7853
7956
  // Smooth the path using centripetal Catmull-Rom splines:
7854
7957
  copy.smooth({ type: 'catmull-rom', factor: 0.5 });
7855
7958
  </script>
7856
- <div class="canvas"><canvas width="516" height="220" id="canvas-65"></canvas></div>
7959
+ <div class="canvas"><canvas width="516" height="220" id="canvas-69"></canvas></div>
7857
7960
  </div>
7858
7961
 
7859
7962
 
@@ -7865,7 +7968,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
7865
7968
  <div class="button run">Run</div>
7866
7969
  </div>
7867
7970
 
7868
- <script type="text/paperscript" canvas="canvas-66">
7971
+ <script type="text/paperscript" canvas="canvas-70">
7869
7972
  // Create 5 rectangles, next to each other:
7870
7973
  var paths = [];
7871
7974
  for (var i = 0; i < 5; i++) {
@@ -7895,7 +7998,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
7895
7998
  // Smooth a range, using negative indices:
7896
7999
  paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
7897
8000
  </script>
7898
- <div class="canvas"><canvas width="516" height="110" id="canvas-66"></canvas></div>
8001
+ <div class="canvas"><canvas width="516" height="110" id="canvas-70"></canvas></div>
7899
8002
  </div>
7900
8003
 
7901
8004
 
@@ -7948,7 +8051,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
7948
8051
  <div class="button run">Run</div>
7949
8052
  </div>
7950
8053
 
7951
- <script type="text/paperscript" canvas="canvas-67">
8054
+ <script type="text/paperscript" canvas="canvas-71">
7952
8055
  var path;
7953
8056
  function onMouseDown(event) {
7954
8057
  // If we already made a path before, deselect it:
@@ -7978,7 +8081,7 @@ function onMouseUp(event) {
7978
8081
  path.selected = true;
7979
8082
  }
7980
8083
  </script>
7981
- <div class="canvas"><canvas width="516" height="300" id="canvas-67"></canvas></div>
8084
+ <div class="canvas"><canvas width="516" height="300" id="canvas-71"></canvas></div>
7982
8085
  </div>
7983
8086
 
7984
8087
 
@@ -8177,7 +8280,7 @@ function onMouseUp(event) {
8177
8280
  <div class="button run">Run</div>
8178
8281
  </div>
8179
8282
 
8180
- <script type="text/paperscript" canvas="canvas-68">
8283
+ <script type="text/paperscript" canvas="canvas-72">
8181
8284
  var path = new Path();
8182
8285
  path.strokeColor = 'black';
8183
8286
 
@@ -8197,7 +8300,7 @@ path.arcTo(throughPoint, toPoint);
8197
8300
  var circle = new Path.Circle(throughPoint, 3);
8198
8301
  circle.fillColor = 'red';
8199
8302
  </script>
8200
- <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
8303
+ <div class="canvas"><canvas width="516" height="100" id="canvas-72"></canvas></div>
8201
8304
  </div>
8202
8305
 
8203
8306
 
@@ -8209,7 +8312,7 @@ circle.fillColor = 'red';
8209
8312
  <div class="button run">Run</div>
8210
8313
  </div>
8211
8314
 
8212
- <script type="text/paperscript" canvas="canvas-69">
8315
+ <script type="text/paperscript" canvas="canvas-73">
8213
8316
  var myPath;
8214
8317
  function onMouseDrag(event) {
8215
8318
  // If we created a path before, remove it:
@@ -8237,7 +8340,7 @@ function onMouseUp(event) {
8237
8340
  myPath.fillColor = 'black';
8238
8341
  }
8239
8342
  </script>
8240
- <div class="canvas"><canvas width="516" height="300" id="canvas-69"></canvas></div>
8343
+ <div class="canvas"><canvas width="516" height="300" id="canvas-73"></canvas></div>
8241
8344
  </div>
8242
8345
 
8243
8346
 
@@ -8286,7 +8389,7 @@ function onMouseUp(event) {
8286
8389
  <div class="button run">Run</div>
8287
8390
  </div>
8288
8391
 
8289
- <script type="text/paperscript" canvas="canvas-70">
8392
+ <script type="text/paperscript" canvas="canvas-74">
8290
8393
  var path = new Path();
8291
8394
  path.strokeColor = 'black';
8292
8395
 
@@ -8301,7 +8404,7 @@ path2.add(new Point(180, 25));
8301
8404
  // we pass `false` as the second argument to arcTo:
8302
8405
  path2.arcTo(new Point(280, 25), false);
8303
8406
  </script>
8304
- <div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
8407
+ <div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
8305
8408
  </div>
8306
8409
 
8307
8410
 
@@ -8313,7 +8416,7 @@ path2.arcTo(new Point(280, 25), false);
8313
8416
  <div class="button run">Run</div>
8314
8417
  </div>
8315
8418
 
8316
- <script type="text/paperscript" canvas="canvas-71">
8419
+ <script type="text/paperscript" canvas="canvas-75">
8317
8420
  var myPath;
8318
8421
 
8319
8422
  // The mouse has to move at least 20 points before
@@ -8334,7 +8437,7 @@ function onMouseDrag(event) {
8334
8437
  myPath.arcTo(event.point);
8335
8438
  }
8336
8439
  </script>
8337
- <div class="canvas"><canvas width="516" height="300" id="canvas-71"></canvas></div>
8440
+ <div class="canvas"><canvas width="516" height="300" id="canvas-75"></canvas></div>
8338
8441
  </div>
8339
8442
 
8340
8443
 
@@ -8390,7 +8493,7 @@ function onMouseDrag(event) {
8390
8493
  <div class="button run">Run</div>
8391
8494
  </div>
8392
8495
 
8393
- <script type="text/paperscript" canvas="canvas-72">
8496
+ <script type="text/paperscript" canvas="canvas-76">
8394
8497
  var myPath;
8395
8498
  function onMouseMove(event) {
8396
8499
  // If we created a path before, remove it:
@@ -8411,7 +8514,7 @@ function onMouseMove(event) {
8411
8514
  myPath.selected = true;
8412
8515
  }
8413
8516
  </script>
8414
- <div class="canvas"><canvas width="516" height="300" id="canvas-72"></canvas></div>
8517
+ <div class="canvas"><canvas width="516" height="300" id="canvas-76"></canvas></div>
8415
8518
  </div>
8416
8519
 
8417
8520
 
@@ -8596,7 +8699,7 @@ function onMouseMove(event) {
8596
8699
  <div class="button run">Run</div>
8597
8700
  </div>
8598
8701
 
8599
- <script type="text/paperscript" canvas="canvas-73">
8702
+ <script type="text/paperscript" canvas="canvas-77">
8600
8703
  var path = new Path();
8601
8704
  path.strokeColor = 'black';
8602
8705
 
@@ -8610,7 +8713,7 @@ path.lineBy(50, 0);
8610
8713
  // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
8611
8714
  path.lineBy(0, 50);
8612
8715
  </script>
8613
- <div class="canvas"><canvas width="516" height="100" id="canvas-73"></canvas></div>
8716
+ <div class="canvas"><canvas width="516" height="100" id="canvas-77"></canvas></div>
8614
8717
  </div>
8615
8718
 
8616
8719
 
@@ -8622,7 +8725,7 @@ path.lineBy(0, 50);
8622
8725
  <div class="button run">Run</div>
8623
8726
  </div>
8624
8727
 
8625
- <script type="text/paperscript" canvas="canvas-74">
8728
+ <script type="text/paperscript" canvas="canvas-78">
8626
8729
  var path = new Path();
8627
8730
  path.strokeColor = 'black';
8628
8731
 
@@ -8648,7 +8751,7 @@ path.smooth();
8648
8751
  // the construction of the path:
8649
8752
  // path.selected = true;
8650
8753
  </script>
8651
- <div class="canvas"><canvas width="516" height="300" id="canvas-74"></canvas></div>
8754
+ <div class="canvas"><canvas width="516" height="300" id="canvas-78"></canvas></div>
8652
8755
  </div>
8653
8756
 
8654
8757
 
@@ -8867,7 +8970,7 @@ path.smooth();
8867
8970
 
8868
8971
  <!-- =========================== copyright notice ========================== -->
8869
8972
  <p class="footer">
8870
- Paper.js v0.12.20<br>
8973
+ Paper.js v0.13.0<br>
8871
8974
  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
8975
  <div class="content-end"></div>
8873
8976