paper 0.15.0 → 0.17.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 (64) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +24 -16
  3. package/dist/docs/assets/js/paper.js +4811 -808
  4. package/dist/docs/classes/AreaText.html +771 -243
  5. package/dist/docs/classes/ChangeFlag.html +1 -1
  6. package/dist/docs/classes/Color.html +218 -21
  7. package/dist/docs/classes/CompoundPath.html +1174 -274
  8. package/dist/docs/classes/Curve.html +2 -2
  9. package/dist/docs/classes/CurveLocation.html +1 -1
  10. package/dist/docs/classes/DrawEvent.html +69 -0
  11. package/dist/docs/classes/Effect.html +434 -0
  12. package/dist/docs/classes/EffectInstance.html +304 -0
  13. package/dist/docs/classes/Event.html +1 -1
  14. package/dist/docs/classes/Gradient.html +1 -1
  15. package/dist/docs/classes/GradientStop.html +1 -1
  16. package/dist/docs/classes/Group.html +842 -243
  17. package/dist/docs/classes/HitResult.html +1 -1
  18. package/dist/docs/classes/HostItem.html +770 -242
  19. package/dist/docs/classes/Item.html +827 -242
  20. package/dist/docs/classes/Key.html +1 -1
  21. package/dist/docs/classes/KeyEvent.html +1 -1
  22. package/dist/docs/classes/Layer.html +784 -185
  23. package/dist/docs/classes/Matrix.html +1 -1
  24. package/dist/docs/classes/MouseEvent.html +1 -1
  25. package/dist/docs/classes/PaperScope.html +1 -1
  26. package/dist/docs/classes/PaperScript.html +4 -2
  27. package/dist/docs/classes/Path.html +1366 -352
  28. package/dist/docs/classes/PathItem.html +1198 -298
  29. package/dist/docs/classes/PathText.html +772 -244
  30. package/dist/docs/classes/PatternDefinition.html +367 -0
  31. package/dist/docs/classes/Point.html +33 -5
  32. package/dist/docs/classes/PointText.html +771 -243
  33. package/dist/docs/classes/Project.html +251 -9
  34. package/dist/docs/classes/Raster.html +770 -242
  35. package/dist/docs/classes/Rectangle.html +50 -8
  36. package/dist/docs/classes/Segment.html +79 -2
  37. package/dist/docs/classes/Shape.html +770 -242
  38. package/dist/docs/classes/Size.html +31 -3
  39. package/dist/docs/classes/StrokeProfileStop.html +346 -0
  40. package/dist/docs/classes/Style.html +67 -6
  41. package/dist/docs/classes/SymbolDefinition.html +28 -2
  42. package/dist/docs/classes/SymbolItem.html +807 -242
  43. package/dist/docs/classes/TextItem.html +771 -243
  44. package/dist/docs/classes/TextRange.html +1 -1
  45. package/dist/docs/classes/TextStory.html +1 -1
  46. package/dist/docs/classes/Tool.html +2 -2
  47. package/dist/docs/classes/ToolEvent.html +1 -1
  48. package/dist/docs/classes/Tween.html +1 -1
  49. package/dist/docs/classes/View.html +2 -2
  50. package/dist/docs/classes/global.html +1 -1
  51. package/dist/docs/classes/index.html +2 -2
  52. package/dist/docs/index.html +1 -1
  53. package/dist/node/browser.js +15 -0
  54. package/dist/paper-core.js +4701 -728
  55. package/dist/paper-core.min.js +3 -3
  56. package/dist/paper-full.js +4811 -808
  57. package/dist/paper-full.min.js +3 -3
  58. package/dist/paper-hosted.js +5389 -892
  59. package/dist/paper.d.ts +1058 -69
  60. package/examples/Paperjs.org/LiveEffects.html +366 -0
  61. package/examples/Paperjs.org/Offsetting.html +379 -0
  62. package/examples/Paperjs.org/StrokeProfiles.html +706 -0
  63. package/examples/Scripts/Patterns.html +57 -0
  64. package/package.json +21 -11
@@ -404,6 +404,91 @@ path.fillColor = 'black';
404
404
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
405
405
 
406
406
 
407
+ <div id="effects" class="member">
408
+ <div class="member-link">
409
+ <a name="effects" href="#effects"><tt><b>effects</b></tt></a>
410
+ </div>
411
+ <div class="member-description hidden">
412
+
413
+ <div class="member-text">
414
+ <p>The live effects of the item, in the order in which they apply, as the instances of the <tt>Effecteffects</tt> that they use. They derive what is drawn from the item without changing it: drawing draws their output, and <a href="../classes/Item.html#previewbounds"><tt>previewBounds</tt></a> measures it, while hit testing, <a href="../classes/Item.html#bounds"><tt>bounds</tt></a> and <a href="../classes/Item.html#strokebounds"><tt>strokeBounds</tt></a> stay with the item itself. It is set to plain objects describing them, <code>{ type,
415
+ parameters, visible }</code>, with the <code>type</code> of the effect. Changing the returned array directly isn&rsquo;t tracked, as with <a href="../classes/Path.html#segments"><tt>path.segments</tt></a>.</p>
416
+ <p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
417
+ <ul>
418
+ <li><code>offset</code>: offsets the paths, see <a href="../classes/PathItem.html#offset"><tt>pathItem.offset</tt></a>(), with the parameters <code>distance</code> (<code>0</code>), <code>join</code> (<code>&#39;miter&#39;</code>) and <code>miterLimit</code> (<code>10</code>).</li>
419
+ <li><code>outline</code>: outlines the strokes of the paths as filled areas next to their fills, see <a href="../classes/PathItem.html#outline"><tt>pathItem.outline</tt></a>(), following their <a href="../classes/Path.html#strokeprofile"><tt>path.strokeProfile</tt></a>.</li>
420
+ </ul>
421
+
422
+
423
+
424
+ <ul class="member-list">
425
+ <h4>Type:</h4>
426
+ <li>
427
+ Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
428
+ </li>
429
+ </ul>
430
+
431
+
432
+ <h4>Example:</h4>
433
+
434
+ <div class="paperscript split">
435
+
436
+ <div class="buttons">
437
+ <div class="button run">Run</div>
438
+ </div>
439
+
440
+ <script type="text/paperscript" canvas="canvas-2">
441
+ var path = new Path.Star({
442
+ center: view.center,
443
+ points: 5,
444
+ radius1: 20,
445
+ radius2: 40,
446
+ strokeColor: 'black',
447
+ strokeWidth: 8
448
+ });
449
+ path.effects = [
450
+ { type: 'offset', parameters: { distance: 10, join: 'round' } },
451
+ { type: 'outline' }
452
+ ];
453
+ </script>
454
+ <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
455
+ </div>
456
+
457
+
458
+ </div>
459
+
460
+ </div>
461
+ </div>
462
+
463
+
464
+ <div id="previewbounds-matrix" class="member">
465
+ <div class="member-link">
466
+ <a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
467
+ </div>
468
+ <div class="member-description hidden">
469
+
470
+ <div class="member-text">
471
+ <p>The bounds of what the item looks like with its effects, in the coordinate space of its parent: of their output with its strokes, or of its children&rsquo;s with their effects, and its <a href="../classes/Item.html#strokebounds"><tt>strokeBounds</tt></a> without them, as Illustrator&rsquo;s &ldquo;Use Preview Bounds&rdquo;.</p>
472
+
473
+ <p>Read only.</p>
474
+
475
+
476
+
477
+ <ul class="member-list">
478
+ <h4>Type:</h4>
479
+ <li>
480
+ <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
481
+ </li>
482
+ </ul>
483
+
484
+
485
+
486
+ </div>
487
+
488
+ </div>
489
+ </div>
490
+
491
+
407
492
  <div id="key" class="member">
408
493
  <div class="member-link">
409
494
  <a name="key" href="#key"><tt><b>key</b></tt></a>
@@ -516,7 +601,7 @@ path.fillColor = 'black';
516
601
  <div class="button run">Run</div>
517
602
  </div>
518
603
 
519
- <script type="text/paperscript" canvas="canvas-2">
604
+ <script type="text/paperscript" canvas="canvas-3">
520
605
  var path = new Path.Circle({
521
606
  center: [80, 50],
522
607
  radius: 35
@@ -531,7 +616,7 @@ group.addChild(path);
531
616
  // The path can be accessed by name:
532
617
  group.children['example'].fillColor = 'red';
533
618
  </script>
534
- <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
619
+ <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
535
620
  </div>
536
621
 
537
622
 
@@ -569,7 +654,7 @@ group.children['example'].fillColor = 'red';
569
654
  <div class="button run">Run</div>
570
655
  </div>
571
656
 
572
- <script type="text/paperscript" canvas="canvas-3">
657
+ <script type="text/paperscript" canvas="canvas-4">
573
658
  var circle = new Path.Circle({
574
659
  center: [80, 50],
575
660
  radius: 30
@@ -580,7 +665,7 @@ circle.style = {
580
665
  strokeWidth: 5
581
666
  };
582
667
  </script>
583
- <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
668
+ <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
584
669
  </div>
585
670
 
586
671
 
@@ -592,7 +677,7 @@ circle.style = {
592
677
  <div class="button run">Run</div>
593
678
  </div>
594
679
 
595
- <script type="text/paperscript" canvas="canvas-4">
680
+ <script type="text/paperscript" canvas="canvas-5">
596
681
  var path = new Path.Circle({
597
682
  center: [50, 50],
598
683
  radius: 30,
@@ -607,7 +692,7 @@ var path2 = new Path.Circle({
607
692
  // Copy the path style of path:
608
693
  path2.style = path.style;
609
694
  </script>
610
- <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
695
+ <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
611
696
  </div>
612
697
 
613
698
 
@@ -619,7 +704,7 @@ path2.style = path.style;
619
704
  <div class="button run">Run</div>
620
705
  </div>
621
706
 
622
- <script type="text/paperscript" canvas="canvas-5">
707
+ <script type="text/paperscript" canvas="canvas-6">
623
708
  var myStyle = {
624
709
  fillColor: 'red',
625
710
  strokeColor: 'blue',
@@ -638,7 +723,7 @@ var path2 = new Path.Circle({
638
723
  });
639
724
  path2.style = myStyle;
640
725
  </script>
641
- <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
726
+ <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
642
727
  </div>
643
728
 
644
729
 
@@ -680,7 +765,7 @@ path2.style = myStyle;
680
765
  <div class="button run">Run</div>
681
766
  </div>
682
767
 
683
- <script type="text/paperscript" canvas="canvas-6">
768
+ <script type="text/paperscript" canvas="canvas-7">
684
769
  var unlockedItem = new Path.Circle({
685
770
  center: view.center - [35, 0],
686
771
  radius: 30,
@@ -707,7 +792,7 @@ new PointText({
707
792
  justification: 'center'
708
793
  });
709
794
  </script>
710
- <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
795
+ <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
711
796
  </div>
712
797
 
713
798
 
@@ -749,7 +834,7 @@ new PointText({
749
834
  <div class="button run">Run</div>
750
835
  </div>
751
836
 
752
- <script type="text/paperscript" canvas="canvas-7">
837
+ <script type="text/paperscript" canvas="canvas-8">
753
838
  var path = new Path.Circle({
754
839
  center: [50, 50],
755
840
  radius: 20,
@@ -759,7 +844,7 @@ var path = new Path.Circle({
759
844
  // Hide the path:
760
845
  path.visible = false;
761
846
  </script>
762
- <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
847
+ <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
763
848
  </div>
764
849
 
765
850
 
@@ -807,7 +892,7 @@ path.visible = false;
807
892
  <div class="button run">Run</div>
808
893
  </div>
809
894
 
810
- <script type="text/paperscript" canvas="canvas-8">
895
+ <script type="text/paperscript" canvas="canvas-9">
811
896
  // Create a white rectangle in the background
812
897
  // with the same dimensions as the view:
813
898
  var background = new Path.Rectangle(view.bounds);
@@ -828,7 +913,7 @@ var circle2 = new Path.Circle({
828
913
  // Set the blend mode of circle2:
829
914
  circle2.blendMode = 'multiply';
830
915
  </script>
831
- <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
916
+ <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
832
917
  </div>
833
918
 
834
919
 
@@ -870,7 +955,7 @@ circle2.blendMode = 'multiply';
870
955
  <div class="button run">Run</div>
871
956
  </div>
872
957
 
873
- <script type="text/paperscript" canvas="canvas-9">
958
+ <script type="text/paperscript" canvas="canvas-10">
874
959
  var circle = new Path.Circle({
875
960
  center: [80, 50],
876
961
  radius: 35,
@@ -888,7 +973,7 @@ var circle2 = new Path.Circle({
888
973
  // Make circle2 50% transparent:
889
974
  circle2.opacity = 0.5;
890
975
  </script>
891
- <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
976
+ <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
892
977
  </div>
893
978
 
894
979
 
@@ -1011,14 +1096,14 @@ circle.textWrap = { offset: 10 };</code></pre>
1011
1096
  <div class="button run">Run</div>
1012
1097
  </div>
1013
1098
 
1014
- <script type="text/paperscript" canvas="canvas-10">
1099
+ <script type="text/paperscript" canvas="canvas-11">
1015
1100
  var path = new Path.Circle({
1016
1101
  center: [80, 50],
1017
1102
  radius: 35
1018
1103
  });
1019
1104
  path.selected = true; // Select the path
1020
1105
  </script>
1021
- <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
1106
+ <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
1022
1107
  </div>
1023
1108
 
1024
1109
 
@@ -1175,7 +1260,7 @@ console.log(path.data.pets.length); // 1</code></pre>
1175
1260
  <div class="button run">Run</div>
1176
1261
  </div>
1177
1262
 
1178
- <script type="text/paperscript" canvas="canvas-11">
1263
+ <script type="text/paperscript" canvas="canvas-12">
1179
1264
  // Create a circle at position { x: 10, y: 10 }
1180
1265
  var circle = new Path.Circle({
1181
1266
  center: new Point(10, 10),
@@ -1189,7 +1274,7 @@ circle.position = new Point(20, 20);
1189
1274
  // Move the circle 100 points to the right and 50 points down
1190
1275
  circle.position += new Point(100, 50);
1191
1276
  </script>
1192
- <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
1277
+ <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1193
1278
  </div>
1194
1279
 
1195
1280
 
@@ -1201,7 +1286,7 @@ circle.position += new Point(100, 50);
1201
1286
  <div class="button run">Run</div>
1202
1287
  </div>
1203
1288
 
1204
- <script type="text/paperscript" canvas="canvas-12">
1289
+ <script type="text/paperscript" canvas="canvas-13">
1205
1290
  // Create a circle at position { x: 20, y: 20 }
1206
1291
  var circle = new Path.Circle({
1207
1292
  center: new Point(20, 20),
@@ -1212,7 +1297,7 @@ var circle = new Path.Circle({
1212
1297
  // Move the circle 100 points to the right
1213
1298
  circle.position.x += 100;
1214
1299
  </script>
1215
- <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1300
+ <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1216
1301
  </div>
1217
1302
 
1218
1303
 
@@ -1738,7 +1823,7 @@ console.log(group.children[0] == path); // true</code></pre>
1738
1823
  <div class="button run">Run</div>
1739
1824
  </div>
1740
1825
 
1741
- <script type="text/paperscript" canvas="canvas-13">
1826
+ <script type="text/paperscript" canvas="canvas-14">
1742
1827
  var path = new Path.Circle({
1743
1828
  center: [80, 50],
1744
1829
  radius: 35
@@ -1751,7 +1836,7 @@ group.addChild(path);
1751
1836
  // Access the path through the group's children array:
1752
1837
  group.children[0].fillColor = 'red';
1753
1838
  </script>
1754
- <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1839
+ <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1755
1840
  </div>
1756
1841
 
1757
1842
 
@@ -1763,7 +1848,7 @@ group.children[0].fillColor = 'red';
1763
1848
  <div class="button run">Run</div>
1764
1849
  </div>
1765
1850
 
1766
- <script type="text/paperscript" canvas="canvas-14">
1851
+ <script type="text/paperscript" canvas="canvas-15">
1767
1852
  var path = new Path.Circle({
1768
1853
  center: [80, 50],
1769
1854
  radius: 35
@@ -1778,7 +1863,7 @@ group.addChild(path);
1778
1863
  // The path can be accessed by name:
1779
1864
  group.children['example'].fillColor = 'orange';
1780
1865
  </script>
1781
- <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1866
+ <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1782
1867
  </div>
1783
1868
 
1784
1869
 
@@ -1790,7 +1875,7 @@ group.children['example'].fillColor = 'orange';
1790
1875
  <div class="button run">Run</div>
1791
1876
  </div>
1792
1877
 
1793
- <script type="text/paperscript" canvas="canvas-15">
1878
+ <script type="text/paperscript" canvas="canvas-16">
1794
1879
  var path = new Path.Circle({
1795
1880
  center: [80, 50],
1796
1881
  radius: 35
@@ -1802,7 +1887,7 @@ group.children = [path];
1802
1887
  // The path is the first child of the group:
1803
1888
  group.firstChild.fillColor = 'green';
1804
1889
  </script>
1805
- <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1890
+ <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
1806
1891
  </div>
1807
1892
 
1808
1893
 
@@ -1979,7 +2064,7 @@ group.firstChild.fillColor = 'green';
1979
2064
  <div class="button run">Run</div>
1980
2065
  </div>
1981
2066
 
1982
- <script type="text/paperscript" canvas="canvas-16">
2067
+ <script type="text/paperscript" canvas="canvas-17">
1983
2068
  // Create a circle shaped path at { x: 80, y: 50 }
1984
2069
  // with a radius of 35:
1985
2070
  var circle = new Path.Circle({
@@ -1990,7 +2075,7 @@ var circle = new Path.Circle({
1990
2075
  // Set its stroke color to RGB red:
1991
2076
  circle.strokeColor = new Color(1, 0, 0);
1992
2077
  </script>
1993
- <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
2078
+ <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
1994
2079
  </div>
1995
2080
 
1996
2081
 
@@ -2027,7 +2112,7 @@ circle.strokeColor = new Color(1, 0, 0);
2027
2112
  <div class="button run">Run</div>
2028
2113
  </div>
2029
2114
 
2030
- <script type="text/paperscript" canvas="canvas-17">
2115
+ <script type="text/paperscript" canvas="canvas-18">
2031
2116
  // Create a circle shaped path at { x: 80, y: 50 }
2032
2117
  // with a radius of 35:
2033
2118
  var circle = new Path.Circle({
@@ -2039,7 +2124,7 @@ var circle = new Path.Circle({
2039
2124
  // Set its stroke width to 10:
2040
2125
  circle.strokeWidth = 10;
2041
2126
  </script>
2042
- <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
2127
+ <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
2043
2128
  </div>
2044
2129
 
2045
2130
 
@@ -2086,7 +2171,7 @@ circle.strokeWidth = 10;
2086
2171
  <div class="button run">Run</div>
2087
2172
  </div>
2088
2173
 
2089
- <script type="text/paperscript" canvas="canvas-18">
2174
+ <script type="text/paperscript" canvas="canvas-19">
2090
2175
  var line = new Path({
2091
2176
  segments: [[80, 50], [420, 50]],
2092
2177
  strokeColor: 'black',
@@ -2107,7 +2192,7 @@ var line2 = line.clone();
2107
2192
  line2.position.y += 100;
2108
2193
  line2.strokeCap = 'butt';
2109
2194
  </script>
2110
- <div class="canvas"><canvas width="516" height="200" id="canvas-18"></canvas></div>
2195
+ <div class="canvas"><canvas width="516" height="200" id="canvas-19"></canvas></div>
2111
2196
  </div>
2112
2197
 
2113
2198
 
@@ -2154,7 +2239,7 @@ line2.strokeCap = 'butt';
2154
2239
  <div class="button run">Run</div>
2155
2240
  </div>
2156
2241
 
2157
- <script type="text/paperscript" canvas="canvas-19">
2242
+ <script type="text/paperscript" canvas="canvas-20">
2158
2243
  var path = new Path({
2159
2244
  segments: [[80, 100], [120, 40], [160, 100]],
2160
2245
  strokeColor: 'black',
@@ -2171,7 +2256,7 @@ var path3 = path2.clone();
2171
2256
  path3.position.x += path3.bounds.width * 1.5;
2172
2257
  path3.strokeJoin = 'bevel';
2173
2258
  </script>
2174
- <div class="canvas"><canvas width="516" height="120" id="canvas-19"></canvas></div>
2259
+ <div class="canvas"><canvas width="516" height="120" id="canvas-20"></canvas></div>
2175
2260
  </div>
2176
2261
 
2177
2262
 
@@ -2275,7 +2360,7 @@ path3.strokeJoin = 'bevel';
2275
2360
  <div class="button run">Run</div>
2276
2361
  </div>
2277
2362
 
2278
- <script type="text/paperscript" canvas="canvas-20">
2363
+ <script type="text/paperscript" canvas="canvas-21">
2279
2364
  var path = new Path.Circle({
2280
2365
  center: [80, 50],
2281
2366
  radius: 40,
@@ -2286,7 +2371,7 @@ var path = new Path.Circle({
2286
2371
  // Set the dashed stroke to [10pt dash, 4pt gap]:
2287
2372
  path.dashArray = [10, 4];
2288
2373
  </script>
2289
- <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
2374
+ <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2290
2375
  </div>
2291
2376
 
2292
2377
 
@@ -2321,6 +2406,42 @@ path.dashArray = [10, 4];
2321
2406
 
2322
2407
 
2323
2408
 
2409
+ </div>
2410
+
2411
+ </div>
2412
+ </div>
2413
+
2414
+
2415
+ <div id="paintorder" class="member">
2416
+ <div class="member-link">
2417
+ <a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
2418
+ </div>
2419
+ <div class="member-description hidden">
2420
+
2421
+ <div class="member-text">
2422
+ <p>The order in which the fill and the stroke are painted, as in SVG&rsquo;s <code>paint-order</code>, named after what is painted first: <code>&#39;fill&#39;</code> paints the fill first, <code>&#39;stroke&#39;</code> paints the stroke first, so the fill covers its inner half.</p>
2423
+
2424
+
2425
+ <ul class="member-list">
2426
+ <h4>Values:</h4>
2427
+ <li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
2428
+ </ul>
2429
+
2430
+
2431
+ <ul class="member-list">
2432
+ <h4>Default:</h4>
2433
+ <li><tt>'fill'</tt></li>
2434
+ </ul>
2435
+
2436
+ <ul class="member-list">
2437
+ <h4>Type:</h4>
2438
+ <li>
2439
+ <tt>String</tt>
2440
+ </li>
2441
+ </ul>
2442
+
2443
+
2444
+
2324
2445
  </div>
2325
2446
 
2326
2447
  </div>
@@ -2356,7 +2477,7 @@ path.dashArray = [10, 4];
2356
2477
  <div class="button run">Run</div>
2357
2478
  </div>
2358
2479
 
2359
- <script type="text/paperscript" canvas="canvas-21">
2480
+ <script type="text/paperscript" canvas="canvas-22">
2360
2481
  // Create a circle shaped path at { x: 80, y: 50 }
2361
2482
  // with a radius of 35:
2362
2483
  var circle = new Path.Circle({
@@ -2367,7 +2488,7 @@ var circle = new Path.Circle({
2367
2488
  // Set the fill color of the circle to RGB red:
2368
2489
  circle.fillColor = new Color(1, 0, 0);
2369
2490
  </script>
2370
- <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2491
+ <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2371
2492
  </div>
2372
2493
 
2373
2494
 
@@ -2442,7 +2563,7 @@ circle.fillColor = new Color(1, 0, 0);
2442
2563
  <div class="button run">Run</div>
2443
2564
  </div>
2444
2565
 
2445
- <script type="text/paperscript" canvas="canvas-22">
2566
+ <script type="text/paperscript" canvas="canvas-23">
2446
2567
  var circle = new Path.Circle({
2447
2568
  center: [80, 50],
2448
2569
  radius: 35,
@@ -2455,7 +2576,7 @@ var circle = new Path.Circle({
2455
2576
  shadowOffset: new Point(5, 5)
2456
2577
  });
2457
2578
  </script>
2458
- <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2579
+ <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2459
2580
  </div>
2460
2581
 
2461
2582
 
@@ -2596,7 +2717,7 @@ var circle = new Path.Circle({
2596
2717
  <div class="button run">Run</div>
2597
2718
  </div>
2598
2719
 
2599
- <script type="text/paperscript" canvas="canvas-23">
2720
+ <script type="text/paperscript" canvas="canvas-24">
2600
2721
  // Create a rectangle shaped path with its top left point at:
2601
2722
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
2602
2723
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -2607,7 +2728,7 @@ path.onFrame = function(event) {
2607
2728
  this.rotate(3);
2608
2729
  }
2609
2730
  </script>
2610
- <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2731
+ <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
2611
2732
  </div>
2612
2733
 
2613
2734
 
@@ -2651,7 +2772,7 @@ path.onFrame = function(event) {
2651
2772
  <div class="button run">Run</div>
2652
2773
  </div>
2653
2774
 
2654
- <script type="text/paperscript" canvas="canvas-24">
2775
+ <script type="text/paperscript" canvas="canvas-25">
2655
2776
  // Create a circle shaped path at the center of the view:
2656
2777
  var path = new Path.Circle({
2657
2778
  center: view.center,
@@ -2665,7 +2786,7 @@ path.onMouseDown = function(event) {
2665
2786
  this.fillColor = 'red';
2666
2787
  }
2667
2788
  </script>
2668
- <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
2789
+ <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
2669
2790
  </div>
2670
2791
 
2671
2792
 
@@ -2677,7 +2798,7 @@ path.onMouseDown = function(event) {
2677
2798
  <div class="button run">Run</div>
2678
2799
  </div>
2679
2800
 
2680
- <script type="text/paperscript" canvas="canvas-25">
2801
+ <script type="text/paperscript" canvas="canvas-26">
2681
2802
  // Loop 30 times:
2682
2803
  for (var i = 0; i < 30; i++) {
2683
2804
  // Create a circle shaped path at a random position
@@ -2695,7 +2816,7 @@ for (var i = 0; i < 30; i++) {
2695
2816
  }
2696
2817
  }
2697
2818
  </script>
2698
- <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
2819
+ <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
2699
2820
  </div>
2700
2821
 
2701
2822
 
@@ -2739,7 +2860,7 @@ for (var i = 0; i < 30; i++) {
2739
2860
  <div class="button run">Run</div>
2740
2861
  </div>
2741
2862
 
2742
- <script type="text/paperscript" canvas="canvas-26">
2863
+ <script type="text/paperscript" canvas="canvas-27">
2743
2864
  // Create a circle shaped path at the center of the view:
2744
2865
  var path = new Path.Circle({
2745
2866
  center: view.center,
@@ -2752,7 +2873,7 @@ path.onMouseDrag = function(event) {
2752
2873
  path.position += event.delta;
2753
2874
  }
2754
2875
  </script>
2755
- <div class="canvas"><canvas width="516" height="240" id="canvas-26"></canvas></div>
2876
+ <div class="canvas"><canvas width="516" height="240" id="canvas-27"></canvas></div>
2756
2877
  </div>
2757
2878
 
2758
2879
 
@@ -2796,7 +2917,7 @@ path.onMouseDrag = function(event) {
2796
2917
  <div class="button run">Run</div>
2797
2918
  </div>
2798
2919
 
2799
- <script type="text/paperscript" canvas="canvas-27">
2920
+ <script type="text/paperscript" canvas="canvas-28">
2800
2921
  // Create a circle shaped path at the center of the view:
2801
2922
  var path = new Path.Circle({
2802
2923
  center: view.center,
@@ -2810,7 +2931,7 @@ path.onMouseUp = function(event) {
2810
2931
  this.fillColor = 'red';
2811
2932
  }
2812
2933
  </script>
2813
- <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
2934
+ <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
2814
2935
  </div>
2815
2936
 
2816
2937
 
@@ -2854,7 +2975,7 @@ path.onMouseUp = function(event) {
2854
2975
  <div class="button run">Run</div>
2855
2976
  </div>
2856
2977
 
2857
- <script type="text/paperscript" canvas="canvas-28">
2978
+ <script type="text/paperscript" canvas="canvas-29">
2858
2979
  // Create a circle shaped path at the center of the view:
2859
2980
  var path = new Path.Circle({
2860
2981
  center: view.center,
@@ -2868,7 +2989,7 @@ path.onClick = function(event) {
2868
2989
  this.fillColor = 'red';
2869
2990
  }
2870
2991
  </script>
2871
- <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
2992
+ <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
2872
2993
  </div>
2873
2994
 
2874
2995
 
@@ -2880,7 +3001,7 @@ path.onClick = function(event) {
2880
3001
  <div class="button run">Run</div>
2881
3002
  </div>
2882
3003
 
2883
- <script type="text/paperscript" canvas="canvas-29">
3004
+ <script type="text/paperscript" canvas="canvas-30">
2884
3005
  // Loop 30 times:
2885
3006
  for (var i = 0; i < 30; i++) {
2886
3007
  // Create a circle shaped path at a random position
@@ -2898,7 +3019,7 @@ for (var i = 0; i < 30; i++) {
2898
3019
  }
2899
3020
  }
2900
3021
  </script>
2901
- <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
3022
+ <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
2902
3023
  </div>
2903
3024
 
2904
3025
 
@@ -2942,7 +3063,7 @@ for (var i = 0; i < 30; i++) {
2942
3063
  <div class="button run">Run</div>
2943
3064
  </div>
2944
3065
 
2945
- <script type="text/paperscript" canvas="canvas-30">
3066
+ <script type="text/paperscript" canvas="canvas-31">
2946
3067
  // Create a circle shaped path at the center of the view:
2947
3068
  var path = new Path.Circle({
2948
3069
  center: view.center,
@@ -2956,7 +3077,7 @@ path.onDoubleClick = function(event) {
2956
3077
  this.fillColor = 'red';
2957
3078
  }
2958
3079
  </script>
2959
- <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
3080
+ <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
2960
3081
  </div>
2961
3082
 
2962
3083
 
@@ -2968,7 +3089,7 @@ path.onDoubleClick = function(event) {
2968
3089
  <div class="button run">Run</div>
2969
3090
  </div>
2970
3091
 
2971
- <script type="text/paperscript" canvas="canvas-31">
3092
+ <script type="text/paperscript" canvas="canvas-32">
2972
3093
  // Loop 30 times:
2973
3094
  for (var i = 0; i < 30; i++) {
2974
3095
  // Create a circle shaped path at a random position
@@ -2986,7 +3107,7 @@ for (var i = 0; i < 30; i++) {
2986
3107
  }
2987
3108
  }
2988
3109
  </script>
2989
- <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
3110
+ <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
2990
3111
  </div>
2991
3112
 
2992
3113
 
@@ -3030,7 +3151,7 @@ for (var i = 0; i < 30; i++) {
3030
3151
  <div class="button run">Run</div>
3031
3152
  </div>
3032
3153
 
3033
- <script type="text/paperscript" canvas="canvas-32">
3154
+ <script type="text/paperscript" canvas="canvas-33">
3034
3155
  // Create a circle shaped path at the center of the view:
3035
3156
  var path = new Path.Circle({
3036
3157
  center: view.center,
@@ -3044,7 +3165,7 @@ path.onMouseMove = function(event) {
3044
3165
  this.opacity = Math.random();
3045
3166
  }
3046
3167
  </script>
3047
- <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
3168
+ <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
3048
3169
  </div>
3049
3170
 
3050
3171
 
@@ -3088,7 +3209,7 @@ path.onMouseMove = function(event) {
3088
3209
  <div class="button run">Run</div>
3089
3210
  </div>
3090
3211
 
3091
- <script type="text/paperscript" canvas="canvas-33">
3212
+ <script type="text/paperscript" canvas="canvas-34">
3092
3213
  // Create a circle shaped path at the center of the view:
3093
3214
  var path = new Path.Circle({
3094
3215
  center: view.center,
@@ -3106,7 +3227,7 @@ path.onMouseLeave = function(event) {
3106
3227
  this.fillColor = 'black';
3107
3228
  }
3108
3229
  </script>
3109
- <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
3230
+ <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
3110
3231
  </div>
3111
3232
 
3112
3233
 
@@ -3118,7 +3239,7 @@ path.onMouseLeave = function(event) {
3118
3239
  <div class="button run">Run</div>
3119
3240
  </div>
3120
3241
 
3121
- <script type="text/paperscript" canvas="canvas-34">
3242
+ <script type="text/paperscript" canvas="canvas-35">
3122
3243
  function enter(event) {
3123
3244
  this.fillColor = 'red';
3124
3245
  }
@@ -3140,7 +3261,7 @@ function onMouseDown(event) {
3140
3261
  path.onMouseLeave = leave;
3141
3262
  }
3142
3263
  </script>
3143
- <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
3264
+ <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3144
3265
  </div>
3145
3266
 
3146
3267
 
@@ -3184,7 +3305,7 @@ function onMouseDown(event) {
3184
3305
  <div class="button run">Run</div>
3185
3306
  </div>
3186
3307
 
3187
- <script type="text/paperscript" canvas="canvas-35">
3308
+ <script type="text/paperscript" canvas="canvas-36">
3188
3309
  // Create a circle shaped path at the center of the view:
3189
3310
  var path = new Path.Circle({
3190
3311
  center: view.center,
@@ -3197,7 +3318,7 @@ path.onMouseLeave = function(event) {
3197
3318
  this.fillColor = 'red';
3198
3319
  }
3199
3320
  </script>
3200
- <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3321
+ <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3201
3322
  </div>
3202
3323
 
3203
3324
 
@@ -3206,38 +3327,425 @@ path.onMouseLeave = function(event) {
3206
3327
  </div>
3207
3328
  </div>
3208
3329
 
3209
- </div>
3210
-
3211
-
3212
- <!-- =========================== inherited methods ========================= -->
3213
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3214
-
3215
3330
 
3216
- <div id="set-props" class="member">
3331
+ <div id="ondraw" class="member">
3217
3332
  <div class="member-link">
3218
- <a name="set-props" href="#set-props"><tt><b>set</b>(props)</tt></a>
3333
+ <a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
3219
3334
  </div>
3220
3335
  <div class="member-description hidden">
3336
+
3221
3337
  <div class="member-text">
3222
- <p>Sets the properties of the passed object literal on this item to the values defined in the object literal, if the item has property of the given name (or a setter defined for it).</p>
3223
-
3338
+ <p>The function to be called whenever the item is drawn: in views, in <a href="../classes/Item.html#rasterize"><tt>rasterize</tt></a>(), and once for each placement of a symbol whose definition contains it. It is called right before the item&rsquo;s default drawing, and draws with the canvas API beneath it, or replaces it by returning <code>false</code> or calling <code>event.preventDefault()</code>. The function receives a <a href="../classes/DrawEvent.html"><tt>DrawEvent</tt></a> object with these fields:</p>
3224
3339
 
3225
- <ul class="member-list">
3226
- <h4>Parameters:</h4>
3227
3340
 
3228
- <li>
3229
- <tt>props:</tt>
3230
- <tt>Object</tt>
3231
-
3232
-
3233
- </li>
3234
3341
 
3342
+ <ul class="member-list">
3343
+ <h4>Type:</h4>
3344
+ <li>
3345
+ <tt>Function</tt>⟋<tt>null</tt>
3346
+ </li>
3347
+ </ul>
3348
+ <ul class="member-list">
3349
+ <h4>Options:</h4>
3350
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the item that is drawn</li>
3351
+ <li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> &mdash; the canvas context, transformed into the item&rsquo;s coordinates</li>
3352
+ <li><tt>event.matrix: <a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt> &mdash; the matrix from the item&rsquo;s coordinates to the pixels of the view, without its pixel ratio, for drawing things at a size in pixels</li>
3353
+ <li><tt>event.pixelRatio: <tt>Number</tt></tt> &mdash; the device pixels per pixel: the view&rsquo;s pixel ratio, or the resolution divided by 72 in <a href="../classes/Item.html#rasterize"><tt>rasterize</tt></a>()</li>
3354
+ <li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> &mdash; the view drawn into, or <code>null</code> in <a href="../classes/Item.html#rasterize"><tt>rasterize</tt></a>()
3355
+ What the handler draws isn&rsquo;t part of the item&rsquo;s hit testing, its bounds or its SVG export. In buffered groups, it is only called when the group draws its buffer again, see <a href="../classes/Group.html#buffered"><tt>group.buffered</tt></a>.</li>
3235
3356
  </ul>
3236
-
3237
3357
 
3238
- <ul class="member-list">
3239
- <h4>Returns:</h4>
3240
-
3358
+ <h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
3359
+
3360
+ <div class="paperscript split">
3361
+
3362
+ <div class="buttons">
3363
+ <div class="button run">Run</div>
3364
+ </div>
3365
+
3366
+ <script type="text/paperscript" canvas="canvas-37">
3367
+ var path = new Path.Circle({
3368
+ center: view.center,
3369
+ radius: 25,
3370
+ fillColor: 'rgba(255, 0, 0, 0.5)'
3371
+ });
3372
+
3373
+ path.onDraw = function(event) {
3374
+ var ctx = event.context,
3375
+ center = this.position,
3376
+ scale = event.matrix.scaling.x;
3377
+ ctx.beginPath();
3378
+ ctx.moveTo(center.x - 40, center.y);
3379
+ ctx.lineTo(center.x + 40, center.y);
3380
+ ctx.moveTo(center.x, center.y - 40);
3381
+ ctx.lineTo(center.x, center.y + 40);
3382
+ ctx.lineWidth = 1 / scale;
3383
+ ctx.stroke();
3384
+ }
3385
+ </script>
3386
+ <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3387
+ </div>
3388
+
3389
+
3390
+ </div>
3391
+
3392
+ </div>
3393
+ </div>
3394
+
3395
+
3396
+ <div id="ondrawselection" class="member">
3397
+ <div class="member-link">
3398
+ <a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
3399
+ </div>
3400
+ <div class="member-description hidden">
3401
+
3402
+ <div class="member-text">
3403
+ <p>The function to be called when the selection of the selected item is drawn, over all the content. It is called right before the item&rsquo;s default selection drawing, and draws with the canvas API beneath it, or replaces it by returning <code>false</code> or calling <code>event.preventDefault()</code>. The function receives a <a href="../classes/DrawEvent.html"><tt>DrawEvent</tt></a> object with these fields:</p>
3404
+
3405
+
3406
+
3407
+ <ul class="member-list">
3408
+ <h4>Type:</h4>
3409
+ <li>
3410
+ <tt>Function</tt>⟋<tt>null</tt>
3411
+ </li>
3412
+ </ul>
3413
+ <ul class="member-list">
3414
+ <h4>Options:</h4>
3415
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the selected item</li>
3416
+ <li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> &mdash; the canvas context, in the pixels of the view, with the selection color as its <code>strokeStyle</code> and <code>fillStyle</code>, and a <code>lineWidth</code> of 1</li>
3417
+ <li><tt>event.matrix: <a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt> &mdash; the matrix from the item&rsquo;s coordinates to the pixels of the view</li>
3418
+ <li><tt>event.size: <tt>Number</tt></tt> &mdash; the size of the handles, see <a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a></li>
3419
+ <li><tt>event.color: <a href="../classes/Color.html"><tt>Color</tt></a></tt> &mdash; the selection color, see <a href="../classes/Item.html#selectedcolor"><tt>selectedColor</tt></a></li>
3420
+ <li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> &mdash; the view drawn into
3421
+ What the handler draws isn&rsquo;t part of the item&rsquo;s hit testing, its bounds or its SVG export.</li>
3422
+ </ul>
3423
+
3424
+ <h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
3425
+
3426
+ <div class="paperscript split">
3427
+
3428
+ <div class="buttons">
3429
+ <div class="button run">Run</div>
3430
+ </div>
3431
+
3432
+ <script type="text/paperscript" canvas="canvas-38">
3433
+ var path = new Path.Star({
3434
+ center: view.center,
3435
+ points: 5,
3436
+ radius1: 20,
3437
+ radius2: 40,
3438
+ strokeColor: 'black',
3439
+ selected: true
3440
+ });
3441
+
3442
+ path.onDrawSelection = function(event) {
3443
+ var ctx = event.context;
3444
+ this.segments.forEach(function(segment) {
3445
+ var point = event.matrix.transform(segment.point);
3446
+ ctx.beginPath();
3447
+ ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
3448
+ ctx.fill();
3449
+ });
3450
+ return false;
3451
+ }
3452
+ </script>
3453
+ <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
3454
+ </div>
3455
+
3456
+
3457
+ </div>
3458
+
3459
+ </div>
3460
+ </div>
3461
+
3462
+ </div>
3463
+
3464
+
3465
+ <!-- =========================== inherited methods ========================= -->
3466
+ <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3467
+
3468
+
3469
+ <div id="addeffect-effect" class="member">
3470
+ <div class="member-link">
3471
+ <a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
3472
+ </div>
3473
+ <div class="member-description hidden">
3474
+ <div class="member-text">
3475
+ <p>Adds an effect at the end of the item&rsquo;s effects.</p>
3476
+
3477
+
3478
+ <ul class="member-list">
3479
+ <h4>Parameters:</h4>
3480
+
3481
+ <li>
3482
+ <tt>effect:</tt>
3483
+ <tt>Object</tt>
3484
+ &mdash;&nbsp;the plain object describing the effect
3485
+
3486
+ </li>
3487
+
3488
+ </ul>
3489
+
3490
+
3491
+ <ul class="member-list">
3492
+ <h4>Returns:</h4>
3493
+
3494
+ <li>
3495
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the added instance
3496
+ </li>
3497
+
3498
+
3499
+ </ul>
3500
+
3501
+
3502
+
3503
+
3504
+
3505
+ </div>
3506
+ </div>
3507
+ </div>
3508
+
3509
+
3510
+ <div id="inserteffect-index-effect" class="member">
3511
+ <div class="member-link">
3512
+ <a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
3513
+ </div>
3514
+ <div class="member-description hidden">
3515
+ <div class="member-text">
3516
+ <p>Inserts an effect into the item&rsquo;s effects at the given index.</p>
3517
+
3518
+
3519
+ <ul class="member-list">
3520
+ <h4>Parameters:</h4>
3521
+
3522
+ <li>
3523
+ <tt>index:</tt>
3524
+ <tt>Number</tt>
3525
+ &mdash;&nbsp;the index at which to insert the effect
3526
+
3527
+ </li>
3528
+
3529
+ <li>
3530
+ <tt>effect:</tt>
3531
+ <tt>Object</tt>
3532
+ &mdash;&nbsp;the plain object describing the effect
3533
+
3534
+ </li>
3535
+
3536
+ </ul>
3537
+
3538
+
3539
+ <ul class="member-list">
3540
+ <h4>Returns:</h4>
3541
+
3542
+ <li>
3543
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted instance
3544
+ </li>
3545
+
3546
+
3547
+ </ul>
3548
+
3549
+
3550
+
3551
+
3552
+
3553
+ </div>
3554
+ </div>
3555
+ </div>
3556
+
3557
+
3558
+ <div id="inserteffects-index-effects" class="member">
3559
+ <div class="member-link">
3560
+ <a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
3561
+ </div>
3562
+ <div class="member-description hidden">
3563
+ <div class="member-text">
3564
+ <p>Inserts effects into the item&rsquo;s effects at the given index.</p>
3565
+
3566
+
3567
+ <ul class="member-list">
3568
+ <h4>Parameters:</h4>
3569
+
3570
+ <li>
3571
+ <tt>index:</tt>
3572
+ <tt>Number</tt>
3573
+ &mdash;&nbsp;the index at which to insert the effects
3574
+
3575
+ </li>
3576
+
3577
+ <li>
3578
+ <tt>effects:</tt>
3579
+ Array of <tt>Object</tt> objects
3580
+ &mdash;&nbsp;the plain objects describing the effects
3581
+
3582
+ </li>
3583
+
3584
+ </ul>
3585
+
3586
+
3587
+ <ul class="member-list">
3588
+ <h4>Returns:</h4>
3589
+
3590
+ <li>
3591
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the inserted instances
3592
+ </li>
3593
+
3594
+
3595
+ </ul>
3596
+
3597
+
3598
+
3599
+
3600
+
3601
+ </div>
3602
+ </div>
3603
+ </div>
3604
+
3605
+
3606
+ <div id="removeeffect-index" class="member">
3607
+ <div class="member-link">
3608
+ <a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
3609
+ </div>
3610
+ <div class="member-description hidden">
3611
+ <div class="member-text">
3612
+ <p>Removes the effect at the given index from the item&rsquo;s effects.</p>
3613
+
3614
+
3615
+ <ul class="member-list">
3616
+ <h4>Parameters:</h4>
3617
+
3618
+ <li>
3619
+ <tt>index:</tt>
3620
+ <tt>Number</tt>
3621
+ &mdash;&nbsp;the index of the effect to remove
3622
+
3623
+ </li>
3624
+
3625
+ </ul>
3626
+
3627
+
3628
+ <ul class="member-list">
3629
+ <h4>Returns:</h4>
3630
+
3631
+ <li>
3632
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the removed instance, or <code>null</code>
3633
+ </li>
3634
+
3635
+
3636
+ </ul>
3637
+
3638
+
3639
+
3640
+
3641
+
3642
+ </div>
3643
+ </div>
3644
+ </div>
3645
+
3646
+
3647
+ <div id="removeeffects" class="member">
3648
+ <div class="member-link">
3649
+ <a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
3650
+ </div>
3651
+ <div class="member-description hidden">
3652
+ <div class="member-text">
3653
+ <p>Removes the effects from the start index to the end index from the item&rsquo;s effects, or all of them.</p>
3654
+
3655
+
3656
+ <ul class="member-list">
3657
+ <h4>Parameters:</h4>
3658
+
3659
+ <li>
3660
+ <tt>start:</tt>
3661
+ <tt>Number</tt>
3662
+ &mdash;&nbsp;the index of the first effect to remove
3663
+ &mdash;&nbsp;optional, default: <tt>0</tt>
3664
+ </li>
3665
+
3666
+ <li>
3667
+ <tt>end:</tt>
3668
+ <tt>Number</tt>
3669
+ &mdash;&nbsp;the index after the last one
3670
+ &mdash;&nbsp;optional, default: <tt>effects.length</tt>
3671
+ </li>
3672
+
3673
+ </ul>
3674
+
3675
+
3676
+ <ul class="member-list">
3677
+ <h4>Returns:</h4>
3678
+
3679
+ <li>
3680
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the removed instances
3681
+ </li>
3682
+
3683
+
3684
+ </ul>
3685
+
3686
+
3687
+
3688
+
3689
+
3690
+ </div>
3691
+ </div>
3692
+ </div>
3693
+
3694
+
3695
+ <div id="geteffectoutput" class="member">
3696
+ <div class="member-link">
3697
+ <a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
3698
+ </div>
3699
+ <div class="member-description hidden">
3700
+ <div class="member-text">
3701
+ <p>Returns what the item&rsquo;s visible effects make of it, in the item&rsquo;s own coordinates, outside of the scene graph, or <code>null</code> if it has none. It is kept until the item, its content, its effects or the registered effects change, so changing it isn&rsquo;t tracked.</p>
3702
+
3703
+
3704
+
3705
+ <ul class="member-list">
3706
+ <h4>Returns:</h4>
3707
+
3708
+ <li>
3709
+ <tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt>&nbsp;&mdash;&nbsp;the output of the effects
3710
+ </li>
3711
+
3712
+
3713
+ </ul>
3714
+
3715
+
3716
+
3717
+
3718
+
3719
+ </div>
3720
+ </div>
3721
+ </div>
3722
+
3723
+
3724
+ <div id="set-props" class="member">
3725
+ <div class="member-link">
3726
+ <a name="set-props" href="#set-props"><tt><b>set</b>(props)</tt></a>
3727
+ </div>
3728
+ <div class="member-description hidden">
3729
+ <div class="member-text">
3730
+ <p>Sets the properties of the passed object literal on this item to the values defined in the object literal, if the item has property of the given name (or a setter defined for it).</p>
3731
+
3732
+
3733
+ <ul class="member-list">
3734
+ <h4>Parameters:</h4>
3735
+
3736
+ <li>
3737
+ <tt>props:</tt>
3738
+ <tt>Object</tt>
3739
+
3740
+
3741
+ </li>
3742
+
3743
+ </ul>
3744
+
3745
+
3746
+ <ul class="member-list">
3747
+ <h4>Returns:</h4>
3748
+
3241
3749
  <li>
3242
3750
  <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the item itself
3243
3751
  </li>
@@ -3256,7 +3764,7 @@ path.onMouseLeave = function(event) {
3256
3764
  <div class="button run">Run</div>
3257
3765
  </div>
3258
3766
 
3259
- <script type="text/paperscript" canvas="canvas-36">
3767
+ <script type="text/paperscript" canvas="canvas-39">
3260
3768
  var circle = new Path.Circle({
3261
3769
  center: [80, 50],
3262
3770
  radius: 35
@@ -3269,7 +3777,7 @@ circle.set({
3269
3777
  selected: true
3270
3778
  });
3271
3779
  </script>
3272
- <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3780
+ <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
3273
3781
  </div>
3274
3782
 
3275
3783
 
@@ -3325,7 +3833,7 @@ circle.set({
3325
3833
  <div class="button run">Run</div>
3326
3834
  </div>
3327
3835
 
3328
- <script type="text/paperscript" canvas="canvas-37">
3836
+ <script type="text/paperscript" canvas="canvas-40">
3329
3837
  var circle = new Path.Circle({
3330
3838
  center: [50, 50],
3331
3839
  radius: 10,
@@ -3340,7 +3848,7 @@ for (var i = 0; i < 20; i++) {
3340
3848
  copy.position.x += i * copy.bounds.width;
3341
3849
  }
3342
3850
  </script>
3343
- <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3851
+ <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
3344
3852
  </div>
3345
3853
 
3346
3854
 
@@ -3466,7 +3974,7 @@ for (var i = 0; i < 20; i++) {
3466
3974
  <div class="button run">Run</div>
3467
3975
  </div>
3468
3976
 
3469
- <script type="text/paperscript" canvas="canvas-38">
3977
+ <script type="text/paperscript" canvas="canvas-41">
3470
3978
  var circle = new Path.Circle({
3471
3979
  center: [50, 50],
3472
3980
  radius: 5,
@@ -3483,7 +3991,7 @@ raster.position.x += 100;
3483
3991
  circle.scale(5);
3484
3992
  raster.scale(5);
3485
3993
  </script>
3486
- <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
3994
+ <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
3487
3995
  </div>
3488
3996
 
3489
3997
 
@@ -3537,7 +4045,7 @@ raster.scale(5);
3537
4045
  <div class="button run">Run</div>
3538
4046
  </div>
3539
4047
 
3540
- <script type="text/paperscript" canvas="canvas-39">
4048
+ <script type="text/paperscript" canvas="canvas-42">
3541
4049
  var path = new Path.Star({
3542
4050
  center: [50, 50],
3543
4051
  points: 12,
@@ -3558,7 +4066,7 @@ function onMouseDown(event) {
3558
4066
  }
3559
4067
  }
3560
4068
  </script>
3561
- <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
4069
+ <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
3562
4070
  </div>
3563
4071
 
3564
4072
 
@@ -4076,11 +4584,17 @@ function onMouseDown(event) {
4076
4584
  </div>
4077
4585
  <div class="member-description hidden">
4078
4586
  <div class="member-text">
4079
- <p>Exports the item with its content and child items as an SVG DOM.</p>
4587
+ <p>Exports the item with its content and child items as an SVG DOM. With <code>options.bounds</code> or <code>options.matrix</code>, the item is wrapped in an <code>&lt;svg&gt;</code> element sized to the bounds, as <a href="../classes/Project.html#exportsvg-options"><tt>project.exportSVG(options)</tt></a> does.</p>
4080
4588
  <ul class="member-list">
4081
4589
  <h4>Options:</h4>
4082
- <li><tt>options.bounds: <tt>String</tt>⟋<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a></tt> &mdash; the bounds of the area to export, either as a string (<tt>&lsquo;view&rsquo;</tt>, <tt>content&rsquo;</tt>), or a <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a> object: <code>&#39;view&#39;</code> uses the view bounds, <code>&#39;content&#39;</code> uses the stroke bounds of all content &mdash;&nbsp;default: <tt>&lsquo;view&rsquo;</tt></li>
4083
- <li><tt>options.matrix: <a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt> &mdash; the matrix with which to transform the exported content: If <code>options.bounds</code> is set to <code>&#39;view&#39;</code>, <code>paper.view.matrix</code> is used, for all other settings of <code>options.bounds</code> the identity matrix is used. &mdash;&nbsp;default: <tt>paper.view.matrix</tt></li>
4590
+ <li>[options.bounds] {String|Rectangle} the bounds of the area to
4591
+ export, either as a string ({@values 'view', content'}), or a
4592
+ {@link Rectangle} object: `'view'` uses the view bounds,
4593
+ `'content'` uses the stroke bounds of the item</li>
4594
+ <li>[options.matrix] {Matrix} the matrix with which to transform the
4595
+ exported content: If `options.bounds` is set to `'view'`,
4596
+ `paper.view.matrix` is used, for all other settings of
4597
+ `options.bounds` the identity matrix is used.</li>
4084
4598
  <li><tt>options.asString: <tt>Boolean</tt></tt> &mdash; whether a SVG node or a <code>String</code> is to be returned &mdash;&nbsp;default: <tt>false</tt></li>
4085
4599
  <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>
4086
4600
  <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>
@@ -4088,6 +4602,12 @@ function onMouseDown(event) {
4088
4602
  <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>
4089
4603
  <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>
4090
4604
  <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>
4605
+ <li>[options.processNode] {Function} the function to process the
4606
+ SVG node made for each exported item, receiving an object with the
4607
+ `item` and its `node`: It can change the node, e.g. to add attributes
4608
+ that Paper.js doesn't export, or return a node to replace it with. It
4609
+ is called before the item's name, style, visibility and data are set
4610
+ on the node, which replace attributes of the same names.</li>
4091
4611
  </ul>
4092
4612
 
4093
4613
  <ul class="member-list">
@@ -4130,6 +4650,7 @@ function onMouseDown(event) {
4130
4650
  <div class="member-text">
4131
4651
  <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>
4132
4652
  <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>
4653
+ <p>The layers in SVG content that Paper.js exported come back as <a href="../classes/Layer.html"><tt>Layer</tt></a> items inside the imported group. To make the layers of a project&rsquo;s SVG the layers of a project again, add them to it with <code>item.children.slice().forEach(project.addLayer, project)</code>.</p>
4133
4654
  <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>
4134
4655
  <ul class="member-list">
4135
4656
  <h4>Options:</h4>
@@ -4141,6 +4662,13 @@ function onMouseDown(event) {
4141
4662
  <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>
4142
4663
  <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>
4143
4664
  <li><tt>options.applyMatrix: <tt>Boolean</tt></tt> &mdash; whether the imported items should have their transformation matrices applied to their contents or not &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.applyMatrix</tt></li>
4665
+ <li>[options.processItem] {Function} the function to process the
4666
+ item made for each imported SVG element, receiving an object with
4667
+ the `item` and its `node`: It can read attributes that Paper.js
4668
+ doesn't import, or return an item to replace it with. It is called
4669
+ after the element's attributes and data are applied to the item, so
4670
+ it can extend `item.data`. A replacement item doesn't receive them:
4671
+ copy them over from `item` as needed.</li>
4144
4672
  </ul>
4145
4673
 
4146
4674
  <ul class="member-list">
@@ -5420,7 +5948,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5420
5948
  <div class="button run">Run</div>
5421
5949
  </div>
5422
5950
 
5423
- <script type="text/paperscript" canvas="canvas-40">
5951
+ <script type="text/paperscript" canvas="canvas-43">
5424
5952
  // Create a rectangle shaped path with its top left
5425
5953
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
5426
5954
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -5429,7 +5957,7 @@ path.fillColor = 'black';
5429
5957
  // Rotate the path by 30 degrees:
5430
5958
  path.rotate(30);
5431
5959
  </script>
5432
- <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
5960
+ <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
5433
5961
  </div>
5434
5962
 
5435
5963
 
@@ -5441,7 +5969,7 @@ path.rotate(30);
5441
5969
  <div class="button run">Run</div>
5442
5970
  </div>
5443
5971
 
5444
- <script type="text/paperscript" canvas="canvas-41">
5972
+ <script type="text/paperscript" canvas="canvas-44">
5445
5973
  // Create a rectangle shaped path with its top left
5446
5974
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
5447
5975
  var topLeft = new Point(175, 50);
@@ -5463,7 +5991,7 @@ function onFrame(event) {
5463
5991
  path.rotate(3, view.center);
5464
5992
  }
5465
5993
  </script>
5466
- <div class="canvas"><canvas width="516" height="200" id="canvas-41"></canvas></div>
5994
+ <div class="canvas"><canvas width="516" height="200" id="canvas-44"></canvas></div>
5467
5995
  </div>
5468
5996
 
5469
5997
 
@@ -5512,7 +6040,7 @@ function onFrame(event) {
5512
6040
  <div class="button run">Run</div>
5513
6041
  </div>
5514
6042
 
5515
- <script type="text/paperscript" canvas="canvas-42">
6043
+ <script type="text/paperscript" canvas="canvas-45">
5516
6044
  // Create a circle shaped path at { x: 80, y: 50 }
5517
6045
  // with a radius of 20:
5518
6046
  var circle = new Path.Circle({
@@ -5524,7 +6052,7 @@ var circle = new Path.Circle({
5524
6052
  // Scale the path by 150% from its center point
5525
6053
  circle.scale(1.5);
5526
6054
  </script>
5527
- <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
6055
+ <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
5528
6056
  </div>
5529
6057
 
5530
6058
 
@@ -5536,7 +6064,7 @@ circle.scale(1.5);
5536
6064
  <div class="button run">Run</div>
5537
6065
  </div>
5538
6066
 
5539
- <script type="text/paperscript" canvas="canvas-43">
6067
+ <script type="text/paperscript" canvas="canvas-46">
5540
6068
  // Create a circle shaped path at { x: 80, y: 50 }
5541
6069
  // with a radius of 20:
5542
6070
  var circle = new Path.Circle({
@@ -5548,7 +6076,7 @@ var circle = new Path.Circle({
5548
6076
  // Scale the path 150% from its bottom left corner
5549
6077
  circle.scale(1.5, circle.bounds.bottomLeft);
5550
6078
  </script>
5551
- <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
6079
+ <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
5552
6080
  </div>
5553
6081
 
5554
6082
 
@@ -5604,7 +6132,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
5604
6132
  <div class="button run">Run</div>
5605
6133
  </div>
5606
6134
 
5607
- <script type="text/paperscript" canvas="canvas-44">
6135
+ <script type="text/paperscript" canvas="canvas-47">
5608
6136
  // Create a circle shaped path at { x: 100, y: 50 }
5609
6137
  // with a radius of 20:
5610
6138
  var circle = new Path.Circle({
@@ -5616,7 +6144,7 @@ var circle = new Path.Circle({
5616
6144
  // Scale the path horizontally by 300%
5617
6145
  circle.scale(3, 1);
5618
6146
  </script>
5619
- <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
6147
+ <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
5620
6148
  </div>
5621
6149
 
5622
6150
 
@@ -6054,7 +6582,7 @@ circle.scale(3, 1);
6054
6582
  <div class="button run">Run</div>
6055
6583
  </div>
6056
6584
 
6057
- <script type="text/paperscript" canvas="canvas-45">
6585
+ <script type="text/paperscript" canvas="canvas-48">
6058
6586
  // Create a rectangle shaped path with its top left corner
6059
6587
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6060
6588
  var path = new Path.Rectangle({
@@ -6075,7 +6603,7 @@ var circlePath = new Path.Circle({
6075
6603
  // the rectangular path:
6076
6604
  circlePath.fitBounds(path.bounds);
6077
6605
  </script>
6078
- <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
6606
+ <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6079
6607
  </div>
6080
6608
 
6081
6609
 
@@ -6087,7 +6615,7 @@ circlePath.fitBounds(path.bounds);
6087
6615
  <div class="button run">Run</div>
6088
6616
  </div>
6089
6617
 
6090
- <script type="text/paperscript" canvas="canvas-46">
6618
+ <script type="text/paperscript" canvas="canvas-49">
6091
6619
  // Create a rectangle shaped path with its top left corner
6092
6620
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6093
6621
  var path = new Path.Rectangle({
@@ -6108,7 +6636,7 @@ var circlePath = new Path.Circle({
6108
6636
  // the rectangular path:
6109
6637
  circlePath.fitBounds(path.bounds, 'cover');
6110
6638
  </script>
6111
- <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
6639
+ <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
6112
6640
  </div>
6113
6641
 
6114
6642
 
@@ -6120,7 +6648,7 @@ circlePath.fitBounds(path.bounds, 'cover');
6120
6648
  <div class="button run">Run</div>
6121
6649
  </div>
6122
6650
 
6123
- <script type="text/paperscript" canvas="canvas-47">
6651
+ <script type="text/paperscript" canvas="canvas-50">
6124
6652
  var path = new Path.Circle({
6125
6653
  center: [80, 50],
6126
6654
  radius: 30,
@@ -6130,7 +6658,7 @@ var path = new Path.Circle({
6130
6658
  // Fit the path to the bounding rectangle of the view:
6131
6659
  path.fitBounds(view.bounds);
6132
6660
  </script>
6133
- <div class="canvas"><canvas width="516" height="200" id="canvas-47"></canvas></div>
6661
+ <div class="canvas"><canvas width="516" height="200" id="canvas-50"></canvas></div>
6134
6662
  </div>
6135
6663
 
6136
6664
 
@@ -6156,7 +6684,7 @@ path.fitBounds(view.bounds);
6156
6684
  <li>
6157
6685
  <tt>type:</tt>
6158
6686
  <tt>String</tt>
6159
- &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
6687
+ &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>, <tt>&lsquo;draw&rsquo;</tt>, <tt>&lsquo;drawselection&rsquo;</tt>
6160
6688
 
6161
6689
  </li>
6162
6690
 
@@ -6191,7 +6719,7 @@ path.fitBounds(view.bounds);
6191
6719
  <div class="button run">Run</div>
6192
6720
  </div>
6193
6721
 
6194
- <script type="text/paperscript" canvas="canvas-48">
6722
+ <script type="text/paperscript" canvas="canvas-51">
6195
6723
  // Create a circle shaped path at the center of the view:
6196
6724
  var path = new Path.Circle({
6197
6725
  center: view.center,
@@ -6209,7 +6737,7 @@ path.on('mouseleave', function() {
6209
6737
  this.fillColor = 'black';
6210
6738
  });
6211
6739
  </script>
6212
- <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6740
+ <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
6213
6741
  </div>
6214
6742
 
6215
6743
 
@@ -6233,7 +6761,7 @@ path.on('mouseleave', function() {
6233
6761
  <li>
6234
6762
  <tt>object:</tt>
6235
6763
  <tt>Object</tt>
6236
- &mdash;&nbsp;an object containing one or more of the following properties: <tt>frame</tt>, <tt>mousedown</tt>, <tt>mouseup</tt>, <tt>mousedrag</tt>, <tt>click</tt>, <tt>doubleclick</tt>, <tt>mousemove</tt>, <tt>mouseenter</tt>, <tt>mouseleave</tt>
6764
+ &mdash;&nbsp;an object containing one or more of the following properties: <tt>frame</tt>, <tt>mousedown</tt>, <tt>mouseup</tt>, <tt>mousedrag</tt>, <tt>click</tt>, <tt>doubleclick</tt>, <tt>mousemove</tt>, <tt>mouseenter</tt>, <tt>mouseleave</tt>, <tt>draw</tt>, <tt>drawselection</tt>
6237
6765
 
6238
6766
  </li>
6239
6767
 
@@ -6261,7 +6789,7 @@ path.on('mouseleave', function() {
6261
6789
  <div class="button run">Run</div>
6262
6790
  </div>
6263
6791
 
6264
- <script type="text/paperscript" canvas="canvas-49">
6792
+ <script type="text/paperscript" canvas="canvas-52">
6265
6793
  // Create a circle shaped path at the center of the view:
6266
6794
  var path = new Path.Circle({
6267
6795
  center: view.center,
@@ -6279,7 +6807,7 @@ path.on({
6279
6807
  }
6280
6808
  });
6281
6809
  </script>
6282
- <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
6810
+ <div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
6283
6811
  </div>
6284
6812
 
6285
6813
 
@@ -6291,7 +6819,7 @@ path.on({
6291
6819
  <div class="button run">Run</div>
6292
6820
  </div>
6293
6821
 
6294
- <script type="text/paperscript" canvas="canvas-50">
6822
+ <script type="text/paperscript" canvas="canvas-53">
6295
6823
  var pathHandlers = {
6296
6824
  mouseenter: function(event) {
6297
6825
  this.fillColor = 'red';
@@ -6314,7 +6842,7 @@ function onMouseDown(event) {
6314
6842
  path.on(pathHandlers);
6315
6843
  }
6316
6844
  </script>
6317
- <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
6845
+ <div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
6318
6846
  </div>
6319
6847
 
6320
6848
 
@@ -6338,7 +6866,7 @@ function onMouseDown(event) {
6338
6866
  <li>
6339
6867
  <tt>type:</tt>
6340
6868
  <tt>String</tt>
6341
- &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
6869
+ &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>, <tt>&lsquo;draw&rsquo;</tt>, <tt>&lsquo;drawselection&rsquo;</tt>
6342
6870
 
6343
6871
  </li>
6344
6872
 
@@ -6386,7 +6914,7 @@ function onMouseDown(event) {
6386
6914
  <li>
6387
6915
  <tt>object:</tt>
6388
6916
  <tt>Object</tt>
6389
- &mdash;&nbsp;an object containing one or more of the following properties: <tt>frame</tt>, <tt>mousedown</tt>, <tt>mouseup</tt>, <tt>mousedrag</tt>, <tt>click</tt>, <tt>doubleclick</tt>, <tt>mousemove</tt>, <tt>mouseenter</tt>, <tt>mouseleave</tt>
6917
+ &mdash;&nbsp;an object containing one or more of the following properties: <tt>frame</tt>, <tt>mousedown</tt>, <tt>mouseup</tt>, <tt>mousedrag</tt>, <tt>click</tt>, <tt>doubleclick</tt>, <tt>mousemove</tt>, <tt>mouseenter</tt>, <tt>mouseleave</tt>, <tt>draw</tt>, <tt>drawselection</tt>
6390
6918
 
6391
6919
  </li>
6392
6920
 
@@ -6427,7 +6955,7 @@ function onMouseDown(event) {
6427
6955
  <li>
6428
6956
  <tt>type:</tt>
6429
6957
  <tt>String</tt>
6430
- &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
6958
+ &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>, <tt>&lsquo;draw&rsquo;</tt>, <tt>&lsquo;drawselection&rsquo;</tt>
6431
6959
 
6432
6960
  </li>
6433
6961
 
@@ -6475,7 +7003,7 @@ function onMouseDown(event) {
6475
7003
  <li>
6476
7004
  <tt>type:</tt>
6477
7005
  <tt>String</tt>
6478
- &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>
7006
+ &mdash;&nbsp;the type of event: <tt>&lsquo;frame&rsquo;</tt>, <tt>mousedown&rsquo;</tt>, <tt>&lsquo;mouseup&rsquo;</tt>, <tt>&lsquo;mousedrag&rsquo;</tt>, <tt>&lsquo;click&rsquo;</tt>, <tt>&lsquo;doubleclick&rsquo;</tt>, <tt>&lsquo;mousemove&rsquo;</tt>, <tt>&lsquo;mouseenter&rsquo;</tt>, <tt>&lsquo;mouseleave&rsquo;</tt>, <tt>&lsquo;draw&rsquo;</tt>, <tt>&lsquo;drawselection&rsquo;</tt>
6479
7007
 
6480
7008
  </li>
6481
7009
 
@@ -6542,7 +7070,7 @@ function onMouseDown(event) {
6542
7070
  <div class="button run">Run</div>
6543
7071
  </div>
6544
7072
 
6545
- <script type="text/paperscript" canvas="canvas-51">
7073
+ <script type="text/paperscript" canvas="canvas-54">
6546
7074
  function onMouseDrag(event) {
6547
7075
  // Create a circle shaped path at the mouse position,
6548
7076
  // with a radius of 10:
@@ -6559,7 +7087,7 @@ function onMouseDrag(event) {
6559
7087
  });
6560
7088
  }
6561
7089
  </script>
6562
- <div class="canvas"><canvas width="516" height="200" id="canvas-51"></canvas></div>
7090
+ <div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
6563
7091
  </div>
6564
7092
 
6565
7093
 
@@ -6589,7 +7117,7 @@ function onMouseDrag(event) {
6589
7117
  <div class="button run">Run</div>
6590
7118
  </div>
6591
7119
 
6592
- <script type="text/paperscript" canvas="canvas-52">
7120
+ <script type="text/paperscript" canvas="canvas-55">
6593
7121
  function onMouseMove(event) {
6594
7122
  // Create a circle shaped path at the mouse position,
6595
7123
  // with a radius of 10:
@@ -6603,7 +7131,7 @@ function onMouseMove(event) {
6603
7131
  path.removeOnMove();
6604
7132
  }
6605
7133
  </script>
6606
- <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
7134
+ <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
6607
7135
  </div>
6608
7136
 
6609
7137
 
@@ -6633,7 +7161,7 @@ function onMouseMove(event) {
6633
7161
  <div class="button run">Run</div>
6634
7162
  </div>
6635
7163
 
6636
- <script type="text/paperscript" canvas="canvas-53">
7164
+ <script type="text/paperscript" canvas="canvas-56">
6637
7165
  function onMouseDown(event) {
6638
7166
  // Create a circle shaped path at the mouse position,
6639
7167
  // with a radius of 10:
@@ -6647,7 +7175,7 @@ function onMouseDown(event) {
6647
7175
  path.removeOnDown();
6648
7176
  }
6649
7177
  </script>
6650
- <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
7178
+ <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
6651
7179
  </div>
6652
7180
 
6653
7181
 
@@ -6677,7 +7205,7 @@ function onMouseDown(event) {
6677
7205
  <div class="button run">Run</div>
6678
7206
  </div>
6679
7207
 
6680
- <script type="text/paperscript" canvas="canvas-54">
7208
+ <script type="text/paperscript" canvas="canvas-57">
6681
7209
  function onMouseDrag(event) {
6682
7210
  // Create a circle shaped path at the mouse position,
6683
7211
  // with a radius of 10:
@@ -6691,7 +7219,7 @@ function onMouseDrag(event) {
6691
7219
  path.removeOnDrag();
6692
7220
  }
6693
7221
  </script>
6694
- <div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
7222
+ <div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
6695
7223
  </div>
6696
7224
 
6697
7225
 
@@ -6721,7 +7249,7 @@ function onMouseDrag(event) {
6721
7249
  <div class="button run">Run</div>
6722
7250
  </div>
6723
7251
 
6724
- <script type="text/paperscript" canvas="canvas-55">
7252
+ <script type="text/paperscript" canvas="canvas-58">
6725
7253
  function onMouseDown(event) {
6726
7254
  // Create a circle shaped path at the mouse position,
6727
7255
  // with a radius of 10:
@@ -6735,7 +7263,7 @@ function onMouseDown(event) {
6735
7263
  path.removeOnUp();
6736
7264
  }
6737
7265
  </script>
6738
- <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
7266
+ <div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
6739
7267
  </div>
6740
7268
 
6741
7269
 
@@ -6808,7 +7336,7 @@ function onMouseDown(event) {
6808
7336
  <div class="button run">Run</div>
6809
7337
  </div>
6810
7338
 
6811
- <script type="text/paperscript" canvas="canvas-56">
7339
+ <script type="text/paperscript" canvas="canvas-59">
6812
7340
  var path = new Path.Circle({
6813
7341
  radius: view.bounds.height * 0.4,
6814
7342
  center: view.center
@@ -6819,7 +7347,7 @@ path.tween(
6819
7347
  3000
6820
7348
  );
6821
7349
  </script>
6822
- <div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
7350
+ <div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
6823
7351
  </div>
6824
7352
 
6825
7353
 
@@ -6831,7 +7359,7 @@ path.tween(
6831
7359
  <div class="button run">Run</div>
6832
7360
  </div>
6833
7361
 
6834
- <script type="text/paperscript" canvas="canvas-57">
7362
+ <script type="text/paperscript" canvas="canvas-60">
6835
7363
  var path = new Shape.Rectangle({
6836
7364
  fillColor: 'red',
6837
7365
  center: [50, view.center.y],
@@ -6846,7 +7374,7 @@ path.tween({
6846
7374
  duration: 2000
6847
7375
  });
6848
7376
  </script>
6849
- <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
7377
+ <div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
6850
7378
  </div>
6851
7379
 
6852
7380
 
@@ -6912,7 +7440,7 @@ path.tween({
6912
7440
  <div class="button run">Run</div>
6913
7441
  </div>
6914
7442
 
6915
- <script type="text/paperscript" canvas="canvas-58">
7443
+ <script type="text/paperscript" canvas="canvas-61">
6916
7444
  var path = new Path.Rectangle({
6917
7445
  size: [100, 100],
6918
7446
  position: view.center,
@@ -6926,7 +7454,7 @@ path.tween({
6926
7454
  'segments[2].point.x': '-= 50'
6927
7455
  }, 3000);
6928
7456
  </script>
6929
- <div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
7457
+ <div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
6930
7458
  </div>
6931
7459
 
6932
7460
 
@@ -6985,7 +7513,7 @@ path.tween({
6985
7513
  <div class="button run">Run</div>
6986
7514
  </div>
6987
7515
 
6988
- <script type="text/paperscript" canvas="canvas-59">
7516
+ <script type="text/paperscript" canvas="canvas-62">
6989
7517
  var path = new Path.Circle({
6990
7518
  fillColor: 'blue',
6991
7519
  radius: view.bounds.height * 0.4,
@@ -7001,7 +7529,7 @@ path.tween(2000).onUpdate = function(event) {
7001
7529
  path.interpolate(pathFrom, pathTo, event.factor)
7002
7530
  };
7003
7531
  </script>
7004
- <div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
7532
+ <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7005
7533
  </div>
7006
7534
 
7007
7535
 
@@ -7122,7 +7650,7 @@ path.tween(2000).onUpdate = function(event) {
7122
7650
  <div class="button run">Run</div>
7123
7651
  </div>
7124
7652
 
7125
- <script type="text/paperscript" canvas="canvas-60">
7653
+ <script type="text/paperscript" canvas="canvas-63">
7126
7654
  var path = new Path.Circle({
7127
7655
  fillColor: 'blue',
7128
7656
  radius: view.bounds.height * 0.4,
@@ -7130,7 +7658,7 @@ var path = new Path.Circle({
7130
7658
  });
7131
7659
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7132
7660
  </script>
7133
- <div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
7661
+ <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7134
7662
  </div>
7135
7663
 
7136
7664
 
@@ -7296,12 +7824,12 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7296
7824
  <div class="button run">Run</div>
7297
7825
  </div>
7298
7826
 
7299
- <script type="text/paperscript" canvas="canvas-61">
7827
+ <script type="text/paperscript" canvas="canvas-64">
7300
7828
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7301
7829
  .unite(new Path.Circle([50, 50], 25));
7302
7830
  result.fillColor = 'red';
7303
7831
  </script>
7304
- <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
7832
+ <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7305
7833
  </div>
7306
7834
 
7307
7835
 
@@ -7313,7 +7841,7 @@ result.fillColor = 'red';
7313
7841
  <div class="button run">Run</div>
7314
7842
  </div>
7315
7843
 
7316
- <script type="text/paperscript" canvas="canvas-62">
7844
+ <script type="text/paperscript" canvas="canvas-65">
7317
7845
  var circles = [];
7318
7846
  for (var i = 0; i < 6; i++) {
7319
7847
  circles.push(new Path.Circle([30 + i * 20, 50], 20));
@@ -7321,7 +7849,7 @@ for (var i = 0; i < 6; i++) {
7321
7849
  var result = circles[0].unite(circles.slice(1));
7322
7850
  result.fillColor = 'red';
7323
7851
  </script>
7324
- <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7852
+ <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
7325
7853
  </div>
7326
7854
 
7327
7855
 
@@ -7384,12 +7912,12 @@ result.fillColor = 'red';
7384
7912
  <div class="button run">Run</div>
7385
7913
  </div>
7386
7914
 
7387
- <script type="text/paperscript" canvas="canvas-63">
7915
+ <script type="text/paperscript" canvas="canvas-66">
7388
7916
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7389
7917
  .intersect(new Path.Circle([50, 50], 25));
7390
7918
  result.fillColor = 'red';
7391
7919
  </script>
7392
- <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7920
+ <div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
7393
7921
  </div>
7394
7922
 
7395
7923
 
@@ -7415,16 +7943,254 @@ result.fillColor = 'red';
7415
7943
  <h4>Parameters:</h4>
7416
7944
 
7417
7945
  <li>
7418
- <tt>path:</tt>
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
7946
+ <tt>path:</tt>
7947
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
7948
+ &mdash;&nbsp;the path or paths to subtract
7949
+
7950
+ </li>
7951
+
7952
+ <li>
7953
+ <tt>options:</tt>
7954
+ <tt>Object</tt>
7955
+ &mdash;&nbsp;the boolean operation options
7956
+ &mdash;&nbsp;optional
7957
+ </li>
7958
+
7959
+ </ul>
7960
+
7961
+
7962
+ <ul class="member-list">
7963
+ <h4>Returns:</h4>
7964
+
7965
+ <li>
7966
+ <tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt>&nbsp;&mdash;&nbsp;the resulting path item
7967
+ </li>
7968
+
7969
+
7970
+ </ul>
7971
+
7972
+
7973
+
7974
+
7975
+ <h4>Example:</h4>
7976
+
7977
+ <div class="paperscript split">
7978
+
7979
+ <div class="buttons">
7980
+ <div class="button run">Run</div>
7981
+ </div>
7982
+
7983
+ <script type="text/paperscript" canvas="canvas-67">
7984
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
7985
+ .subtract(new Path.Circle([50, 50], 25));
7986
+ result.fillColor = 'red';
7987
+ </script>
7988
+ <div class="canvas"><canvas width="516" height="100" id="canvas-67"></canvas></div>
7989
+ </div>
7990
+
7991
+
7992
+ </div>
7993
+ </div>
7994
+ </div>
7995
+
7996
+
7997
+ <div id="exclude-path" class="member">
7998
+ <div class="member-link">
7999
+ <a name="exclude-path" href="#exclude-path"><tt><b>exclude</b>(path[, options])</tt></a>
8000
+ </div>
8001
+ <div class="member-description hidden">
8002
+ <div class="member-text">
8003
+ <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>
8004
+ <ul class="member-list">
8005
+ <h4>Options:</h4>
8006
+ <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>
8007
+ </ul>
8008
+
8009
+ <ul class="member-list">
8010
+ <h4>Parameters:</h4>
8011
+
8012
+ <li>
8013
+ <tt>path:</tt>
8014
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
8015
+ &mdash;&nbsp;the path or paths to exclude the intersection of
8016
+
8017
+ </li>
8018
+
8019
+ <li>
8020
+ <tt>options:</tt>
8021
+ <tt>Object</tt>
8022
+ &mdash;&nbsp;the boolean operation options
8023
+ &mdash;&nbsp;optional
8024
+ </li>
8025
+
8026
+ </ul>
8027
+
8028
+
8029
+ <ul class="member-list">
8030
+ <h4>Returns:</h4>
8031
+
8032
+ <li>
8033
+ <tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt>&nbsp;&mdash;&nbsp;the resulting path item
8034
+ </li>
8035
+
8036
+
8037
+ </ul>
8038
+
8039
+
8040
+
8041
+
8042
+ <h4>Example:</h4>
8043
+
8044
+ <div class="paperscript split">
8045
+
8046
+ <div class="buttons">
8047
+ <div class="button run">Run</div>
8048
+ </div>
8049
+
8050
+ <script type="text/paperscript" canvas="canvas-68">
8051
+ var result = new Path.RegularPolygon([50, 50], 3, 40)
8052
+ .exclude(new Path.Circle([50, 50], 25));
8053
+ result.fillColor = 'red';
8054
+ </script>
8055
+ <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
8056
+ </div>
8057
+
8058
+
8059
+ </div>
8060
+ </div>
8061
+ </div>
8062
+
8063
+
8064
+ <div id="divide-path" class="member">
8065
+ <div class="member-link">
8066
+ <a name="divide-path" href="#divide-path"><tt><b>divide</b>(path[, options])</tt></a>
8067
+ </div>
8068
+ <div class="member-description hidden">
8069
+ <div class="member-text">
8070
+ <p>Splits the geometry of this path along the geometry of the specified path returns the result as a new group item. This is equivalent to calling <a href="../classes/PathItem.html#subtract-path"><tt>subtract(path)</tt></a> and <a href="../classes/PathItem.html#intersect-path"><tt>intersect(path)</tt></a> and putting the results into a new group.</p>
8071
+ <ul class="member-list">
8072
+ <h4>Options:</h4>
8073
+ <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>
8074
+ <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. &mdash;&nbsp;default: <tt>true</tt></li>
8075
+ </ul>
8076
+
8077
+ <ul class="member-list">
8078
+ <h4>Parameters:</h4>
8079
+
8080
+ <li>
8081
+ <tt>path:</tt>
8082
+ <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
8083
+ &mdash;&nbsp;the path to divide by
8084
+
8085
+ </li>
8086
+
8087
+ <li>
8088
+ <tt>options:</tt>
8089
+ <tt>Object</tt>
8090
+ &mdash;&nbsp;the boolean operation options
8091
+ &mdash;&nbsp;optional
8092
+ </li>
8093
+
8094
+ </ul>
8095
+
8096
+
8097
+ <ul class="member-list">
8098
+ <h4>Returns:</h4>
8099
+
8100
+ <li>
8101
+ <tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt>&nbsp;&mdash;&nbsp;the resulting path item
8102
+ </li>
8103
+
8104
+
8105
+ </ul>
8106
+
8107
+
8108
+
8109
+
8110
+
8111
+ </div>
8112
+ </div>
8113
+ </div>
8114
+
8115
+
8116
+ <div id="reorient" class="member">
8117
+ <div class="member-link">
8118
+ <a name="reorient" href="#reorient"><tt><b>reorient</b>([nonZero[, clockwise]])</tt></a>
8119
+ </div>
8120
+ <div class="member-description hidden">
8121
+ <div class="member-text">
8122
+ <p>Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting them so that they are of different winding direction than their containing paths, except for disjoint sub-paths, i.e. islands, which are oriented so that they have the same winding direction as the the biggest path.</p>
8123
+
8124
+
8125
+ <ul class="member-list">
8126
+ <h4>Parameters:</h4>
8127
+
8128
+ <li>
8129
+ <tt>nonZero:</tt>
8130
+ <tt>Boolean</tt>
8131
+ &mdash;&nbsp;controls if the non-zero fill-rule is to be applied, by counting the winding of each nested path and discarding sub-paths that do not contribute to the final result
8132
+ &mdash;&nbsp;optional, default: <tt>false</tt>
8133
+ </li>
8134
+
8135
+ <li>
8136
+ <tt>clockwise:</tt>
8137
+ <tt>Boolean</tt>
8138
+ &mdash;&nbsp;if provided, the orientation of the root paths will be set to the orientation specified by <code>clockwise</code>, otherwise the orientation of the largest root child is used.
8139
+ &mdash;&nbsp;optional
8140
+ </li>
8141
+
8142
+ </ul>
8143
+
8144
+
8145
+ <ul class="member-list">
8146
+ <h4>Returns:</h4>
8147
+
8148
+ <li>
8149
+ <tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt>&nbsp;&mdash;&nbsp;a reference to the item itself, reoriented
8150
+ </li>
8151
+
8152
+
8153
+ </ul>
8154
+
8155
+
8156
+
8157
+
8158
+
8159
+ </div>
8160
+ </div>
8161
+ </div>
8162
+
8163
+
8164
+ <h3>Offsetting and Outlining</h3>
8165
+
8166
+ <div id="offset-distance" class="member">
8167
+ <div class="member-link">
8168
+ <a name="offset-distance" href="#offset-distance"><tt><b>offset</b>(distance[, options])</tt></a>
8169
+ </div>
8170
+ <div class="member-description hidden">
8171
+ <div class="member-text">
8172
+ <p>Offsets the path item by the given distance and returns the result as a new path item. Closed paths and compound paths grow by positive distances and shrink by negative ones, open paths are offset along their normals for positive distances, and against them for negative ones. As with the boolean operations, the path item&rsquo;s matrix is applied first.</p>
8173
+ <ul class="member-list">
8174
+ <h4>Options:</h4>
8175
+ <li><tt>options.join: <tt>String</tt></tt> &mdash; the shape of the corners that the offset adds where the path turns away from it: <tt>&lsquo;miter&rsquo;</tt>, <tt>&lsquo;round&rsquo;</tt>, <tt>&lsquo;bevel&rsquo;</tt> &mdash;&nbsp;default: <tt>&lsquo;miter&rsquo;</tt></li>
8176
+ <li><tt>options.miterLimit: <tt>Number</tt></tt> &mdash; the limit of miter corners, see <a href="../classes/Style.html#miterlimit"><tt>style.miterLimit</tt></a> &mdash;&nbsp;default: <tt>10</tt></li>
8177
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above this path &mdash;&nbsp;default: <tt>true</tt></li>
8178
+ </ul>
8179
+
8180
+ <ul class="member-list">
8181
+ <h4>Parameters:</h4>
8182
+
8183
+ <li>
8184
+ <tt>distance:</tt>
8185
+ <tt>Number</tt>
8186
+ &mdash;&nbsp;the distance to offset the path item by
7421
8187
 
7422
8188
  </li>
7423
8189
 
7424
8190
  <li>
7425
8191
  <tt>options:</tt>
7426
8192
  <tt>Object</tt>
7427
- &mdash;&nbsp;the boolean operation options
8193
+ &mdash;&nbsp;the offset options
7428
8194
  &mdash;&nbsp;optional
7429
8195
  </li>
7430
8196
 
@@ -7452,12 +8218,13 @@ result.fillColor = 'red';
7452
8218
  <div class="button run">Run</div>
7453
8219
  </div>
7454
8220
 
7455
- <script type="text/paperscript" canvas="canvas-64">
7456
- var result = new Path.RegularPolygon([50, 50], 3, 40)
7457
- .subtract(new Path.Circle([50, 50], 25));
7458
- result.fillColor = 'red';
8221
+ <script type="text/paperscript" canvas="canvas-69">
8222
+ var path = new Path.Star([50, 50], 5, 20, 40);
8223
+ path.strokeColor = 'black';
8224
+ var result = path.offset(10, { join: 'round' });
8225
+ result.strokeColor = 'red';
7459
8226
  </script>
7460
- <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
8227
+ <div class="canvas"><canvas width="516" height="100" id="canvas-69"></canvas></div>
7461
8228
  </div>
7462
8229
 
7463
8230
 
@@ -7466,32 +8233,30 @@ result.fillColor = 'red';
7466
8233
  </div>
7467
8234
 
7468
8235
 
7469
- <div id="exclude-path" class="member">
8236
+ <div id="outline" class="member">
7470
8237
  <div class="member-link">
7471
- <a name="exclude-path" href="#exclude-path"><tt><b>exclude</b>(path[, options])</tt></a>
8238
+ <a name="outline" href="#outline"><tt><b>outline</b>([options])</tt></a>
7472
8239
  </div>
7473
8240
  <div class="member-description hidden">
7474
8241
  <div class="member-text">
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>
8242
+ <p>Outlines the stroke of the path item, and returns the area that it covers as a new path item, filled with the stroke&rsquo;s color. As with the boolean operations, the path item&rsquo;s matrix is applied first. Dashed strokes are outlined as their dashes, each with the stroke&rsquo;s caps, as the canvas draws them, see <a href="../classes/PathItem.html#dash-options"><tt>dash(options)</tt></a>.</p>
8243
+ <p>Paths with a <a href="../classes/Path.html#strokeprofile"><tt>path.strokeProfile</tt></a> are outlined as the area that its pens sweep. Their round joins and caps are the pens themselves, and their other joins and caps connect the points where the pens touch the sides of the stroke. Steps in the profile end the parts of the stroke straight across, as butt caps do.</p>
7476
8244
  <ul class="member-list">
7477
8245
  <h4>Options:</h4>
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>
8246
+ <li><tt>options.width: <tt>Number</tt></tt> &mdash; the width of the stroke &mdash;&nbsp;default: <tt>this.strokeWidth</tt></li>
8247
+ <li><tt>options.join: <tt>String</tt></tt> &mdash; the shape of the stroke&rsquo;s corners: <tt>&lsquo;miter&rsquo;</tt>, <tt>&lsquo;round&rsquo;</tt>, <tt>&lsquo;bevel&rsquo;</tt> &mdash;&nbsp;default: <tt>this.strokeJoin</tt></li>
8248
+ <li><tt>options.cap: <tt>String</tt></tt> &mdash; the shape of the stroke&rsquo;s ends: <tt>&lsquo;round&rsquo;</tt>, <tt>&lsquo;square&rsquo;</tt>, <tt>&lsquo;butt&rsquo;</tt> &mdash;&nbsp;default: <tt>this.strokeCap</tt></li>
8249
+ <li><tt>options.miterLimit: <tt>Number</tt></tt> &mdash; the limit of miter corners, see <a href="../classes/Style.html#miterlimit"><tt>style.miterLimit</tt></a> &mdash;&nbsp;default: <tt>this.miterLimit</tt></li>
8250
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting item should be inserted back into the scene graph, above this path &mdash;&nbsp;default: <tt>true</tt></li>
7479
8251
  </ul>
7480
8252
 
7481
8253
  <ul class="member-list">
7482
8254
  <h4>Parameters:</h4>
7483
8255
 
7484
- <li>
7485
- <tt>path:</tt>
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
7488
-
7489
- </li>
7490
-
7491
8256
  <li>
7492
8257
  <tt>options:</tt>
7493
8258
  <tt>Object</tt>
7494
- &mdash;&nbsp;the boolean operation options
8259
+ &mdash;&nbsp;the outline options
7495
8260
  &mdash;&nbsp;optional
7496
8261
  </li>
7497
8262
 
@@ -7519,12 +8284,17 @@ result.fillColor = 'red';
7519
8284
  <div class="button run">Run</div>
7520
8285
  </div>
7521
8286
 
7522
- <script type="text/paperscript" canvas="canvas-65">
7523
- var result = new Path.RegularPolygon([50, 50], 3, 40)
7524
- .exclude(new Path.Circle([50, 50], 25));
7525
- result.fillColor = 'red';
8287
+ <script type="text/paperscript" canvas="canvas-70">
8288
+ var path = new Path.Arc([20, 70], [50, 20], [80, 70]);
8289
+ path.strokeColor = 'black';
8290
+ path.strokeWidth = 20;
8291
+ path.strokeCap = 'round';
8292
+ var result = path.outline();
8293
+ result.strokeColor = 'red';
8294
+ result.strokeWidth = 1;
8295
+ path.remove();
7526
8296
  </script>
7527
- <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
8297
+ <div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
7528
8298
  </div>
7529
8299
 
7530
8300
 
@@ -7533,33 +8303,27 @@ result.fillColor = 'red';
7533
8303
  </div>
7534
8304
 
7535
8305
 
7536
- <div id="divide-path" class="member">
8306
+ <div id="dash" class="member">
7537
8307
  <div class="member-link">
7538
- <a name="divide-path" href="#divide-path"><tt><b>divide</b>(path[, options])</tt></a>
8308
+ <a name="dash" href="#dash"><tt><b>dash</b>([options])</tt></a>
7539
8309
  </div>
7540
8310
  <div class="member-description hidden">
7541
8311
  <div class="member-text">
7542
- <p>Splits the geometry of this path along the geometry of the specified path returns the result as a new group item. This is equivalent to calling <a href="../classes/PathItem.html#subtract-path"><tt>subtract(path)</tt></a> and <a href="../classes/PathItem.html#intersect-path"><tt>intersect(path)</tt></a> and putting the results into a new group.</p>
8312
+ <p>Cuts the stroke of the path item into its dashes, as the canvas draws them with the <a href="../classes/Style.html#dasharray"><tt>style.dashArray</tt></a> and <a href="../classes/Style.html#dashoffset"><tt>style.dashOffset</tt></a> of the path item or those of the options, and returns them as a new group of open paths with the path item&rsquo;s style, without its dash pattern. The pattern starts over on each path of a compound path, and the dashes keep the parts of the paths&rsquo; stroke profiles. As with the boolean operations, the path item&rsquo;s matrix is applied first.</p>
7543
8313
  <ul class="member-list">
7544
8314
  <h4>Options:</h4>
7545
- <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>
7546
- <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. &mdash;&nbsp;default: <tt>true</tt></li>
8315
+ <li><tt>options.dashArray: Array of <tt>Numbers</tt></tt> &mdash; the lengths of the dashes and the gaps between them &mdash;&nbsp;default: <tt>this.dashArray</tt></li>
8316
+ <li><tt>options.dashOffset: <tt>Number</tt></tt> &mdash; the offset into the pattern at which the dashes start &mdash;&nbsp;default: <tt>this.dashOffset</tt></li>
8317
+ <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the resulting group should be inserted back into the scene graph, above this path item &mdash;&nbsp;default: <tt>true</tt></li>
7547
8318
  </ul>
7548
8319
 
7549
8320
  <ul class="member-list">
7550
8321
  <h4>Parameters:</h4>
7551
8322
 
7552
- <li>
7553
- <tt>path:</tt>
7554
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7555
- &mdash;&nbsp;the path to divide by
7556
-
7557
- </li>
7558
-
7559
8323
  <li>
7560
8324
  <tt>options:</tt>
7561
8325
  <tt>Object</tt>
7562
- &mdash;&nbsp;the boolean operation options
8326
+ &mdash;&nbsp;the dash options
7563
8327
  &mdash;&nbsp;optional
7564
8328
  </li>
7565
8329
 
@@ -7570,7 +8334,7 @@ result.fillColor = 'red';
7570
8334
  <h4>Returns:</h4>
7571
8335
 
7572
8336
  <li>
7573
- <tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt>&nbsp;&mdash;&nbsp;the resulting path item
8337
+ <tt><a href="../classes/Group.html"><tt>Group</tt></a></tt>&nbsp;&mdash;&nbsp;the dashes, as a new group of paths
7574
8338
  </li>
7575
8339
 
7576
8340
 
@@ -7579,55 +8343,34 @@ result.fillColor = 'red';
7579
8343
 
7580
8344
 
7581
8345
 
7582
-
7583
- </div>
7584
- </div>
7585
- </div>
7586
-
7587
-
7588
- <div id="reorient" class="member">
7589
- <div class="member-link">
7590
- <a name="reorient" href="#reorient"><tt><b>reorient</b>([nonZero[, clockwise]])</tt></a>
7591
- </div>
7592
- <div class="member-description hidden">
7593
- <div class="member-text">
7594
- <p>Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting them so that they are of different winding direction than their containing paths, except for disjoint sub-paths, i.e. islands, which are oriented so that they have the same winding direction as the the biggest path.</p>
7595
-
7596
-
7597
- <ul class="member-list">
7598
- <h4>Parameters:</h4>
7599
-
7600
- <li>
7601
- <tt>nonZero:</tt>
7602
- <tt>Boolean</tt>
7603
- &mdash;&nbsp;controls if the non-zero fill-rule is to be applied, by counting the winding of each nested path and discarding sub-paths that do not contribute to the final result
7604
- &mdash;&nbsp;optional, default: <tt>false</tt>
7605
- </li>
7606
-
7607
- <li>
7608
- <tt>clockwise:</tt>
7609
- <tt>Boolean</tt>
7610
- &mdash;&nbsp;if provided, the orientation of the root paths will be set to the orientation specified by <code>clockwise</code>, otherwise the orientation of the largest root child is used.
7611
- &mdash;&nbsp;optional
7612
- </li>
7613
-
7614
- </ul>
8346
+ <h4>Example:</h4>
7615
8347
 
7616
-
7617
- <ul class="member-list">
7618
- <h4>Returns:</h4>
7619
-
7620
- <li>
7621
- <tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt>&nbsp;&mdash;&nbsp;a reference to the item itself, reoriented
7622
- </li>
8348
+ <div class="paperscript split">
7623
8349
 
7624
-
7625
- </ul>
8350
+ <div class="buttons">
8351
+ <div class="button run">Run</div>
8352
+ </div>
7626
8353
 
8354
+ <script type="text/paperscript" canvas="canvas-71">
8355
+ var path = new Path.Circle({
8356
+ center: [80, 50],
8357
+ radius: 35,
8358
+ strokeColor: 'black',
8359
+ strokeWidth: 4,
8360
+ dashArray: [12, 6]
8361
+ });
8362
+ // Turn every other dash red:
8363
+ var dashes = path.dash();
8364
+ dashes.children.forEach(function(dash, i) {
8365
+ if (i % 2)
8366
+ dash.strokeColor = 'red';
8367
+ });
8368
+ path.remove();
8369
+ </script>
8370
+ <div class="canvas"><canvas width="516" height="100" id="canvas-71"></canvas></div>
8371
+ </div>
7627
8372
 
7628
8373
 
7629
-
7630
-
7631
8374
  </div>
7632
8375
  </div>
7633
8376
  </div>
@@ -7692,7 +8435,7 @@ result.fillColor = 'red';
7692
8435
  <div class="button run">Run</div>
7693
8436
  </div>
7694
8437
 
7695
- <script type="text/paperscript" canvas="canvas-66">
8438
+ <script type="text/paperscript" canvas="canvas-72">
7696
8439
  var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
7697
8440
  path.strokeColor = 'black';
7698
8441
 
@@ -7715,7 +8458,7 @@ function onFrame(event) {
7715
8458
  }
7716
8459
  }
7717
8460
  </script>
7718
- <div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
8461
+ <div class="canvas"><canvas width="516" height="100" id="canvas-72"></canvas></div>
7719
8462
  </div>
7720
8463
 
7721
8464
 
@@ -7856,7 +8599,7 @@ function onFrame(event) {
7856
8599
  <div class="button run">Run</div>
7857
8600
  </div>
7858
8601
 
7859
- <script type="text/paperscript" canvas="canvas-67">
8602
+ <script type="text/paperscript" canvas="canvas-73">
7860
8603
  var star = new Path.Star({
7861
8604
  center: view.center,
7862
8605
  points: 10,
@@ -7880,7 +8623,7 @@ function onMouseMove(event) {
7880
8623
  circle.position = nearestPoint;
7881
8624
  }
7882
8625
  </script>
7883
- <div class="canvas"><canvas width="516" height="200" id="canvas-67"></canvas></div>
8626
+ <div class="canvas"><canvas width="516" height="200" id="canvas-73"></canvas></div>
7884
8627
  </div>
7885
8628
 
7886
8629
 
@@ -7943,7 +8686,7 @@ function onMouseMove(event) {
7943
8686
  <div class="button run">Run</div>
7944
8687
  </div>
7945
8688
 
7946
- <script type="text/paperscript" canvas="canvas-68">
8689
+ <script type="text/paperscript" canvas="canvas-74">
7947
8690
  // Create a circle shaped path at { x: 80, y: 50 }
7948
8691
  // with a radius of 35:
7949
8692
  var path = new Path.Circle({
@@ -7961,7 +8704,7 @@ copy.position.x += 150;
7961
8704
  // Flatten the copied path, with a maximum error of 4 points:
7962
8705
  copy.flatten(4);
7963
8706
  </script>
7964
- <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
8707
+ <div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
7965
8708
  </div>
7966
8709
 
7967
8710
 
@@ -8039,7 +8782,7 @@ copy.flatten(4);
8039
8782
  <div class="button run">Run</div>
8040
8783
  </div>
8041
8784
 
8042
- <script type="text/paperscript" canvas="canvas-69">
8785
+ <script type="text/paperscript" canvas="canvas-75">
8043
8786
  // Create a rectangular path with its top-left point at
8044
8787
  // {x: 30, y: 25} and a size of {width: 50, height: 50}:
8045
8788
  var path = new Path.Rectangle({
@@ -8058,7 +8801,7 @@ copy.position.x += 100;
8058
8801
  // Smooth the segments of the copy:
8059
8802
  copy.smooth({ type: 'continuous' });
8060
8803
  </script>
8061
- <div class="canvas"><canvas width="516" height="100" id="canvas-69"></canvas></div>
8804
+ <div class="canvas"><canvas width="516" height="100" id="canvas-75"></canvas></div>
8062
8805
  </div>
8063
8806
 
8064
8807
 
@@ -8070,7 +8813,7 @@ copy.smooth({ type: 'continuous' });
8070
8813
  <div class="button run">Run</div>
8071
8814
  </div>
8072
8815
 
8073
- <script type="text/paperscript" canvas="canvas-70">
8816
+ <script type="text/paperscript" canvas="canvas-76">
8074
8817
  var path = new Path();
8075
8818
  path.strokeColor = 'black';
8076
8819
 
@@ -8095,7 +8838,7 @@ copy.fullySelected = true;
8095
8838
  // Smooth the path using centripetal Catmull-Rom splines:
8096
8839
  copy.smooth({ type: 'catmull-rom', factor: 0.5 });
8097
8840
  </script>
8098
- <div class="canvas"><canvas width="516" height="220" id="canvas-70"></canvas></div>
8841
+ <div class="canvas"><canvas width="516" height="220" id="canvas-76"></canvas></div>
8099
8842
  </div>
8100
8843
 
8101
8844
 
@@ -8107,7 +8850,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
8107
8850
  <div class="button run">Run</div>
8108
8851
  </div>
8109
8852
 
8110
- <script type="text/paperscript" canvas="canvas-71">
8853
+ <script type="text/paperscript" canvas="canvas-77">
8111
8854
  // Create 5 rectangles, next to each other:
8112
8855
  var paths = [];
8113
8856
  for (var i = 0; i < 5; i++) {
@@ -8137,7 +8880,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
8137
8880
  // Smooth a range, using negative indices:
8138
8881
  paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8139
8882
  </script>
8140
- <div class="canvas"><canvas width="516" height="110" id="canvas-71"></canvas></div>
8883
+ <div class="canvas"><canvas width="516" height="110" id="canvas-77"></canvas></div>
8141
8884
  </div>
8142
8885
 
8143
8886
 
@@ -8148,22 +8891,28 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8148
8891
 
8149
8892
  <div id="simplify" class="member">
8150
8893
  <div class="member-link">
8151
- <a name="simplify" href="#simplify"><tt><b>simplify</b>([tolerance])</tt></a>
8894
+ <a name="simplify" href="#simplify"><tt><b>simplify</b>([options])</tt></a>
8152
8895
  </div>
8153
8896
  <div class="member-description hidden">
8154
8897
  <div class="member-text">
8155
8898
  <p>Fits a sequence of as few curves as possible through the path&rsquo;s anchor points, ignoring the path items&rsquo;s curve-handles, with an allowed maximum error. When called on <a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a> items, each of the nested paths is simplified. On <a href="../classes/Path.html"><tt>Path</tt></a> items, the <a href="../classes/Path.html#segments"><tt>path.segments</tt></a> array is processed and replaced by the resulting sequence of fitted curves.</p>
8156
8899
  <p>This method can be used to process and simplify the point data received from a mouse or touch device.</p>
8157
-
8900
+ <p>With <code>options.from</code> and <code>options.to</code>, only the segments in that range are replaced. The fitted curves join the curves outside of the range tangentially where these have handles.</p>
8901
+ <ul class="member-list">
8902
+ <h4>Options:</h4>
8903
+ <li><tt>options.tolerance: <tt>Number</tt></tt> &mdash; the allowed maximum error when fitting the curves through the segment points &mdash;&nbsp;default: <tt>2.5</tt></li>
8904
+ <li><tt>options.from: <tt>Number</tt>⟋<a href="../classes/Segment.html"><tt>Segment</tt></a>⟋<a href="../classes/Curve.html"><tt>Curve</tt></a></tt> &mdash; the segment or curve at which to start simplifying, if not the full path shall be simplified (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path.</li>
8905
+ <li><tt>options.to: <tt>Number</tt>⟋<a href="../classes/Segment.html"><tt>Segment</tt></a>⟋<a href="../classes/Curve.html"><tt>Curve</tt></a></tt> &mdash; the segment or curve up to which to simplify (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path.</li>
8906
+ </ul>
8158
8907
 
8159
8908
  <ul class="member-list">
8160
8909
  <h4>Parameters:</h4>
8161
8910
 
8162
8911
  <li>
8163
- <tt>tolerance:</tt>
8164
- <tt>Number</tt>
8165
- &mdash;&nbsp;the allowed maximum error when fitting the curves through the segment points
8166
- &mdash;&nbsp;optional, default: <tt>2.5</tt>
8912
+ <tt>options:</tt>
8913
+ <tt>Object</tt>⟋<tt>Number</tt>
8914
+ &mdash;&nbsp;the simplification options, or the tolerance as a number
8915
+ &mdash;&nbsp;optional
8167
8916
  </li>
8168
8917
 
8169
8918
  </ul>
@@ -8190,7 +8939,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8190
8939
  <div class="button run">Run</div>
8191
8940
  </div>
8192
8941
 
8193
- <script type="text/paperscript" canvas="canvas-72">
8942
+ <script type="text/paperscript" canvas="canvas-78">
8194
8943
  var path;
8195
8944
  function onMouseDown(event) {
8196
8945
  // If we already made a path before, deselect it:
@@ -8220,7 +8969,7 @@ function onMouseUp(event) {
8220
8969
  path.selected = true;
8221
8970
  }
8222
8971
  </script>
8223
- <div class="canvas"><canvas width="516" height="300" id="canvas-72"></canvas></div>
8972
+ <div class="canvas"><canvas width="516" height="300" id="canvas-78"></canvas></div>
8224
8973
  </div>
8225
8974
 
8226
8975
 
@@ -8419,7 +9168,7 @@ function onMouseUp(event) {
8419
9168
  <div class="button run">Run</div>
8420
9169
  </div>
8421
9170
 
8422
- <script type="text/paperscript" canvas="canvas-73">
9171
+ <script type="text/paperscript" canvas="canvas-79">
8423
9172
  var path = new Path();
8424
9173
  path.strokeColor = 'black';
8425
9174
 
@@ -8439,7 +9188,7 @@ path.arcTo(throughPoint, toPoint);
8439
9188
  var circle = new Path.Circle(throughPoint, 3);
8440
9189
  circle.fillColor = 'red';
8441
9190
  </script>
8442
- <div class="canvas"><canvas width="516" height="100" id="canvas-73"></canvas></div>
9191
+ <div class="canvas"><canvas width="516" height="100" id="canvas-79"></canvas></div>
8443
9192
  </div>
8444
9193
 
8445
9194
 
@@ -8451,7 +9200,7 @@ circle.fillColor = 'red';
8451
9200
  <div class="button run">Run</div>
8452
9201
  </div>
8453
9202
 
8454
- <script type="text/paperscript" canvas="canvas-74">
9203
+ <script type="text/paperscript" canvas="canvas-80">
8455
9204
  var myPath;
8456
9205
  function onMouseDrag(event) {
8457
9206
  // If we created a path before, remove it:
@@ -8479,7 +9228,7 @@ function onMouseUp(event) {
8479
9228
  myPath.fillColor = 'black';
8480
9229
  }
8481
9230
  </script>
8482
- <div class="canvas"><canvas width="516" height="300" id="canvas-74"></canvas></div>
9231
+ <div class="canvas"><canvas width="516" height="300" id="canvas-80"></canvas></div>
8483
9232
  </div>
8484
9233
 
8485
9234
 
@@ -8528,7 +9277,7 @@ function onMouseUp(event) {
8528
9277
  <div class="button run">Run</div>
8529
9278
  </div>
8530
9279
 
8531
- <script type="text/paperscript" canvas="canvas-75">
9280
+ <script type="text/paperscript" canvas="canvas-81">
8532
9281
  var path = new Path();
8533
9282
  path.strokeColor = 'black';
8534
9283
 
@@ -8543,7 +9292,7 @@ path2.add(new Point(180, 25));
8543
9292
  // we pass `false` as the second argument to arcTo:
8544
9293
  path2.arcTo(new Point(280, 25), false);
8545
9294
  </script>
8546
- <div class="canvas"><canvas width="516" height="100" id="canvas-75"></canvas></div>
9295
+ <div class="canvas"><canvas width="516" height="100" id="canvas-81"></canvas></div>
8547
9296
  </div>
8548
9297
 
8549
9298
 
@@ -8555,7 +9304,7 @@ path2.arcTo(new Point(280, 25), false);
8555
9304
  <div class="button run">Run</div>
8556
9305
  </div>
8557
9306
 
8558
- <script type="text/paperscript" canvas="canvas-76">
9307
+ <script type="text/paperscript" canvas="canvas-82">
8559
9308
  var myPath;
8560
9309
 
8561
9310
  // The mouse has to move at least 20 points before
@@ -8576,7 +9325,158 @@ function onMouseDrag(event) {
8576
9325
  myPath.arcTo(event.point);
8577
9326
  }
8578
9327
  </script>
8579
- <div class="canvas"><canvas width="516" height="300" id="canvas-76"></canvas></div>
9328
+ <div class="canvas"><canvas width="516" height="300" id="canvas-82"></canvas></div>
9329
+ </div>
9330
+
9331
+
9332
+ </div>
9333
+ </div>
9334
+ </div>
9335
+
9336
+
9337
+ <div id="arcaround-center-angle" class="member">
9338
+ <div class="member-link">
9339
+ <a name="arcaround-center-angle" href="#arcaround-center-angle"><tt><b>arcAround</b>(center, angle)</tt></a>
9340
+ </div>
9341
+ <div class="member-description hidden">
9342
+ <div class="member-text">
9343
+ <p>Adds an arc that sweeps the specified angle around the specified <code>center</code> point, from the position of the last segment in the path, by adding one or more segments to the path. Positive angles draw the arc in clockwise direction, negative ones in anticlockwise direction.</p>
9344
+
9345
+
9346
+ <ul class="member-list">
9347
+ <h4>Parameters:</h4>
9348
+
9349
+ <li>
9350
+ <tt>center:</tt>
9351
+ <a href="../classes/Point.html"><tt>Point</tt></a>
9352
+ &mdash;&nbsp;the center of the arc
9353
+
9354
+ </li>
9355
+
9356
+ <li>
9357
+ <tt>angle:</tt>
9358
+ <tt>Number</tt>
9359
+ &mdash;&nbsp;the angle in degrees that the arc sweeps over
9360
+
9361
+ </li>
9362
+
9363
+ </ul>
9364
+
9365
+
9366
+
9367
+
9368
+
9369
+ <h4>Example:</h4>
9370
+
9371
+ <div class="paperscript split">
9372
+
9373
+ <div class="buttons">
9374
+ <div class="button run">Run</div>
9375
+ </div>
9376
+
9377
+ <script type="text/paperscript" canvas="canvas-83">
9378
+ var path = new Path();
9379
+ path.strokeColor = 'black';
9380
+ path.add(new Point(30, 75));
9381
+ path.lineTo(new Point(80, 75));
9382
+
9383
+ // Draw a half circle around (105, 75) and continue on the other side:
9384
+ path.arcAround(new Point(105, 75), 180);
9385
+ path.lineTo(new Point(180, 75));
9386
+
9387
+ // Draw a full circle around (230, 75):
9388
+ var circle = new Path();
9389
+ circle.strokeColor = 'red';
9390
+ circle.add(new Point(250, 75));
9391
+ circle.arcAround(new Point(230, 75), 360);
9392
+ </script>
9393
+ <div class="canvas"><canvas width="516" height="100" id="canvas-83"></canvas></div>
9394
+ </div>
9395
+
9396
+
9397
+ </div>
9398
+ </div>
9399
+ </div>
9400
+
9401
+
9402
+ <div id="arctowards-to" class="member">
9403
+ <div class="member-link">
9404
+ <a name="arctowards-to" href="#arctowards-to"><tt><b>arcTowards</b>(to)</tt></a>
9405
+ </div>
9406
+ <div class="member-description hidden">
9407
+ <div class="member-text">
9408
+ <p>Adds an arc from the position of the last segment in the path to the specified point, by adding one or more segments to the path. The arc continues in the direction in which the path ends, without a corner.</p>
9409
+
9410
+
9411
+ <ul class="member-list">
9412
+ <h4>Parameters:</h4>
9413
+
9414
+ <li>
9415
+ <tt>to:</tt>
9416
+ <a href="../classes/Point.html"><tt>Point</tt></a>
9417
+ &mdash;&nbsp;the point where the arc should end
9418
+
9419
+ </li>
9420
+
9421
+ </ul>
9422
+
9423
+
9424
+
9425
+
9426
+
9427
+ <h4>Example:</h4>
9428
+
9429
+ <div class="paperscript split">
9430
+
9431
+ <div class="buttons">
9432
+ <div class="button run">Run</div>
9433
+ </div>
9434
+
9435
+ <script type="text/paperscript" canvas="canvas-84">
9436
+ var path = new Path();
9437
+ path.strokeColor = 'black';
9438
+ path.add(new Point(30, 125));
9439
+ path.lineTo(new Point(80, 125));
9440
+
9441
+ // Each arc continues smoothly from where the path ends:
9442
+ path.arcTowards(new Point(130, 75));
9443
+ path.arcTowards(new Point(230, 75));
9444
+ path.lineTo(new Point(230, 125));
9445
+ </script>
9446
+ <div class="canvas"><canvas width="516" height="100" id="canvas-84"></canvas></div>
9447
+ </div>
9448
+
9449
+
9450
+ <h4>Example:<span class="description">Interactive example. Click and drag in the view below:</span></h4>
9451
+
9452
+ <div class="paperscript split">
9453
+
9454
+ <div class="buttons">
9455
+ <div class="button run">Run</div>
9456
+ </div>
9457
+
9458
+ <script type="text/paperscript" canvas="canvas-85">
9459
+ var myPath;
9460
+
9461
+ // The mouse has to move at least 20 points before
9462
+ // the next mouse drag event is fired:
9463
+ tool.minDistance = 20;
9464
+
9465
+ // When the user clicks, create a new path that starts
9466
+ // with a horizontal line ending at the mouse position:
9467
+ function onMouseDown(event) {
9468
+ myPath = new Path();
9469
+ myPath.strokeColor = 'black';
9470
+ myPath.add(event.point - [20, 0], event.point);
9471
+ }
9472
+
9473
+ // On each mouse drag event, continue the path smoothly
9474
+ // with an arc to the current position of the mouse:
9475
+ function onMouseDrag(event) {
9476
+ myPath.arcTowards(event.point);
9477
+ }
9478
+ </script>
9479
+ <div class="canvas"><canvas width="516" height="300" id="canvas-85"></canvas></div>
8580
9480
  </div>
8581
9481
 
8582
9482
 
@@ -8632,7 +9532,7 @@ function onMouseDrag(event) {
8632
9532
  <div class="button run">Run</div>
8633
9533
  </div>
8634
9534
 
8635
- <script type="text/paperscript" canvas="canvas-77">
9535
+ <script type="text/paperscript" canvas="canvas-86">
8636
9536
  var myPath;
8637
9537
  function onMouseMove(event) {
8638
9538
  // If we created a path before, remove it:
@@ -8653,7 +9553,7 @@ function onMouseMove(event) {
8653
9553
  myPath.selected = true;
8654
9554
  }
8655
9555
  </script>
8656
- <div class="canvas"><canvas width="516" height="300" id="canvas-77"></canvas></div>
9556
+ <div class="canvas"><canvas width="516" height="300" id="canvas-86"></canvas></div>
8657
9557
  </div>
8658
9558
 
8659
9559
 
@@ -8838,7 +9738,7 @@ function onMouseMove(event) {
8838
9738
  <div class="button run">Run</div>
8839
9739
  </div>
8840
9740
 
8841
- <script type="text/paperscript" canvas="canvas-78">
9741
+ <script type="text/paperscript" canvas="canvas-87">
8842
9742
  var path = new Path();
8843
9743
  path.strokeColor = 'black';
8844
9744
 
@@ -8852,7 +9752,7 @@ path.lineBy(50, 0);
8852
9752
  // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
8853
9753
  path.lineBy(0, 50);
8854
9754
  </script>
8855
- <div class="canvas"><canvas width="516" height="100" id="canvas-78"></canvas></div>
9755
+ <div class="canvas"><canvas width="516" height="100" id="canvas-87"></canvas></div>
8856
9756
  </div>
8857
9757
 
8858
9758
 
@@ -8864,7 +9764,7 @@ path.lineBy(0, 50);
8864
9764
  <div class="button run">Run</div>
8865
9765
  </div>
8866
9766
 
8867
- <script type="text/paperscript" canvas="canvas-79">
9767
+ <script type="text/paperscript" canvas="canvas-88">
8868
9768
  var path = new Path();
8869
9769
  path.strokeColor = 'black';
8870
9770
 
@@ -8890,7 +9790,7 @@ path.smooth();
8890
9790
  // the construction of the path:
8891
9791
  // path.selected = true;
8892
9792
  </script>
8893
- <div class="canvas"><canvas width="516" height="300" id="canvas-79"></canvas></div>
9793
+ <div class="canvas"><canvas width="516" height="300" id="canvas-88"></canvas></div>
8894
9794
  </div>
8895
9795
 
8896
9796
 
@@ -9109,7 +10009,7 @@ path.smooth();
9109
10009
 
9110
10010
  <!-- =========================== copyright notice ========================== -->
9111
10011
  <p class="footer">
9112
- Paper.js v0.15.0<br>
10012
+ Paper.js v0.17.0<br>
9113
10013
  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>
9114
10014
  <div class="content-end"></div>
9115
10015