paper 0.16.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 (63) hide show
  1. package/CHANGELOG.md +95 -0
  2. package/dist/docs/assets/js/paper.js +4565 -733
  3. package/dist/docs/classes/AreaText.html +720 -242
  4. package/dist/docs/classes/ChangeFlag.html +1 -1
  5. package/dist/docs/classes/Color.html +218 -21
  6. package/dist/docs/classes/CompoundPath.html +1146 -296
  7. package/dist/docs/classes/Curve.html +1 -1
  8. package/dist/docs/classes/CurveLocation.html +1 -1
  9. package/dist/docs/classes/DrawEvent.html +69 -0
  10. package/dist/docs/classes/Effect.html +434 -0
  11. package/dist/docs/classes/EffectInstance.html +304 -0
  12. package/dist/docs/classes/Event.html +1 -1
  13. package/dist/docs/classes/Gradient.html +1 -1
  14. package/dist/docs/classes/GradientStop.html +1 -1
  15. package/dist/docs/classes/Group.html +792 -243
  16. package/dist/docs/classes/HitResult.html +1 -1
  17. package/dist/docs/classes/HostItem.html +720 -242
  18. package/dist/docs/classes/Item.html +777 -242
  19. package/dist/docs/classes/Key.html +1 -1
  20. package/dist/docs/classes/KeyEvent.html +1 -1
  21. package/dist/docs/classes/Layer.html +734 -185
  22. package/dist/docs/classes/Matrix.html +1 -1
  23. package/dist/docs/classes/MouseEvent.html +1 -1
  24. package/dist/docs/classes/PaperScope.html +1 -1
  25. package/dist/docs/classes/PaperScript.html +4 -2
  26. package/dist/docs/classes/Path.html +1195 -252
  27. package/dist/docs/classes/PathItem.html +1148 -298
  28. package/dist/docs/classes/PathText.html +720 -242
  29. package/dist/docs/classes/PatternDefinition.html +367 -0
  30. package/dist/docs/classes/Point.html +1 -1
  31. package/dist/docs/classes/PointText.html +720 -242
  32. package/dist/docs/classes/Project.html +177 -7
  33. package/dist/docs/classes/Raster.html +720 -242
  34. package/dist/docs/classes/Rectangle.html +1 -1
  35. package/dist/docs/classes/Segment.html +3 -3
  36. package/dist/docs/classes/Shape.html +720 -242
  37. package/dist/docs/classes/Size.html +1 -1
  38. package/dist/docs/classes/StrokeProfileStop.html +346 -0
  39. package/dist/docs/classes/Style.html +1 -1
  40. package/dist/docs/classes/SymbolDefinition.html +28 -2
  41. package/dist/docs/classes/SymbolItem.html +720 -242
  42. package/dist/docs/classes/TextItem.html +720 -242
  43. package/dist/docs/classes/TextRange.html +1 -1
  44. package/dist/docs/classes/TextStory.html +1 -1
  45. package/dist/docs/classes/Tool.html +2 -2
  46. package/dist/docs/classes/ToolEvent.html +1 -1
  47. package/dist/docs/classes/Tween.html +1 -1
  48. package/dist/docs/classes/View.html +2 -2
  49. package/dist/docs/classes/global.html +1 -1
  50. package/dist/docs/classes/index.html +2 -2
  51. package/dist/docs/index.html +1 -1
  52. package/dist/node/browser.js +15 -0
  53. package/dist/paper-core.js +4476 -674
  54. package/dist/paper-core.min.js +3 -3
  55. package/dist/paper-full.js +4565 -733
  56. package/dist/paper-full.min.js +3 -3
  57. package/dist/paper-hosted.js +5111 -823
  58. package/dist/paper.d.ts +898 -47
  59. package/examples/Paperjs.org/LiveEffects.html +366 -0
  60. package/examples/Paperjs.org/Offsetting.html +379 -0
  61. package/examples/Paperjs.org/StrokeProfiles.html +706 -0
  62. package/examples/Scripts/Patterns.html +57 -0
  63. package/package.json +5 -3
@@ -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
 
@@ -2392,7 +2477,7 @@ path.dashArray = [10, 4];
2392
2477
  <div class="button run">Run</div>
2393
2478
  </div>
2394
2479
 
2395
- <script type="text/paperscript" canvas="canvas-21">
2480
+ <script type="text/paperscript" canvas="canvas-22">
2396
2481
  // Create a circle shaped path at { x: 80, y: 50 }
2397
2482
  // with a radius of 35:
2398
2483
  var circle = new Path.Circle({
@@ -2403,7 +2488,7 @@ var circle = new Path.Circle({
2403
2488
  // Set the fill color of the circle to RGB red:
2404
2489
  circle.fillColor = new Color(1, 0, 0);
2405
2490
  </script>
2406
- <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>
2407
2492
  </div>
2408
2493
 
2409
2494
 
@@ -2478,7 +2563,7 @@ circle.fillColor = new Color(1, 0, 0);
2478
2563
  <div class="button run">Run</div>
2479
2564
  </div>
2480
2565
 
2481
- <script type="text/paperscript" canvas="canvas-22">
2566
+ <script type="text/paperscript" canvas="canvas-23">
2482
2567
  var circle = new Path.Circle({
2483
2568
  center: [80, 50],
2484
2569
  radius: 35,
@@ -2491,7 +2576,7 @@ var circle = new Path.Circle({
2491
2576
  shadowOffset: new Point(5, 5)
2492
2577
  });
2493
2578
  </script>
2494
- <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>
2495
2580
  </div>
2496
2581
 
2497
2582
 
@@ -2632,7 +2717,7 @@ var circle = new Path.Circle({
2632
2717
  <div class="button run">Run</div>
2633
2718
  </div>
2634
2719
 
2635
- <script type="text/paperscript" canvas="canvas-23">
2720
+ <script type="text/paperscript" canvas="canvas-24">
2636
2721
  // Create a rectangle shaped path with its top left point at:
2637
2722
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
2638
2723
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -2643,7 +2728,7 @@ path.onFrame = function(event) {
2643
2728
  this.rotate(3);
2644
2729
  }
2645
2730
  </script>
2646
- <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>
2647
2732
  </div>
2648
2733
 
2649
2734
 
@@ -2687,7 +2772,7 @@ path.onFrame = function(event) {
2687
2772
  <div class="button run">Run</div>
2688
2773
  </div>
2689
2774
 
2690
- <script type="text/paperscript" canvas="canvas-24">
2775
+ <script type="text/paperscript" canvas="canvas-25">
2691
2776
  // Create a circle shaped path at the center of the view:
2692
2777
  var path = new Path.Circle({
2693
2778
  center: view.center,
@@ -2701,7 +2786,7 @@ path.onMouseDown = function(event) {
2701
2786
  this.fillColor = 'red';
2702
2787
  }
2703
2788
  </script>
2704
- <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>
2705
2790
  </div>
2706
2791
 
2707
2792
 
@@ -2713,7 +2798,7 @@ path.onMouseDown = function(event) {
2713
2798
  <div class="button run">Run</div>
2714
2799
  </div>
2715
2800
 
2716
- <script type="text/paperscript" canvas="canvas-25">
2801
+ <script type="text/paperscript" canvas="canvas-26">
2717
2802
  // Loop 30 times:
2718
2803
  for (var i = 0; i < 30; i++) {
2719
2804
  // Create a circle shaped path at a random position
@@ -2731,7 +2816,7 @@ for (var i = 0; i < 30; i++) {
2731
2816
  }
2732
2817
  }
2733
2818
  </script>
2734
- <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>
2735
2820
  </div>
2736
2821
 
2737
2822
 
@@ -2775,7 +2860,7 @@ for (var i = 0; i < 30; i++) {
2775
2860
  <div class="button run">Run</div>
2776
2861
  </div>
2777
2862
 
2778
- <script type="text/paperscript" canvas="canvas-26">
2863
+ <script type="text/paperscript" canvas="canvas-27">
2779
2864
  // Create a circle shaped path at the center of the view:
2780
2865
  var path = new Path.Circle({
2781
2866
  center: view.center,
@@ -2788,7 +2873,7 @@ path.onMouseDrag = function(event) {
2788
2873
  path.position += event.delta;
2789
2874
  }
2790
2875
  </script>
2791
- <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>
2792
2877
  </div>
2793
2878
 
2794
2879
 
@@ -2832,7 +2917,7 @@ path.onMouseDrag = function(event) {
2832
2917
  <div class="button run">Run</div>
2833
2918
  </div>
2834
2919
 
2835
- <script type="text/paperscript" canvas="canvas-27">
2920
+ <script type="text/paperscript" canvas="canvas-28">
2836
2921
  // Create a circle shaped path at the center of the view:
2837
2922
  var path = new Path.Circle({
2838
2923
  center: view.center,
@@ -2846,7 +2931,7 @@ path.onMouseUp = function(event) {
2846
2931
  this.fillColor = 'red';
2847
2932
  }
2848
2933
  </script>
2849
- <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>
2850
2935
  </div>
2851
2936
 
2852
2937
 
@@ -2890,7 +2975,7 @@ path.onMouseUp = function(event) {
2890
2975
  <div class="button run">Run</div>
2891
2976
  </div>
2892
2977
 
2893
- <script type="text/paperscript" canvas="canvas-28">
2978
+ <script type="text/paperscript" canvas="canvas-29">
2894
2979
  // Create a circle shaped path at the center of the view:
2895
2980
  var path = new Path.Circle({
2896
2981
  center: view.center,
@@ -2904,7 +2989,7 @@ path.onClick = function(event) {
2904
2989
  this.fillColor = 'red';
2905
2990
  }
2906
2991
  </script>
2907
- <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>
2908
2993
  </div>
2909
2994
 
2910
2995
 
@@ -2916,7 +3001,7 @@ path.onClick = function(event) {
2916
3001
  <div class="button run">Run</div>
2917
3002
  </div>
2918
3003
 
2919
- <script type="text/paperscript" canvas="canvas-29">
3004
+ <script type="text/paperscript" canvas="canvas-30">
2920
3005
  // Loop 30 times:
2921
3006
  for (var i = 0; i < 30; i++) {
2922
3007
  // Create a circle shaped path at a random position
@@ -2934,7 +3019,7 @@ for (var i = 0; i < 30; i++) {
2934
3019
  }
2935
3020
  }
2936
3021
  </script>
2937
- <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>
2938
3023
  </div>
2939
3024
 
2940
3025
 
@@ -2978,7 +3063,7 @@ for (var i = 0; i < 30; i++) {
2978
3063
  <div class="button run">Run</div>
2979
3064
  </div>
2980
3065
 
2981
- <script type="text/paperscript" canvas="canvas-30">
3066
+ <script type="text/paperscript" canvas="canvas-31">
2982
3067
  // Create a circle shaped path at the center of the view:
2983
3068
  var path = new Path.Circle({
2984
3069
  center: view.center,
@@ -2992,7 +3077,7 @@ path.onDoubleClick = function(event) {
2992
3077
  this.fillColor = 'red';
2993
3078
  }
2994
3079
  </script>
2995
- <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>
2996
3081
  </div>
2997
3082
 
2998
3083
 
@@ -3004,7 +3089,7 @@ path.onDoubleClick = function(event) {
3004
3089
  <div class="button run">Run</div>
3005
3090
  </div>
3006
3091
 
3007
- <script type="text/paperscript" canvas="canvas-31">
3092
+ <script type="text/paperscript" canvas="canvas-32">
3008
3093
  // Loop 30 times:
3009
3094
  for (var i = 0; i < 30; i++) {
3010
3095
  // Create a circle shaped path at a random position
@@ -3022,7 +3107,7 @@ for (var i = 0; i < 30; i++) {
3022
3107
  }
3023
3108
  }
3024
3109
  </script>
3025
- <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>
3026
3111
  </div>
3027
3112
 
3028
3113
 
@@ -3066,7 +3151,7 @@ for (var i = 0; i < 30; i++) {
3066
3151
  <div class="button run">Run</div>
3067
3152
  </div>
3068
3153
 
3069
- <script type="text/paperscript" canvas="canvas-32">
3154
+ <script type="text/paperscript" canvas="canvas-33">
3070
3155
  // Create a circle shaped path at the center of the view:
3071
3156
  var path = new Path.Circle({
3072
3157
  center: view.center,
@@ -3080,7 +3165,7 @@ path.onMouseMove = function(event) {
3080
3165
  this.opacity = Math.random();
3081
3166
  }
3082
3167
  </script>
3083
- <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>
3084
3169
  </div>
3085
3170
 
3086
3171
 
@@ -3124,7 +3209,7 @@ path.onMouseMove = function(event) {
3124
3209
  <div class="button run">Run</div>
3125
3210
  </div>
3126
3211
 
3127
- <script type="text/paperscript" canvas="canvas-33">
3212
+ <script type="text/paperscript" canvas="canvas-34">
3128
3213
  // Create a circle shaped path at the center of the view:
3129
3214
  var path = new Path.Circle({
3130
3215
  center: view.center,
@@ -3142,7 +3227,7 @@ path.onMouseLeave = function(event) {
3142
3227
  this.fillColor = 'black';
3143
3228
  }
3144
3229
  </script>
3145
- <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>
3146
3231
  </div>
3147
3232
 
3148
3233
 
@@ -3154,7 +3239,7 @@ path.onMouseLeave = function(event) {
3154
3239
  <div class="button run">Run</div>
3155
3240
  </div>
3156
3241
 
3157
- <script type="text/paperscript" canvas="canvas-34">
3242
+ <script type="text/paperscript" canvas="canvas-35">
3158
3243
  function enter(event) {
3159
3244
  this.fillColor = 'red';
3160
3245
  }
@@ -3176,7 +3261,7 @@ function onMouseDown(event) {
3176
3261
  path.onMouseLeave = leave;
3177
3262
  }
3178
3263
  </script>
3179
- <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>
3180
3265
  </div>
3181
3266
 
3182
3267
 
@@ -3220,7 +3305,7 @@ function onMouseDown(event) {
3220
3305
  <div class="button run">Run</div>
3221
3306
  </div>
3222
3307
 
3223
- <script type="text/paperscript" canvas="canvas-35">
3308
+ <script type="text/paperscript" canvas="canvas-36">
3224
3309
  // Create a circle shaped path at the center of the view:
3225
3310
  var path = new Path.Circle({
3226
3311
  center: view.center,
@@ -3233,7 +3318,7 @@ path.onMouseLeave = function(event) {
3233
3318
  this.fillColor = 'red';
3234
3319
  }
3235
3320
  </script>
3236
- <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>
3237
3322
  </div>
3238
3323
 
3239
3324
 
@@ -3242,49 +3327,35 @@ path.onMouseLeave = function(event) {
3242
3327
  </div>
3243
3328
  </div>
3244
3329
 
3245
- </div>
3246
-
3247
-
3248
- <!-- =========================== inherited methods ========================= -->
3249
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3250
-
3251
3330
 
3252
- <div id="set-props" class="member">
3331
+ <div id="ondraw" class="member">
3253
3332
  <div class="member-link">
3254
- <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>
3255
3334
  </div>
3256
3335
  <div class="member-description hidden">
3336
+
3257
3337
  <div class="member-text">
3258
- <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>
3259
-
3260
-
3261
- <ul class="member-list">
3262
- <h4>Parameters:</h4>
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>
3263
3339
 
3264
- <li>
3265
- <tt>props:</tt>
3266
- <tt>Object</tt>
3267
-
3268
-
3269
- </li>
3270
3340
 
3271
- </ul>
3272
-
3273
3341
 
3274
3342
  <ul class="member-list">
3275
- <h4>Returns:</h4>
3276
-
3277
- <li>
3278
- <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the item itself
3279
- </li>
3280
-
3281
-
3343
+ <h4>Type:</h4>
3344
+ <li>
3345
+ <tt>Function</tt>⟋<tt>null</tt>
3346
+ </li>
3282
3347
  </ul>
3283
-
3284
-
3285
-
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>
3356
+ </ul>
3286
3357
 
3287
- <h4>Example:<span class="description">Setting properties through an object literal</span></h4>
3358
+ <h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
3288
3359
 
3289
3360
  <div class="paperscript split">
3290
3361
 
@@ -3292,35 +3363,436 @@ path.onMouseLeave = function(event) {
3292
3363
  <div class="button run">Run</div>
3293
3364
  </div>
3294
3365
 
3295
- <script type="text/paperscript" canvas="canvas-36">
3296
- var circle = new Path.Circle({
3297
- center: [80, 50],
3298
- radius: 35
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)'
3299
3371
  });
3300
3372
 
3301
- circle.set({
3302
- strokeColor: 'red',
3303
- strokeWidth: 10,
3304
- fillColor: 'black',
3305
- selected: true
3306
- });
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
+ }
3307
3385
  </script>
3308
- <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3386
+ <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3309
3387
  </div>
3310
3388
 
3311
3389
 
3312
3390
  </div>
3391
+
3313
3392
  </div>
3314
3393
  </div>
3315
3394
 
3316
3395
 
3317
- <div id="clone" class="member">
3396
+ <div id="ondrawselection" class="member">
3318
3397
  <div class="member-link">
3319
- <a name="clone" href="#clone"><tt><b>clone</b>([options])</tt></a>
3398
+ <a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
3320
3399
  </div>
3321
3400
  <div class="member-description hidden">
3401
+
3322
3402
  <div class="member-text">
3323
- <p>Clones the item within the same project and places the copy above the item.</p>
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
+
3749
+ <li>
3750
+ <tt><a href="../classes/Item.html"><tt>Item</tt></a></tt>&nbsp;&mdash;&nbsp;the item itself
3751
+ </li>
3752
+
3753
+
3754
+ </ul>
3755
+
3756
+
3757
+
3758
+
3759
+ <h4>Example:<span class="description">Setting properties through an object literal</span></h4>
3760
+
3761
+ <div class="paperscript split">
3762
+
3763
+ <div class="buttons">
3764
+ <div class="button run">Run</div>
3765
+ </div>
3766
+
3767
+ <script type="text/paperscript" canvas="canvas-39">
3768
+ var circle = new Path.Circle({
3769
+ center: [80, 50],
3770
+ radius: 35
3771
+ });
3772
+
3773
+ circle.set({
3774
+ strokeColor: 'red',
3775
+ strokeWidth: 10,
3776
+ fillColor: 'black',
3777
+ selected: true
3778
+ });
3779
+ </script>
3780
+ <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
3781
+ </div>
3782
+
3783
+
3784
+ </div>
3785
+ </div>
3786
+ </div>
3787
+
3788
+
3789
+ <div id="clone" class="member">
3790
+ <div class="member-link">
3791
+ <a name="clone" href="#clone"><tt><b>clone</b>([options])</tt></a>
3792
+ </div>
3793
+ <div class="member-description hidden">
3794
+ <div class="member-text">
3795
+ <p>Clones the item within the same project and places the copy above the item.</p>
3324
3796
  <ul class="member-list">
3325
3797
  <h4>Options:</h4>
3326
3798
  <li><tt>insert: undefined</tt> &mdash; specifies whether the copy should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the original &mdash;&nbsp;default: <tt>true</tt></li>
@@ -3361,7 +3833,7 @@ circle.set({
3361
3833
  <div class="button run">Run</div>
3362
3834
  </div>
3363
3835
 
3364
- <script type="text/paperscript" canvas="canvas-37">
3836
+ <script type="text/paperscript" canvas="canvas-40">
3365
3837
  var circle = new Path.Circle({
3366
3838
  center: [50, 50],
3367
3839
  radius: 10,
@@ -3376,7 +3848,7 @@ for (var i = 0; i < 20; i++) {
3376
3848
  copy.position.x += i * copy.bounds.width;
3377
3849
  }
3378
3850
  </script>
3379
- <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>
3380
3852
  </div>
3381
3853
 
3382
3854
 
@@ -3502,7 +3974,7 @@ for (var i = 0; i < 20; i++) {
3502
3974
  <div class="button run">Run</div>
3503
3975
  </div>
3504
3976
 
3505
- <script type="text/paperscript" canvas="canvas-38">
3977
+ <script type="text/paperscript" canvas="canvas-41">
3506
3978
  var circle = new Path.Circle({
3507
3979
  center: [50, 50],
3508
3980
  radius: 5,
@@ -3519,7 +3991,7 @@ raster.position.x += 100;
3519
3991
  circle.scale(5);
3520
3992
  raster.scale(5);
3521
3993
  </script>
3522
- <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>
3523
3995
  </div>
3524
3996
 
3525
3997
 
@@ -3573,7 +4045,7 @@ raster.scale(5);
3573
4045
  <div class="button run">Run</div>
3574
4046
  </div>
3575
4047
 
3576
- <script type="text/paperscript" canvas="canvas-39">
4048
+ <script type="text/paperscript" canvas="canvas-42">
3577
4049
  var path = new Path.Star({
3578
4050
  center: [50, 50],
3579
4051
  points: 12,
@@ -3594,7 +4066,7 @@ function onMouseDown(event) {
3594
4066
  }
3595
4067
  }
3596
4068
  </script>
3597
- <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>
3598
4070
  </div>
3599
4071
 
3600
4072
 
@@ -4112,11 +4584,17 @@ function onMouseDown(event) {
4112
4584
  </div>
4113
4585
  <div class="member-description hidden">
4114
4586
  <div class="member-text">
4115
- <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>
4116
4588
  <ul class="member-list">
4117
4589
  <h4>Options:</h4>
4118
- <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>
4119
- <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>
4120
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>
4121
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>
4122
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>
@@ -5470,7 +5948,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5470
5948
  <div class="button run">Run</div>
5471
5949
  </div>
5472
5950
 
5473
- <script type="text/paperscript" canvas="canvas-40">
5951
+ <script type="text/paperscript" canvas="canvas-43">
5474
5952
  // Create a rectangle shaped path with its top left
5475
5953
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
5476
5954
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -5479,7 +5957,7 @@ path.fillColor = 'black';
5479
5957
  // Rotate the path by 30 degrees:
5480
5958
  path.rotate(30);
5481
5959
  </script>
5482
- <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>
5483
5961
  </div>
5484
5962
 
5485
5963
 
@@ -5491,7 +5969,7 @@ path.rotate(30);
5491
5969
  <div class="button run">Run</div>
5492
5970
  </div>
5493
5971
 
5494
- <script type="text/paperscript" canvas="canvas-41">
5972
+ <script type="text/paperscript" canvas="canvas-44">
5495
5973
  // Create a rectangle shaped path with its top left
5496
5974
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
5497
5975
  var topLeft = new Point(175, 50);
@@ -5513,7 +5991,7 @@ function onFrame(event) {
5513
5991
  path.rotate(3, view.center);
5514
5992
  }
5515
5993
  </script>
5516
- <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>
5517
5995
  </div>
5518
5996
 
5519
5997
 
@@ -5562,7 +6040,7 @@ function onFrame(event) {
5562
6040
  <div class="button run">Run</div>
5563
6041
  </div>
5564
6042
 
5565
- <script type="text/paperscript" canvas="canvas-42">
6043
+ <script type="text/paperscript" canvas="canvas-45">
5566
6044
  // Create a circle shaped path at { x: 80, y: 50 }
5567
6045
  // with a radius of 20:
5568
6046
  var circle = new Path.Circle({
@@ -5574,7 +6052,7 @@ var circle = new Path.Circle({
5574
6052
  // Scale the path by 150% from its center point
5575
6053
  circle.scale(1.5);
5576
6054
  </script>
5577
- <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>
5578
6056
  </div>
5579
6057
 
5580
6058
 
@@ -5586,7 +6064,7 @@ circle.scale(1.5);
5586
6064
  <div class="button run">Run</div>
5587
6065
  </div>
5588
6066
 
5589
- <script type="text/paperscript" canvas="canvas-43">
6067
+ <script type="text/paperscript" canvas="canvas-46">
5590
6068
  // Create a circle shaped path at { x: 80, y: 50 }
5591
6069
  // with a radius of 20:
5592
6070
  var circle = new Path.Circle({
@@ -5598,7 +6076,7 @@ var circle = new Path.Circle({
5598
6076
  // Scale the path 150% from its bottom left corner
5599
6077
  circle.scale(1.5, circle.bounds.bottomLeft);
5600
6078
  </script>
5601
- <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>
5602
6080
  </div>
5603
6081
 
5604
6082
 
@@ -5654,7 +6132,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
5654
6132
  <div class="button run">Run</div>
5655
6133
  </div>
5656
6134
 
5657
- <script type="text/paperscript" canvas="canvas-44">
6135
+ <script type="text/paperscript" canvas="canvas-47">
5658
6136
  // Create a circle shaped path at { x: 100, y: 50 }
5659
6137
  // with a radius of 20:
5660
6138
  var circle = new Path.Circle({
@@ -5666,7 +6144,7 @@ var circle = new Path.Circle({
5666
6144
  // Scale the path horizontally by 300%
5667
6145
  circle.scale(3, 1);
5668
6146
  </script>
5669
- <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>
5670
6148
  </div>
5671
6149
 
5672
6150
 
@@ -6104,7 +6582,7 @@ circle.scale(3, 1);
6104
6582
  <div class="button run">Run</div>
6105
6583
  </div>
6106
6584
 
6107
- <script type="text/paperscript" canvas="canvas-45">
6585
+ <script type="text/paperscript" canvas="canvas-48">
6108
6586
  // Create a rectangle shaped path with its top left corner
6109
6587
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6110
6588
  var path = new Path.Rectangle({
@@ -6125,7 +6603,7 @@ var circlePath = new Path.Circle({
6125
6603
  // the rectangular path:
6126
6604
  circlePath.fitBounds(path.bounds);
6127
6605
  </script>
6128
- <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>
6129
6607
  </div>
6130
6608
 
6131
6609
 
@@ -6137,7 +6615,7 @@ circlePath.fitBounds(path.bounds);
6137
6615
  <div class="button run">Run</div>
6138
6616
  </div>
6139
6617
 
6140
- <script type="text/paperscript" canvas="canvas-46">
6618
+ <script type="text/paperscript" canvas="canvas-49">
6141
6619
  // Create a rectangle shaped path with its top left corner
6142
6620
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6143
6621
  var path = new Path.Rectangle({
@@ -6158,7 +6636,7 @@ var circlePath = new Path.Circle({
6158
6636
  // the rectangular path:
6159
6637
  circlePath.fitBounds(path.bounds, 'cover');
6160
6638
  </script>
6161
- <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>
6162
6640
  </div>
6163
6641
 
6164
6642
 
@@ -6170,7 +6648,7 @@ circlePath.fitBounds(path.bounds, 'cover');
6170
6648
  <div class="button run">Run</div>
6171
6649
  </div>
6172
6650
 
6173
- <script type="text/paperscript" canvas="canvas-47">
6651
+ <script type="text/paperscript" canvas="canvas-50">
6174
6652
  var path = new Path.Circle({
6175
6653
  center: [80, 50],
6176
6654
  radius: 30,
@@ -6180,7 +6658,7 @@ var path = new Path.Circle({
6180
6658
  // Fit the path to the bounding rectangle of the view:
6181
6659
  path.fitBounds(view.bounds);
6182
6660
  </script>
6183
- <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>
6184
6662
  </div>
6185
6663
 
6186
6664
 
@@ -6206,7 +6684,7 @@ path.fitBounds(view.bounds);
6206
6684
  <li>
6207
6685
  <tt>type:</tt>
6208
6686
  <tt>String</tt>
6209
- &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>
6210
6688
 
6211
6689
  </li>
6212
6690
 
@@ -6241,7 +6719,7 @@ path.fitBounds(view.bounds);
6241
6719
  <div class="button run">Run</div>
6242
6720
  </div>
6243
6721
 
6244
- <script type="text/paperscript" canvas="canvas-48">
6722
+ <script type="text/paperscript" canvas="canvas-51">
6245
6723
  // Create a circle shaped path at the center of the view:
6246
6724
  var path = new Path.Circle({
6247
6725
  center: view.center,
@@ -6259,7 +6737,7 @@ path.on('mouseleave', function() {
6259
6737
  this.fillColor = 'black';
6260
6738
  });
6261
6739
  </script>
6262
- <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>
6263
6741
  </div>
6264
6742
 
6265
6743
 
@@ -6283,7 +6761,7 @@ path.on('mouseleave', function() {
6283
6761
  <li>
6284
6762
  <tt>object:</tt>
6285
6763
  <tt>Object</tt>
6286
- &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>
6287
6765
 
6288
6766
  </li>
6289
6767
 
@@ -6311,7 +6789,7 @@ path.on('mouseleave', function() {
6311
6789
  <div class="button run">Run</div>
6312
6790
  </div>
6313
6791
 
6314
- <script type="text/paperscript" canvas="canvas-49">
6792
+ <script type="text/paperscript" canvas="canvas-52">
6315
6793
  // Create a circle shaped path at the center of the view:
6316
6794
  var path = new Path.Circle({
6317
6795
  center: view.center,
@@ -6329,7 +6807,7 @@ path.on({
6329
6807
  }
6330
6808
  });
6331
6809
  </script>
6332
- <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>
6333
6811
  </div>
6334
6812
 
6335
6813
 
@@ -6341,7 +6819,7 @@ path.on({
6341
6819
  <div class="button run">Run</div>
6342
6820
  </div>
6343
6821
 
6344
- <script type="text/paperscript" canvas="canvas-50">
6822
+ <script type="text/paperscript" canvas="canvas-53">
6345
6823
  var pathHandlers = {
6346
6824
  mouseenter: function(event) {
6347
6825
  this.fillColor = 'red';
@@ -6364,7 +6842,7 @@ function onMouseDown(event) {
6364
6842
  path.on(pathHandlers);
6365
6843
  }
6366
6844
  </script>
6367
- <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>
6368
6846
  </div>
6369
6847
 
6370
6848
 
@@ -6388,7 +6866,7 @@ function onMouseDown(event) {
6388
6866
  <li>
6389
6867
  <tt>type:</tt>
6390
6868
  <tt>String</tt>
6391
- &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>
6392
6870
 
6393
6871
  </li>
6394
6872
 
@@ -6436,7 +6914,7 @@ function onMouseDown(event) {
6436
6914
  <li>
6437
6915
  <tt>object:</tt>
6438
6916
  <tt>Object</tt>
6439
- &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>
6440
6918
 
6441
6919
  </li>
6442
6920
 
@@ -6477,7 +6955,7 @@ function onMouseDown(event) {
6477
6955
  <li>
6478
6956
  <tt>type:</tt>
6479
6957
  <tt>String</tt>
6480
- &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>
6481
6959
 
6482
6960
  </li>
6483
6961
 
@@ -6525,7 +7003,7 @@ function onMouseDown(event) {
6525
7003
  <li>
6526
7004
  <tt>type:</tt>
6527
7005
  <tt>String</tt>
6528
- &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>
6529
7007
 
6530
7008
  </li>
6531
7009
 
@@ -6592,7 +7070,7 @@ function onMouseDown(event) {
6592
7070
  <div class="button run">Run</div>
6593
7071
  </div>
6594
7072
 
6595
- <script type="text/paperscript" canvas="canvas-51">
7073
+ <script type="text/paperscript" canvas="canvas-54">
6596
7074
  function onMouseDrag(event) {
6597
7075
  // Create a circle shaped path at the mouse position,
6598
7076
  // with a radius of 10:
@@ -6609,7 +7087,7 @@ function onMouseDrag(event) {
6609
7087
  });
6610
7088
  }
6611
7089
  </script>
6612
- <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>
6613
7091
  </div>
6614
7092
 
6615
7093
 
@@ -6639,7 +7117,7 @@ function onMouseDrag(event) {
6639
7117
  <div class="button run">Run</div>
6640
7118
  </div>
6641
7119
 
6642
- <script type="text/paperscript" canvas="canvas-52">
7120
+ <script type="text/paperscript" canvas="canvas-55">
6643
7121
  function onMouseMove(event) {
6644
7122
  // Create a circle shaped path at the mouse position,
6645
7123
  // with a radius of 10:
@@ -6653,7 +7131,7 @@ function onMouseMove(event) {
6653
7131
  path.removeOnMove();
6654
7132
  }
6655
7133
  </script>
6656
- <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>
6657
7135
  </div>
6658
7136
 
6659
7137
 
@@ -6683,7 +7161,7 @@ function onMouseMove(event) {
6683
7161
  <div class="button run">Run</div>
6684
7162
  </div>
6685
7163
 
6686
- <script type="text/paperscript" canvas="canvas-53">
7164
+ <script type="text/paperscript" canvas="canvas-56">
6687
7165
  function onMouseDown(event) {
6688
7166
  // Create a circle shaped path at the mouse position,
6689
7167
  // with a radius of 10:
@@ -6697,7 +7175,7 @@ function onMouseDown(event) {
6697
7175
  path.removeOnDown();
6698
7176
  }
6699
7177
  </script>
6700
- <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>
6701
7179
  </div>
6702
7180
 
6703
7181
 
@@ -6727,7 +7205,7 @@ function onMouseDown(event) {
6727
7205
  <div class="button run">Run</div>
6728
7206
  </div>
6729
7207
 
6730
- <script type="text/paperscript" canvas="canvas-54">
7208
+ <script type="text/paperscript" canvas="canvas-57">
6731
7209
  function onMouseDrag(event) {
6732
7210
  // Create a circle shaped path at the mouse position,
6733
7211
  // with a radius of 10:
@@ -6741,7 +7219,7 @@ function onMouseDrag(event) {
6741
7219
  path.removeOnDrag();
6742
7220
  }
6743
7221
  </script>
6744
- <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>
6745
7223
  </div>
6746
7224
 
6747
7225
 
@@ -6771,7 +7249,7 @@ function onMouseDrag(event) {
6771
7249
  <div class="button run">Run</div>
6772
7250
  </div>
6773
7251
 
6774
- <script type="text/paperscript" canvas="canvas-55">
7252
+ <script type="text/paperscript" canvas="canvas-58">
6775
7253
  function onMouseDown(event) {
6776
7254
  // Create a circle shaped path at the mouse position,
6777
7255
  // with a radius of 10:
@@ -6785,7 +7263,7 @@ function onMouseDown(event) {
6785
7263
  path.removeOnUp();
6786
7264
  }
6787
7265
  </script>
6788
- <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>
6789
7267
  </div>
6790
7268
 
6791
7269
 
@@ -6858,7 +7336,7 @@ function onMouseDown(event) {
6858
7336
  <div class="button run">Run</div>
6859
7337
  </div>
6860
7338
 
6861
- <script type="text/paperscript" canvas="canvas-56">
7339
+ <script type="text/paperscript" canvas="canvas-59">
6862
7340
  var path = new Path.Circle({
6863
7341
  radius: view.bounds.height * 0.4,
6864
7342
  center: view.center
@@ -6869,7 +7347,7 @@ path.tween(
6869
7347
  3000
6870
7348
  );
6871
7349
  </script>
6872
- <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>
6873
7351
  </div>
6874
7352
 
6875
7353
 
@@ -6881,7 +7359,7 @@ path.tween(
6881
7359
  <div class="button run">Run</div>
6882
7360
  </div>
6883
7361
 
6884
- <script type="text/paperscript" canvas="canvas-57">
7362
+ <script type="text/paperscript" canvas="canvas-60">
6885
7363
  var path = new Shape.Rectangle({
6886
7364
  fillColor: 'red',
6887
7365
  center: [50, view.center.y],
@@ -6896,7 +7374,7 @@ path.tween({
6896
7374
  duration: 2000
6897
7375
  });
6898
7376
  </script>
6899
- <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>
6900
7378
  </div>
6901
7379
 
6902
7380
 
@@ -6962,7 +7440,7 @@ path.tween({
6962
7440
  <div class="button run">Run</div>
6963
7441
  </div>
6964
7442
 
6965
- <script type="text/paperscript" canvas="canvas-58">
7443
+ <script type="text/paperscript" canvas="canvas-61">
6966
7444
  var path = new Path.Rectangle({
6967
7445
  size: [100, 100],
6968
7446
  position: view.center,
@@ -6976,7 +7454,7 @@ path.tween({
6976
7454
  'segments[2].point.x': '-= 50'
6977
7455
  }, 3000);
6978
7456
  </script>
6979
- <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>
6980
7458
  </div>
6981
7459
 
6982
7460
 
@@ -7035,7 +7513,7 @@ path.tween({
7035
7513
  <div class="button run">Run</div>
7036
7514
  </div>
7037
7515
 
7038
- <script type="text/paperscript" canvas="canvas-59">
7516
+ <script type="text/paperscript" canvas="canvas-62">
7039
7517
  var path = new Path.Circle({
7040
7518
  fillColor: 'blue',
7041
7519
  radius: view.bounds.height * 0.4,
@@ -7051,7 +7529,7 @@ path.tween(2000).onUpdate = function(event) {
7051
7529
  path.interpolate(pathFrom, pathTo, event.factor)
7052
7530
  };
7053
7531
  </script>
7054
- <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>
7055
7533
  </div>
7056
7534
 
7057
7535
 
@@ -7172,7 +7650,7 @@ path.tween(2000).onUpdate = function(event) {
7172
7650
  <div class="button run">Run</div>
7173
7651
  </div>
7174
7652
 
7175
- <script type="text/paperscript" canvas="canvas-60">
7653
+ <script type="text/paperscript" canvas="canvas-63">
7176
7654
  var path = new Path.Circle({
7177
7655
  fillColor: 'blue',
7178
7656
  radius: view.bounds.height * 0.4,
@@ -7180,7 +7658,7 @@ var path = new Path.Circle({
7180
7658
  });
7181
7659
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7182
7660
  </script>
7183
- <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>
7184
7662
  </div>
7185
7663
 
7186
7664
 
@@ -7346,12 +7824,12 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7346
7824
  <div class="button run">Run</div>
7347
7825
  </div>
7348
7826
 
7349
- <script type="text/paperscript" canvas="canvas-61">
7827
+ <script type="text/paperscript" canvas="canvas-64">
7350
7828
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7351
7829
  .unite(new Path.Circle([50, 50], 25));
7352
7830
  result.fillColor = 'red';
7353
7831
  </script>
7354
- <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>
7355
7833
  </div>
7356
7834
 
7357
7835
 
@@ -7363,7 +7841,7 @@ result.fillColor = 'red';
7363
7841
  <div class="button run">Run</div>
7364
7842
  </div>
7365
7843
 
7366
- <script type="text/paperscript" canvas="canvas-62">
7844
+ <script type="text/paperscript" canvas="canvas-65">
7367
7845
  var circles = [];
7368
7846
  for (var i = 0; i < 6; i++) {
7369
7847
  circles.push(new Path.Circle([30 + i * 20, 50], 20));
@@ -7371,7 +7849,7 @@ for (var i = 0; i < 6; i++) {
7371
7849
  var result = circles[0].unite(circles.slice(1));
7372
7850
  result.fillColor = 'red';
7373
7851
  </script>
7374
- <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>
7375
7853
  </div>
7376
7854
 
7377
7855
 
@@ -7434,12 +7912,12 @@ result.fillColor = 'red';
7434
7912
  <div class="button run">Run</div>
7435
7913
  </div>
7436
7914
 
7437
- <script type="text/paperscript" canvas="canvas-63">
7915
+ <script type="text/paperscript" canvas="canvas-66">
7438
7916
  var result = new Path.RegularPolygon([50, 50], 3, 40)
7439
7917
  .intersect(new Path.Circle([50, 50], 25));
7440
7918
  result.fillColor = 'red';
7441
7919
  </script>
7442
- <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>
7443
7921
  </div>
7444
7922
 
7445
7923
 
@@ -7465,16 +7943,254 @@ result.fillColor = 'red';
7465
7943
  <h4>Parameters:</h4>
7466
7944
 
7467
7945
  <li>
7468
- <tt>path:</tt>
7469
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
7470
- &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
7471
8187
 
7472
8188
  </li>
7473
8189
 
7474
8190
  <li>
7475
8191
  <tt>options:</tt>
7476
8192
  <tt>Object</tt>
7477
- &mdash;&nbsp;the boolean operation options
8193
+ &mdash;&nbsp;the offset options
7478
8194
  &mdash;&nbsp;optional
7479
8195
  </li>
7480
8196
 
@@ -7502,12 +8218,13 @@ result.fillColor = 'red';
7502
8218
  <div class="button run">Run</div>
7503
8219
  </div>
7504
8220
 
7505
- <script type="text/paperscript" canvas="canvas-64">
7506
- var result = new Path.RegularPolygon([50, 50], 3, 40)
7507
- .subtract(new Path.Circle([50, 50], 25));
7508
- 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';
7509
8226
  </script>
7510
- <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>
7511
8228
  </div>
7512
8229
 
7513
8230
 
@@ -7516,32 +8233,30 @@ result.fillColor = 'red';
7516
8233
  </div>
7517
8234
 
7518
8235
 
7519
- <div id="exclude-path" class="member">
8236
+ <div id="outline" class="member">
7520
8237
  <div class="member-link">
7521
- <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>
7522
8239
  </div>
7523
8240
  <div class="member-description hidden">
7524
8241
  <div class="member-text">
7525
- <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>
7526
8244
  <ul class="member-list">
7527
8245
  <h4>Options:</h4>
7528
- <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>
7529
8251
  </ul>
7530
8252
 
7531
8253
  <ul class="member-list">
7532
8254
  <h4>Parameters:</h4>
7533
8255
 
7534
- <li>
7535
- <tt>path:</tt>
7536
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
7537
- &mdash;&nbsp;the path or paths to exclude the intersection of
7538
-
7539
- </li>
7540
-
7541
8256
  <li>
7542
8257
  <tt>options:</tt>
7543
8258
  <tt>Object</tt>
7544
- &mdash;&nbsp;the boolean operation options
8259
+ &mdash;&nbsp;the outline options
7545
8260
  &mdash;&nbsp;optional
7546
8261
  </li>
7547
8262
 
@@ -7569,12 +8284,17 @@ result.fillColor = 'red';
7569
8284
  <div class="button run">Run</div>
7570
8285
  </div>
7571
8286
 
7572
- <script type="text/paperscript" canvas="canvas-65">
7573
- var result = new Path.RegularPolygon([50, 50], 3, 40)
7574
- .exclude(new Path.Circle([50, 50], 25));
7575
- 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();
7576
8296
  </script>
7577
- <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>
7578
8298
  </div>
7579
8299
 
7580
8300
 
@@ -7583,33 +8303,27 @@ result.fillColor = 'red';
7583
8303
  </div>
7584
8304
 
7585
8305
 
7586
- <div id="divide-path" class="member">
8306
+ <div id="dash" class="member">
7587
8307
  <div class="member-link">
7588
- <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>
7589
8309
  </div>
7590
8310
  <div class="member-description hidden">
7591
8311
  <div class="member-text">
7592
- <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>
7593
8313
  <ul class="member-list">
7594
8314
  <h4>Options:</h4>
7595
- <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>
7596
- <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>
7597
8318
  </ul>
7598
8319
 
7599
8320
  <ul class="member-list">
7600
8321
  <h4>Parameters:</h4>
7601
8322
 
7602
- <li>
7603
- <tt>path:</tt>
7604
- <a href="../classes/PathItem.html"><tt>PathItem</tt></a>
7605
- &mdash;&nbsp;the path to divide by
7606
-
7607
- </li>
7608
-
7609
8323
  <li>
7610
8324
  <tt>options:</tt>
7611
8325
  <tt>Object</tt>
7612
- &mdash;&nbsp;the boolean operation options
8326
+ &mdash;&nbsp;the dash options
7613
8327
  &mdash;&nbsp;optional
7614
8328
  </li>
7615
8329
 
@@ -7620,7 +8334,7 @@ result.fillColor = 'red';
7620
8334
  <h4>Returns:</h4>
7621
8335
 
7622
8336
  <li>
7623
- <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
7624
8338
  </li>
7625
8339
 
7626
8340
 
@@ -7629,55 +8343,34 @@ result.fillColor = 'red';
7629
8343
 
7630
8344
 
7631
8345
 
7632
-
7633
- </div>
7634
- </div>
7635
- </div>
7636
-
7637
-
7638
- <div id="reorient" class="member">
7639
- <div class="member-link">
7640
- <a name="reorient" href="#reorient"><tt><b>reorient</b>([nonZero[, clockwise]])</tt></a>
7641
- </div>
7642
- <div class="member-description hidden">
7643
- <div class="member-text">
7644
- <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>
7645
-
7646
-
7647
- <ul class="member-list">
7648
- <h4>Parameters:</h4>
7649
-
7650
- <li>
7651
- <tt>nonZero:</tt>
7652
- <tt>Boolean</tt>
7653
- &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
7654
- &mdash;&nbsp;optional, default: <tt>false</tt>
7655
- </li>
7656
-
7657
- <li>
7658
- <tt>clockwise:</tt>
7659
- <tt>Boolean</tt>
7660
- &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.
7661
- &mdash;&nbsp;optional
7662
- </li>
7663
-
7664
- </ul>
8346
+ <h4>Example:</h4>
7665
8347
 
7666
-
7667
- <ul class="member-list">
7668
- <h4>Returns:</h4>
7669
-
7670
- <li>
7671
- <tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt>&nbsp;&mdash;&nbsp;a reference to the item itself, reoriented
7672
- </li>
8348
+ <div class="paperscript split">
7673
8349
 
7674
-
7675
- </ul>
8350
+ <div class="buttons">
8351
+ <div class="button run">Run</div>
8352
+ </div>
7676
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>
7677
8372
 
7678
8373
 
7679
-
7680
-
7681
8374
  </div>
7682
8375
  </div>
7683
8376
  </div>
@@ -7742,7 +8435,7 @@ result.fillColor = 'red';
7742
8435
  <div class="button run">Run</div>
7743
8436
  </div>
7744
8437
 
7745
- <script type="text/paperscript" canvas="canvas-66">
8438
+ <script type="text/paperscript" canvas="canvas-72">
7746
8439
  var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
7747
8440
  path.strokeColor = 'black';
7748
8441
 
@@ -7765,7 +8458,7 @@ function onFrame(event) {
7765
8458
  }
7766
8459
  }
7767
8460
  </script>
7768
- <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>
7769
8462
  </div>
7770
8463
 
7771
8464
 
@@ -7906,7 +8599,7 @@ function onFrame(event) {
7906
8599
  <div class="button run">Run</div>
7907
8600
  </div>
7908
8601
 
7909
- <script type="text/paperscript" canvas="canvas-67">
8602
+ <script type="text/paperscript" canvas="canvas-73">
7910
8603
  var star = new Path.Star({
7911
8604
  center: view.center,
7912
8605
  points: 10,
@@ -7930,7 +8623,7 @@ function onMouseMove(event) {
7930
8623
  circle.position = nearestPoint;
7931
8624
  }
7932
8625
  </script>
7933
- <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>
7934
8627
  </div>
7935
8628
 
7936
8629
 
@@ -7993,7 +8686,7 @@ function onMouseMove(event) {
7993
8686
  <div class="button run">Run</div>
7994
8687
  </div>
7995
8688
 
7996
- <script type="text/paperscript" canvas="canvas-68">
8689
+ <script type="text/paperscript" canvas="canvas-74">
7997
8690
  // Create a circle shaped path at { x: 80, y: 50 }
7998
8691
  // with a radius of 35:
7999
8692
  var path = new Path.Circle({
@@ -8011,7 +8704,7 @@ copy.position.x += 150;
8011
8704
  // Flatten the copied path, with a maximum error of 4 points:
8012
8705
  copy.flatten(4);
8013
8706
  </script>
8014
- <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>
8015
8708
  </div>
8016
8709
 
8017
8710
 
@@ -8089,7 +8782,7 @@ copy.flatten(4);
8089
8782
  <div class="button run">Run</div>
8090
8783
  </div>
8091
8784
 
8092
- <script type="text/paperscript" canvas="canvas-69">
8785
+ <script type="text/paperscript" canvas="canvas-75">
8093
8786
  // Create a rectangular path with its top-left point at
8094
8787
  // {x: 30, y: 25} and a size of {width: 50, height: 50}:
8095
8788
  var path = new Path.Rectangle({
@@ -8108,7 +8801,7 @@ copy.position.x += 100;
8108
8801
  // Smooth the segments of the copy:
8109
8802
  copy.smooth({ type: 'continuous' });
8110
8803
  </script>
8111
- <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>
8112
8805
  </div>
8113
8806
 
8114
8807
 
@@ -8120,7 +8813,7 @@ copy.smooth({ type: 'continuous' });
8120
8813
  <div class="button run">Run</div>
8121
8814
  </div>
8122
8815
 
8123
- <script type="text/paperscript" canvas="canvas-70">
8816
+ <script type="text/paperscript" canvas="canvas-76">
8124
8817
  var path = new Path();
8125
8818
  path.strokeColor = 'black';
8126
8819
 
@@ -8145,7 +8838,7 @@ copy.fullySelected = true;
8145
8838
  // Smooth the path using centripetal Catmull-Rom splines:
8146
8839
  copy.smooth({ type: 'catmull-rom', factor: 0.5 });
8147
8840
  </script>
8148
- <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>
8149
8842
  </div>
8150
8843
 
8151
8844
 
@@ -8157,7 +8850,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
8157
8850
  <div class="button run">Run</div>
8158
8851
  </div>
8159
8852
 
8160
- <script type="text/paperscript" canvas="canvas-71">
8853
+ <script type="text/paperscript" canvas="canvas-77">
8161
8854
  // Create 5 rectangles, next to each other:
8162
8855
  var paths = [];
8163
8856
  for (var i = 0; i < 5; i++) {
@@ -8187,7 +8880,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
8187
8880
  // Smooth a range, using negative indices:
8188
8881
  paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8189
8882
  </script>
8190
- <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>
8191
8884
  </div>
8192
8885
 
8193
8886
 
@@ -8198,22 +8891,28 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8198
8891
 
8199
8892
  <div id="simplify" class="member">
8200
8893
  <div class="member-link">
8201
- <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>
8202
8895
  </div>
8203
8896
  <div class="member-description hidden">
8204
8897
  <div class="member-text">
8205
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>
8206
8899
  <p>This method can be used to process and simplify the point data received from a mouse or touch device.</p>
8207
-
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>
8208
8907
 
8209
8908
  <ul class="member-list">
8210
8909
  <h4>Parameters:</h4>
8211
8910
 
8212
8911
  <li>
8213
- <tt>tolerance:</tt>
8214
- <tt>Number</tt>
8215
- &mdash;&nbsp;the allowed maximum error when fitting the curves through the segment points
8216
- &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
8217
8916
  </li>
8218
8917
 
8219
8918
  </ul>
@@ -8240,7 +8939,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
8240
8939
  <div class="button run">Run</div>
8241
8940
  </div>
8242
8941
 
8243
- <script type="text/paperscript" canvas="canvas-72">
8942
+ <script type="text/paperscript" canvas="canvas-78">
8244
8943
  var path;
8245
8944
  function onMouseDown(event) {
8246
8945
  // If we already made a path before, deselect it:
@@ -8270,7 +8969,7 @@ function onMouseUp(event) {
8270
8969
  path.selected = true;
8271
8970
  }
8272
8971
  </script>
8273
- <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>
8274
8973
  </div>
8275
8974
 
8276
8975
 
@@ -8469,7 +9168,7 @@ function onMouseUp(event) {
8469
9168
  <div class="button run">Run</div>
8470
9169
  </div>
8471
9170
 
8472
- <script type="text/paperscript" canvas="canvas-73">
9171
+ <script type="text/paperscript" canvas="canvas-79">
8473
9172
  var path = new Path();
8474
9173
  path.strokeColor = 'black';
8475
9174
 
@@ -8489,7 +9188,7 @@ path.arcTo(throughPoint, toPoint);
8489
9188
  var circle = new Path.Circle(throughPoint, 3);
8490
9189
  circle.fillColor = 'red';
8491
9190
  </script>
8492
- <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>
8493
9192
  </div>
8494
9193
 
8495
9194
 
@@ -8501,7 +9200,7 @@ circle.fillColor = 'red';
8501
9200
  <div class="button run">Run</div>
8502
9201
  </div>
8503
9202
 
8504
- <script type="text/paperscript" canvas="canvas-74">
9203
+ <script type="text/paperscript" canvas="canvas-80">
8505
9204
  var myPath;
8506
9205
  function onMouseDrag(event) {
8507
9206
  // If we created a path before, remove it:
@@ -8529,7 +9228,7 @@ function onMouseUp(event) {
8529
9228
  myPath.fillColor = 'black';
8530
9229
  }
8531
9230
  </script>
8532
- <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>
8533
9232
  </div>
8534
9233
 
8535
9234
 
@@ -8578,7 +9277,7 @@ function onMouseUp(event) {
8578
9277
  <div class="button run">Run</div>
8579
9278
  </div>
8580
9279
 
8581
- <script type="text/paperscript" canvas="canvas-75">
9280
+ <script type="text/paperscript" canvas="canvas-81">
8582
9281
  var path = new Path();
8583
9282
  path.strokeColor = 'black';
8584
9283
 
@@ -8593,7 +9292,7 @@ path2.add(new Point(180, 25));
8593
9292
  // we pass `false` as the second argument to arcTo:
8594
9293
  path2.arcTo(new Point(280, 25), false);
8595
9294
  </script>
8596
- <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>
8597
9296
  </div>
8598
9297
 
8599
9298
 
@@ -8605,7 +9304,7 @@ path2.arcTo(new Point(280, 25), false);
8605
9304
  <div class="button run">Run</div>
8606
9305
  </div>
8607
9306
 
8608
- <script type="text/paperscript" canvas="canvas-76">
9307
+ <script type="text/paperscript" canvas="canvas-82">
8609
9308
  var myPath;
8610
9309
 
8611
9310
  // The mouse has to move at least 20 points before
@@ -8626,7 +9325,158 @@ function onMouseDrag(event) {
8626
9325
  myPath.arcTo(event.point);
8627
9326
  }
8628
9327
  </script>
8629
- <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>
8630
9480
  </div>
8631
9481
 
8632
9482
 
@@ -8682,7 +9532,7 @@ function onMouseDrag(event) {
8682
9532
  <div class="button run">Run</div>
8683
9533
  </div>
8684
9534
 
8685
- <script type="text/paperscript" canvas="canvas-77">
9535
+ <script type="text/paperscript" canvas="canvas-86">
8686
9536
  var myPath;
8687
9537
  function onMouseMove(event) {
8688
9538
  // If we created a path before, remove it:
@@ -8703,7 +9553,7 @@ function onMouseMove(event) {
8703
9553
  myPath.selected = true;
8704
9554
  }
8705
9555
  </script>
8706
- <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>
8707
9557
  </div>
8708
9558
 
8709
9559
 
@@ -8888,7 +9738,7 @@ function onMouseMove(event) {
8888
9738
  <div class="button run">Run</div>
8889
9739
  </div>
8890
9740
 
8891
- <script type="text/paperscript" canvas="canvas-78">
9741
+ <script type="text/paperscript" canvas="canvas-87">
8892
9742
  var path = new Path();
8893
9743
  path.strokeColor = 'black';
8894
9744
 
@@ -8902,7 +9752,7 @@ path.lineBy(50, 0);
8902
9752
  // 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
8903
9753
  path.lineBy(0, 50);
8904
9754
  </script>
8905
- <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>
8906
9756
  </div>
8907
9757
 
8908
9758
 
@@ -8914,7 +9764,7 @@ path.lineBy(0, 50);
8914
9764
  <div class="button run">Run</div>
8915
9765
  </div>
8916
9766
 
8917
- <script type="text/paperscript" canvas="canvas-79">
9767
+ <script type="text/paperscript" canvas="canvas-88">
8918
9768
  var path = new Path();
8919
9769
  path.strokeColor = 'black';
8920
9770
 
@@ -8940,7 +9790,7 @@ path.smooth();
8940
9790
  // the construction of the path:
8941
9791
  // path.selected = true;
8942
9792
  </script>
8943
- <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>
8944
9794
  </div>
8945
9795
 
8946
9796
 
@@ -9159,7 +10009,7 @@ path.smooth();
9159
10009
 
9160
10010
  <!-- =========================== copyright notice ========================== -->
9161
10011
  <p class="footer">
9162
- Paper.js v0.16.0<br>
10012
+ Paper.js v0.17.0<br>
9163
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>
9164
10014
  <div class="content-end"></div>
9165
10015