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
@@ -414,6 +414,91 @@ text.fitHeight();
414
414
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
415
415
 
416
416
 
417
+ <div id="effects" class="member">
418
+ <div class="member-link">
419
+ <a name="effects" href="#effects"><tt><b>effects</b></tt></a>
420
+ </div>
421
+ <div class="member-description hidden">
422
+
423
+ <div class="member-text">
424
+ <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,
425
+ 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>
426
+ <p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
427
+ <ul>
428
+ <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>
429
+ <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>
430
+ </ul>
431
+
432
+
433
+
434
+ <ul class="member-list">
435
+ <h4>Type:</h4>
436
+ <li>
437
+ Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
438
+ </li>
439
+ </ul>
440
+
441
+
442
+ <h4>Example:</h4>
443
+
444
+ <div class="paperscript split">
445
+
446
+ <div class="buttons">
447
+ <div class="button run">Run</div>
448
+ </div>
449
+
450
+ <script type="text/paperscript" canvas="canvas-2">
451
+ var path = new Path.Star({
452
+ center: view.center,
453
+ points: 5,
454
+ radius1: 20,
455
+ radius2: 40,
456
+ strokeColor: 'black',
457
+ strokeWidth: 8
458
+ });
459
+ path.effects = [
460
+ { type: 'offset', parameters: { distance: 10, join: 'round' } },
461
+ { type: 'outline' }
462
+ ];
463
+ </script>
464
+ <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
465
+ </div>
466
+
467
+
468
+ </div>
469
+
470
+ </div>
471
+ </div>
472
+
473
+
474
+ <div id="previewbounds-matrix" class="member">
475
+ <div class="member-link">
476
+ <a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
477
+ </div>
478
+ <div class="member-description hidden">
479
+
480
+ <div class="member-text">
481
+ <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>
482
+
483
+ <p>Read only.</p>
484
+
485
+
486
+
487
+ <ul class="member-list">
488
+ <h4>Type:</h4>
489
+ <li>
490
+ <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
491
+ </li>
492
+ </ul>
493
+
494
+
495
+
496
+ </div>
497
+
498
+ </div>
499
+ </div>
500
+
501
+
417
502
  <div id="key" class="member">
418
503
  <div class="member-link">
419
504
  <a name="key" href="#key"><tt><b>key</b></tt></a>
@@ -526,7 +611,7 @@ text.fitHeight();
526
611
  <div class="button run">Run</div>
527
612
  </div>
528
613
 
529
- <script type="text/paperscript" canvas="canvas-2">
614
+ <script type="text/paperscript" canvas="canvas-3">
530
615
  var path = new Path.Circle({
531
616
  center: [80, 50],
532
617
  radius: 35
@@ -541,7 +626,7 @@ group.addChild(path);
541
626
  // The path can be accessed by name:
542
627
  group.children['example'].fillColor = 'red';
543
628
  </script>
544
- <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
629
+ <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
545
630
  </div>
546
631
 
547
632
 
@@ -579,7 +664,7 @@ group.children['example'].fillColor = 'red';
579
664
  <div class="button run">Run</div>
580
665
  </div>
581
666
 
582
- <script type="text/paperscript" canvas="canvas-3">
667
+ <script type="text/paperscript" canvas="canvas-4">
583
668
  var circle = new Path.Circle({
584
669
  center: [80, 50],
585
670
  radius: 30
@@ -590,7 +675,7 @@ circle.style = {
590
675
  strokeWidth: 5
591
676
  };
592
677
  </script>
593
- <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
678
+ <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
594
679
  </div>
595
680
 
596
681
 
@@ -602,7 +687,7 @@ circle.style = {
602
687
  <div class="button run">Run</div>
603
688
  </div>
604
689
 
605
- <script type="text/paperscript" canvas="canvas-4">
690
+ <script type="text/paperscript" canvas="canvas-5">
606
691
  var path = new Path.Circle({
607
692
  center: [50, 50],
608
693
  radius: 30,
@@ -617,7 +702,7 @@ var path2 = new Path.Circle({
617
702
  // Copy the path style of path:
618
703
  path2.style = path.style;
619
704
  </script>
620
- <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
705
+ <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
621
706
  </div>
622
707
 
623
708
 
@@ -629,7 +714,7 @@ path2.style = path.style;
629
714
  <div class="button run">Run</div>
630
715
  </div>
631
716
 
632
- <script type="text/paperscript" canvas="canvas-5">
717
+ <script type="text/paperscript" canvas="canvas-6">
633
718
  var myStyle = {
634
719
  fillColor: 'red',
635
720
  strokeColor: 'blue',
@@ -648,7 +733,7 @@ var path2 = new Path.Circle({
648
733
  });
649
734
  path2.style = myStyle;
650
735
  </script>
651
- <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
736
+ <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
652
737
  </div>
653
738
 
654
739
 
@@ -690,7 +775,7 @@ path2.style = myStyle;
690
775
  <div class="button run">Run</div>
691
776
  </div>
692
777
 
693
- <script type="text/paperscript" canvas="canvas-6">
778
+ <script type="text/paperscript" canvas="canvas-7">
694
779
  var unlockedItem = new Path.Circle({
695
780
  center: view.center - [35, 0],
696
781
  radius: 30,
@@ -717,7 +802,7 @@ new PointText({
717
802
  justification: 'center'
718
803
  });
719
804
  </script>
720
- <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
805
+ <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
721
806
  </div>
722
807
 
723
808
 
@@ -759,7 +844,7 @@ new PointText({
759
844
  <div class="button run">Run</div>
760
845
  </div>
761
846
 
762
- <script type="text/paperscript" canvas="canvas-7">
847
+ <script type="text/paperscript" canvas="canvas-8">
763
848
  var path = new Path.Circle({
764
849
  center: [50, 50],
765
850
  radius: 20,
@@ -769,7 +854,7 @@ var path = new Path.Circle({
769
854
  // Hide the path:
770
855
  path.visible = false;
771
856
  </script>
772
- <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
857
+ <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
773
858
  </div>
774
859
 
775
860
 
@@ -817,7 +902,7 @@ path.visible = false;
817
902
  <div class="button run">Run</div>
818
903
  </div>
819
904
 
820
- <script type="text/paperscript" canvas="canvas-8">
905
+ <script type="text/paperscript" canvas="canvas-9">
821
906
  // Create a white rectangle in the background
822
907
  // with the same dimensions as the view:
823
908
  var background = new Path.Rectangle(view.bounds);
@@ -838,7 +923,7 @@ var circle2 = new Path.Circle({
838
923
  // Set the blend mode of circle2:
839
924
  circle2.blendMode = 'multiply';
840
925
  </script>
841
- <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
926
+ <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
842
927
  </div>
843
928
 
844
929
 
@@ -880,7 +965,7 @@ circle2.blendMode = 'multiply';
880
965
  <div class="button run">Run</div>
881
966
  </div>
882
967
 
883
- <script type="text/paperscript" canvas="canvas-9">
968
+ <script type="text/paperscript" canvas="canvas-10">
884
969
  var circle = new Path.Circle({
885
970
  center: [80, 50],
886
971
  radius: 35,
@@ -898,7 +983,7 @@ var circle2 = new Path.Circle({
898
983
  // Make circle2 50% transparent:
899
984
  circle2.opacity = 0.5;
900
985
  </script>
901
- <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
986
+ <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
902
987
  </div>
903
988
 
904
989
 
@@ -1021,14 +1106,14 @@ circle.textWrap = { offset: 10 };</code></pre>
1021
1106
  <div class="button run">Run</div>
1022
1107
  </div>
1023
1108
 
1024
- <script type="text/paperscript" canvas="canvas-10">
1109
+ <script type="text/paperscript" canvas="canvas-11">
1025
1110
  var path = new Path.Circle({
1026
1111
  center: [80, 50],
1027
1112
  radius: 35
1028
1113
  });
1029
1114
  path.selected = true; // Select the path
1030
1115
  </script>
1031
- <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
1116
+ <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
1032
1117
  </div>
1033
1118
 
1034
1119
 
@@ -1185,7 +1270,7 @@ console.log(path.data.pets.length); // 1</code></pre>
1185
1270
  <div class="button run">Run</div>
1186
1271
  </div>
1187
1272
 
1188
- <script type="text/paperscript" canvas="canvas-11">
1273
+ <script type="text/paperscript" canvas="canvas-12">
1189
1274
  // Create a circle at position { x: 10, y: 10 }
1190
1275
  var circle = new Path.Circle({
1191
1276
  center: new Point(10, 10),
@@ -1199,7 +1284,7 @@ circle.position = new Point(20, 20);
1199
1284
  // Move the circle 100 points to the right and 50 points down
1200
1285
  circle.position += new Point(100, 50);
1201
1286
  </script>
1202
- <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
1287
+ <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1203
1288
  </div>
1204
1289
 
1205
1290
 
@@ -1211,7 +1296,7 @@ circle.position += new Point(100, 50);
1211
1296
  <div class="button run">Run</div>
1212
1297
  </div>
1213
1298
 
1214
- <script type="text/paperscript" canvas="canvas-12">
1299
+ <script type="text/paperscript" canvas="canvas-13">
1215
1300
  // Create a circle at position { x: 20, y: 20 }
1216
1301
  var circle = new Path.Circle({
1217
1302
  center: new Point(20, 20),
@@ -1222,7 +1307,7 @@ var circle = new Path.Circle({
1222
1307
  // Move the circle 100 points to the right
1223
1308
  circle.position.x += 100;
1224
1309
  </script>
1225
- <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1310
+ <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1226
1311
  </div>
1227
1312
 
1228
1313
 
@@ -1748,7 +1833,7 @@ console.log(group.children[0] == path); // true</code></pre>
1748
1833
  <div class="button run">Run</div>
1749
1834
  </div>
1750
1835
 
1751
- <script type="text/paperscript" canvas="canvas-13">
1836
+ <script type="text/paperscript" canvas="canvas-14">
1752
1837
  var path = new Path.Circle({
1753
1838
  center: [80, 50],
1754
1839
  radius: 35
@@ -1761,7 +1846,7 @@ group.addChild(path);
1761
1846
  // Access the path through the group's children array:
1762
1847
  group.children[0].fillColor = 'red';
1763
1848
  </script>
1764
- <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1849
+ <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1765
1850
  </div>
1766
1851
 
1767
1852
 
@@ -1773,7 +1858,7 @@ group.children[0].fillColor = 'red';
1773
1858
  <div class="button run">Run</div>
1774
1859
  </div>
1775
1860
 
1776
- <script type="text/paperscript" canvas="canvas-14">
1861
+ <script type="text/paperscript" canvas="canvas-15">
1777
1862
  var path = new Path.Circle({
1778
1863
  center: [80, 50],
1779
1864
  radius: 35
@@ -1788,7 +1873,7 @@ group.addChild(path);
1788
1873
  // The path can be accessed by name:
1789
1874
  group.children['example'].fillColor = 'orange';
1790
1875
  </script>
1791
- <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1876
+ <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1792
1877
  </div>
1793
1878
 
1794
1879
 
@@ -1800,7 +1885,7 @@ group.children['example'].fillColor = 'orange';
1800
1885
  <div class="button run">Run</div>
1801
1886
  </div>
1802
1887
 
1803
- <script type="text/paperscript" canvas="canvas-15">
1888
+ <script type="text/paperscript" canvas="canvas-16">
1804
1889
  var path = new Path.Circle({
1805
1890
  center: [80, 50],
1806
1891
  radius: 35
@@ -1812,7 +1897,7 @@ group.children = [path];
1812
1897
  // The path is the first child of the group:
1813
1898
  group.firstChild.fillColor = 'green';
1814
1899
  </script>
1815
- <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1900
+ <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
1816
1901
  </div>
1817
1902
 
1818
1903
 
@@ -1989,7 +2074,7 @@ group.firstChild.fillColor = 'green';
1989
2074
  <div class="button run">Run</div>
1990
2075
  </div>
1991
2076
 
1992
- <script type="text/paperscript" canvas="canvas-16">
2077
+ <script type="text/paperscript" canvas="canvas-17">
1993
2078
  // Create a circle shaped path at { x: 80, y: 50 }
1994
2079
  // with a radius of 35:
1995
2080
  var circle = new Path.Circle({
@@ -2000,7 +2085,7 @@ var circle = new Path.Circle({
2000
2085
  // Set its stroke color to RGB red:
2001
2086
  circle.strokeColor = new Color(1, 0, 0);
2002
2087
  </script>
2003
- <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
2088
+ <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
2004
2089
  </div>
2005
2090
 
2006
2091
 
@@ -2037,7 +2122,7 @@ circle.strokeColor = new Color(1, 0, 0);
2037
2122
  <div class="button run">Run</div>
2038
2123
  </div>
2039
2124
 
2040
- <script type="text/paperscript" canvas="canvas-17">
2125
+ <script type="text/paperscript" canvas="canvas-18">
2041
2126
  // Create a circle shaped path at { x: 80, y: 50 }
2042
2127
  // with a radius of 35:
2043
2128
  var circle = new Path.Circle({
@@ -2049,7 +2134,7 @@ var circle = new Path.Circle({
2049
2134
  // Set its stroke width to 10:
2050
2135
  circle.strokeWidth = 10;
2051
2136
  </script>
2052
- <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
2137
+ <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
2053
2138
  </div>
2054
2139
 
2055
2140
 
@@ -2096,7 +2181,7 @@ circle.strokeWidth = 10;
2096
2181
  <div class="button run">Run</div>
2097
2182
  </div>
2098
2183
 
2099
- <script type="text/paperscript" canvas="canvas-18">
2184
+ <script type="text/paperscript" canvas="canvas-19">
2100
2185
  var line = new Path({
2101
2186
  segments: [[80, 50], [420, 50]],
2102
2187
  strokeColor: 'black',
@@ -2117,7 +2202,7 @@ var line2 = line.clone();
2117
2202
  line2.position.y += 100;
2118
2203
  line2.strokeCap = 'butt';
2119
2204
  </script>
2120
- <div class="canvas"><canvas width="516" height="200" id="canvas-18"></canvas></div>
2205
+ <div class="canvas"><canvas width="516" height="200" id="canvas-19"></canvas></div>
2121
2206
  </div>
2122
2207
 
2123
2208
 
@@ -2164,7 +2249,7 @@ line2.strokeCap = 'butt';
2164
2249
  <div class="button run">Run</div>
2165
2250
  </div>
2166
2251
 
2167
- <script type="text/paperscript" canvas="canvas-19">
2252
+ <script type="text/paperscript" canvas="canvas-20">
2168
2253
  var path = new Path({
2169
2254
  segments: [[80, 100], [120, 40], [160, 100]],
2170
2255
  strokeColor: 'black',
@@ -2181,7 +2266,7 @@ var path3 = path2.clone();
2181
2266
  path3.position.x += path3.bounds.width * 1.5;
2182
2267
  path3.strokeJoin = 'bevel';
2183
2268
  </script>
2184
- <div class="canvas"><canvas width="516" height="120" id="canvas-19"></canvas></div>
2269
+ <div class="canvas"><canvas width="516" height="120" id="canvas-20"></canvas></div>
2185
2270
  </div>
2186
2271
 
2187
2272
 
@@ -2285,7 +2370,7 @@ path3.strokeJoin = 'bevel';
2285
2370
  <div class="button run">Run</div>
2286
2371
  </div>
2287
2372
 
2288
- <script type="text/paperscript" canvas="canvas-20">
2373
+ <script type="text/paperscript" canvas="canvas-21">
2289
2374
  var path = new Path.Circle({
2290
2375
  center: [80, 50],
2291
2376
  radius: 40,
@@ -2296,7 +2381,7 @@ var path = new Path.Circle({
2296
2381
  // Set the dashed stroke to [10pt dash, 4pt gap]:
2297
2382
  path.dashArray = [10, 4];
2298
2383
  </script>
2299
- <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
2384
+ <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2300
2385
  </div>
2301
2386
 
2302
2387
 
@@ -2402,7 +2487,7 @@ path.dashArray = [10, 4];
2402
2487
  <div class="button run">Run</div>
2403
2488
  </div>
2404
2489
 
2405
- <script type="text/paperscript" canvas="canvas-21">
2490
+ <script type="text/paperscript" canvas="canvas-22">
2406
2491
  // Create a circle shaped path at { x: 80, y: 50 }
2407
2492
  // with a radius of 35:
2408
2493
  var circle = new Path.Circle({
@@ -2413,7 +2498,7 @@ var circle = new Path.Circle({
2413
2498
  // Set the fill color of the circle to RGB red:
2414
2499
  circle.fillColor = new Color(1, 0, 0);
2415
2500
  </script>
2416
- <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2501
+ <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2417
2502
  </div>
2418
2503
 
2419
2504
 
@@ -2488,7 +2573,7 @@ circle.fillColor = new Color(1, 0, 0);
2488
2573
  <div class="button run">Run</div>
2489
2574
  </div>
2490
2575
 
2491
- <script type="text/paperscript" canvas="canvas-22">
2576
+ <script type="text/paperscript" canvas="canvas-23">
2492
2577
  var circle = new Path.Circle({
2493
2578
  center: [80, 50],
2494
2579
  radius: 35,
@@ -2501,7 +2586,7 @@ var circle = new Path.Circle({
2501
2586
  shadowOffset: new Point(5, 5)
2502
2587
  });
2503
2588
  </script>
2504
- <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2589
+ <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2505
2590
  </div>
2506
2591
 
2507
2592
 
@@ -2642,7 +2727,7 @@ var circle = new Path.Circle({
2642
2727
  <div class="button run">Run</div>
2643
2728
  </div>
2644
2729
 
2645
- <script type="text/paperscript" canvas="canvas-23">
2730
+ <script type="text/paperscript" canvas="canvas-24">
2646
2731
  // Create a rectangle shaped path with its top left point at:
2647
2732
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
2648
2733
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -2653,7 +2738,7 @@ path.onFrame = function(event) {
2653
2738
  this.rotate(3);
2654
2739
  }
2655
2740
  </script>
2656
- <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2741
+ <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
2657
2742
  </div>
2658
2743
 
2659
2744
 
@@ -2697,7 +2782,7 @@ path.onFrame = function(event) {
2697
2782
  <div class="button run">Run</div>
2698
2783
  </div>
2699
2784
 
2700
- <script type="text/paperscript" canvas="canvas-24">
2785
+ <script type="text/paperscript" canvas="canvas-25">
2701
2786
  // Create a circle shaped path at the center of the view:
2702
2787
  var path = new Path.Circle({
2703
2788
  center: view.center,
@@ -2711,7 +2796,7 @@ path.onMouseDown = function(event) {
2711
2796
  this.fillColor = 'red';
2712
2797
  }
2713
2798
  </script>
2714
- <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
2799
+ <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
2715
2800
  </div>
2716
2801
 
2717
2802
 
@@ -2723,7 +2808,7 @@ path.onMouseDown = function(event) {
2723
2808
  <div class="button run">Run</div>
2724
2809
  </div>
2725
2810
 
2726
- <script type="text/paperscript" canvas="canvas-25">
2811
+ <script type="text/paperscript" canvas="canvas-26">
2727
2812
  // Loop 30 times:
2728
2813
  for (var i = 0; i < 30; i++) {
2729
2814
  // Create a circle shaped path at a random position
@@ -2741,7 +2826,7 @@ for (var i = 0; i < 30; i++) {
2741
2826
  }
2742
2827
  }
2743
2828
  </script>
2744
- <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
2829
+ <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
2745
2830
  </div>
2746
2831
 
2747
2832
 
@@ -2785,7 +2870,7 @@ for (var i = 0; i < 30; i++) {
2785
2870
  <div class="button run">Run</div>
2786
2871
  </div>
2787
2872
 
2788
- <script type="text/paperscript" canvas="canvas-26">
2873
+ <script type="text/paperscript" canvas="canvas-27">
2789
2874
  // Create a circle shaped path at the center of the view:
2790
2875
  var path = new Path.Circle({
2791
2876
  center: view.center,
@@ -2798,7 +2883,7 @@ path.onMouseDrag = function(event) {
2798
2883
  path.position += event.delta;
2799
2884
  }
2800
2885
  </script>
2801
- <div class="canvas"><canvas width="516" height="240" id="canvas-26"></canvas></div>
2886
+ <div class="canvas"><canvas width="516" height="240" id="canvas-27"></canvas></div>
2802
2887
  </div>
2803
2888
 
2804
2889
 
@@ -2842,7 +2927,7 @@ path.onMouseDrag = function(event) {
2842
2927
  <div class="button run">Run</div>
2843
2928
  </div>
2844
2929
 
2845
- <script type="text/paperscript" canvas="canvas-27">
2930
+ <script type="text/paperscript" canvas="canvas-28">
2846
2931
  // Create a circle shaped path at the center of the view:
2847
2932
  var path = new Path.Circle({
2848
2933
  center: view.center,
@@ -2856,7 +2941,7 @@ path.onMouseUp = function(event) {
2856
2941
  this.fillColor = 'red';
2857
2942
  }
2858
2943
  </script>
2859
- <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
2944
+ <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
2860
2945
  </div>
2861
2946
 
2862
2947
 
@@ -2900,7 +2985,7 @@ path.onMouseUp = function(event) {
2900
2985
  <div class="button run">Run</div>
2901
2986
  </div>
2902
2987
 
2903
- <script type="text/paperscript" canvas="canvas-28">
2988
+ <script type="text/paperscript" canvas="canvas-29">
2904
2989
  // Create a circle shaped path at the center of the view:
2905
2990
  var path = new Path.Circle({
2906
2991
  center: view.center,
@@ -2914,7 +2999,7 @@ path.onClick = function(event) {
2914
2999
  this.fillColor = 'red';
2915
3000
  }
2916
3001
  </script>
2917
- <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
3002
+ <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
2918
3003
  </div>
2919
3004
 
2920
3005
 
@@ -2926,7 +3011,7 @@ path.onClick = function(event) {
2926
3011
  <div class="button run">Run</div>
2927
3012
  </div>
2928
3013
 
2929
- <script type="text/paperscript" canvas="canvas-29">
3014
+ <script type="text/paperscript" canvas="canvas-30">
2930
3015
  // Loop 30 times:
2931
3016
  for (var i = 0; i < 30; i++) {
2932
3017
  // Create a circle shaped path at a random position
@@ -2944,7 +3029,7 @@ for (var i = 0; i < 30; i++) {
2944
3029
  }
2945
3030
  }
2946
3031
  </script>
2947
- <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
3032
+ <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
2948
3033
  </div>
2949
3034
 
2950
3035
 
@@ -2988,7 +3073,7 @@ for (var i = 0; i < 30; i++) {
2988
3073
  <div class="button run">Run</div>
2989
3074
  </div>
2990
3075
 
2991
- <script type="text/paperscript" canvas="canvas-30">
3076
+ <script type="text/paperscript" canvas="canvas-31">
2992
3077
  // Create a circle shaped path at the center of the view:
2993
3078
  var path = new Path.Circle({
2994
3079
  center: view.center,
@@ -3002,7 +3087,7 @@ path.onDoubleClick = function(event) {
3002
3087
  this.fillColor = 'red';
3003
3088
  }
3004
3089
  </script>
3005
- <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
3090
+ <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
3006
3091
  </div>
3007
3092
 
3008
3093
 
@@ -3014,7 +3099,7 @@ path.onDoubleClick = function(event) {
3014
3099
  <div class="button run">Run</div>
3015
3100
  </div>
3016
3101
 
3017
- <script type="text/paperscript" canvas="canvas-31">
3102
+ <script type="text/paperscript" canvas="canvas-32">
3018
3103
  // Loop 30 times:
3019
3104
  for (var i = 0; i < 30; i++) {
3020
3105
  // Create a circle shaped path at a random position
@@ -3032,7 +3117,7 @@ for (var i = 0; i < 30; i++) {
3032
3117
  }
3033
3118
  }
3034
3119
  </script>
3035
- <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
3120
+ <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
3036
3121
  </div>
3037
3122
 
3038
3123
 
@@ -3076,7 +3161,7 @@ for (var i = 0; i < 30; i++) {
3076
3161
  <div class="button run">Run</div>
3077
3162
  </div>
3078
3163
 
3079
- <script type="text/paperscript" canvas="canvas-32">
3164
+ <script type="text/paperscript" canvas="canvas-33">
3080
3165
  // Create a circle shaped path at the center of the view:
3081
3166
  var path = new Path.Circle({
3082
3167
  center: view.center,
@@ -3084,180 +3169,567 @@ for (var i = 0; i < 30; i++) {
3084
3169
  fillColor: 'black'
3085
3170
  });
3086
3171
 
3087
- // When the mouse moves on top of the item, set its opacity
3088
- // to a random value between 0 and 1:
3089
- path.onMouseMove = function(event) {
3090
- this.opacity = Math.random();
3091
- }
3092
- </script>
3093
- <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
3094
- </div>
3172
+ // When the mouse moves on top of the item, set its opacity
3173
+ // to a random value between 0 and 1:
3174
+ path.onMouseMove = function(event) {
3175
+ this.opacity = Math.random();
3176
+ }
3177
+ </script>
3178
+ <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
3179
+ </div>
3180
+
3181
+
3182
+ </div>
3183
+
3184
+ </div>
3185
+ </div>
3186
+
3187
+
3188
+ <div id="onmouseenter" class="member">
3189
+ <div class="member-link">
3190
+ <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
3191
+ </div>
3192
+ <div class="member-description hidden">
3193
+
3194
+ <div class="member-text">
3195
+ <p>The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
3196
+
3197
+
3198
+
3199
+ <ul class="member-list">
3200
+ <h4>Type:</h4>
3201
+ <li>
3202
+ <tt>Function</tt>⟋<tt>null</tt>
3203
+ </li>
3204
+ </ul>
3205
+
3206
+
3207
+ <ul class="member-list">
3208
+ <h4>See also:</h4>
3209
+
3210
+ <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
3211
+
3212
+ </ul>
3213
+
3214
+ <h4>Example:<span class="description">When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
3215
+
3216
+ <div class="paperscript split">
3217
+
3218
+ <div class="buttons">
3219
+ <div class="button run">Run</div>
3220
+ </div>
3221
+
3222
+ <script type="text/paperscript" canvas="canvas-34">
3223
+ // Create a circle shaped path at the center of the view:
3224
+ var path = new Path.Circle({
3225
+ center: view.center,
3226
+ radius: 25,
3227
+ fillColor: 'black'
3228
+ });
3229
+
3230
+ // When the mouse enters the item, set its fill color to red:
3231
+ path.onMouseEnter = function(event) {
3232
+ this.fillColor = 'red';
3233
+ }
3234
+
3235
+ // When the mouse leaves the item, set its fill color to black:
3236
+ path.onMouseLeave = function(event) {
3237
+ this.fillColor = 'black';
3238
+ }
3239
+ </script>
3240
+ <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
3241
+ </div>
3242
+
3243
+
3244
+ <h4>Example:<span class="description">When you click the mouse, you create new circle shaped items. When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
3245
+
3246
+ <div class="paperscript split">
3247
+
3248
+ <div class="buttons">
3249
+ <div class="button run">Run</div>
3250
+ </div>
3251
+
3252
+ <script type="text/paperscript" canvas="canvas-35">
3253
+ function enter(event) {
3254
+ this.fillColor = 'red';
3255
+ }
3256
+
3257
+ function leave(event) {
3258
+ this.fillColor = 'black';
3259
+ }
3260
+
3261
+ // When the mouse is pressed:
3262
+ function onMouseDown(event) {
3263
+ // Create a circle shaped path at the position of the mouse:
3264
+ var path = new Path.Circle(event.point, 25);
3265
+ path.fillColor = 'black';
3266
+
3267
+ // When the mouse enters the item, set its fill color to red:
3268
+ path.onMouseEnter = enter;
3269
+
3270
+ // When the mouse leaves the item, set its fill color to black:
3271
+ path.onMouseLeave = leave;
3272
+ }
3273
+ </script>
3274
+ <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3275
+ </div>
3276
+
3277
+
3278
+ </div>
3279
+
3280
+ </div>
3281
+ </div>
3282
+
3283
+
3284
+ <div id="onmouseleave" class="member">
3285
+ <div class="member-link">
3286
+ <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
3287
+ </div>
3288
+ <div class="member-description hidden">
3289
+
3290
+ <div class="member-text">
3291
+ <p>The function to be called when the mouse moves out of the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
3292
+
3293
+
3294
+
3295
+ <ul class="member-list">
3296
+ <h4>Type:</h4>
3297
+ <li>
3298
+ <tt>Function</tt>⟋<tt>null</tt>
3299
+ </li>
3300
+ </ul>
3301
+
3302
+
3303
+ <ul class="member-list">
3304
+ <h4>See also:</h4>
3305
+
3306
+ <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
3307
+
3308
+ </ul>
3309
+
3310
+ <h4>Example:<span class="description">Move the mouse over the circle shaped path and then move it out of it again to set its fill color to red:</span></h4>
3311
+
3312
+ <div class="paperscript split">
3313
+
3314
+ <div class="buttons">
3315
+ <div class="button run">Run</div>
3316
+ </div>
3317
+
3318
+ <script type="text/paperscript" canvas="canvas-36">
3319
+ // Create a circle shaped path at the center of the view:
3320
+ var path = new Path.Circle({
3321
+ center: view.center,
3322
+ radius: 25,
3323
+ fillColor: 'black'
3324
+ });
3325
+
3326
+ // When the mouse leaves the item, set its fill color to red:
3327
+ path.onMouseLeave = function(event) {
3328
+ this.fillColor = 'red';
3329
+ }
3330
+ </script>
3331
+ <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3332
+ </div>
3333
+
3334
+
3335
+ </div>
3336
+
3337
+ </div>
3338
+ </div>
3339
+
3340
+
3341
+ <div id="ondraw" class="member">
3342
+ <div class="member-link">
3343
+ <a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
3344
+ </div>
3345
+ <div class="member-description hidden">
3346
+
3347
+ <div class="member-text">
3348
+ <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>
3349
+
3350
+
3351
+
3352
+ <ul class="member-list">
3353
+ <h4>Type:</h4>
3354
+ <li>
3355
+ <tt>Function</tt>⟋<tt>null</tt>
3356
+ </li>
3357
+ </ul>
3358
+ <ul class="member-list">
3359
+ <h4>Options:</h4>
3360
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the item that is drawn</li>
3361
+ <li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> &mdash; the canvas context, transformed into the item&rsquo;s coordinates</li>
3362
+ <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>
3363
+ <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>
3364
+ <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>()
3365
+ 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>
3366
+ </ul>
3367
+
3368
+ <h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
3369
+
3370
+ <div class="paperscript split">
3371
+
3372
+ <div class="buttons">
3373
+ <div class="button run">Run</div>
3374
+ </div>
3375
+
3376
+ <script type="text/paperscript" canvas="canvas-37">
3377
+ var path = new Path.Circle({
3378
+ center: view.center,
3379
+ radius: 25,
3380
+ fillColor: 'rgba(255, 0, 0, 0.5)'
3381
+ });
3382
+
3383
+ path.onDraw = function(event) {
3384
+ var ctx = event.context,
3385
+ center = this.position,
3386
+ scale = event.matrix.scaling.x;
3387
+ ctx.beginPath();
3388
+ ctx.moveTo(center.x - 40, center.y);
3389
+ ctx.lineTo(center.x + 40, center.y);
3390
+ ctx.moveTo(center.x, center.y - 40);
3391
+ ctx.lineTo(center.x, center.y + 40);
3392
+ ctx.lineWidth = 1 / scale;
3393
+ ctx.stroke();
3394
+ }
3395
+ </script>
3396
+ <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3397
+ </div>
3398
+
3399
+
3400
+ </div>
3401
+
3402
+ </div>
3403
+ </div>
3404
+
3405
+
3406
+ <div id="ondrawselection" class="member">
3407
+ <div class="member-link">
3408
+ <a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
3409
+ </div>
3410
+ <div class="member-description hidden">
3411
+
3412
+ <div class="member-text">
3413
+ <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>
3414
+
3415
+
3416
+
3417
+ <ul class="member-list">
3418
+ <h4>Type:</h4>
3419
+ <li>
3420
+ <tt>Function</tt>⟋<tt>null</tt>
3421
+ </li>
3422
+ </ul>
3423
+ <ul class="member-list">
3424
+ <h4>Options:</h4>
3425
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the selected item</li>
3426
+ <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>
3427
+ <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>
3428
+ <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>
3429
+ <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>
3430
+ <li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> &mdash; the view drawn into
3431
+ What the handler draws isn&rsquo;t part of the item&rsquo;s hit testing, its bounds or its SVG export.</li>
3432
+ </ul>
3433
+
3434
+ <h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
3435
+
3436
+ <div class="paperscript split">
3437
+
3438
+ <div class="buttons">
3439
+ <div class="button run">Run</div>
3440
+ </div>
3441
+
3442
+ <script type="text/paperscript" canvas="canvas-38">
3443
+ var path = new Path.Star({
3444
+ center: view.center,
3445
+ points: 5,
3446
+ radius1: 20,
3447
+ radius2: 40,
3448
+ strokeColor: 'black',
3449
+ selected: true
3450
+ });
3451
+
3452
+ path.onDrawSelection = function(event) {
3453
+ var ctx = event.context;
3454
+ this.segments.forEach(function(segment) {
3455
+ var point = event.matrix.transform(segment.point);
3456
+ ctx.beginPath();
3457
+ ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
3458
+ ctx.fill();
3459
+ });
3460
+ return false;
3461
+ }
3462
+ </script>
3463
+ <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
3464
+ </div>
3465
+
3466
+
3467
+ </div>
3468
+
3469
+ </div>
3470
+ </div>
3471
+
3472
+ </div>
3473
+
3474
+
3475
+ <!-- =========================== inherited methods ========================= -->
3476
+ <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3477
+
3478
+
3479
+ <div id="addeffect-effect" class="member">
3480
+ <div class="member-link">
3481
+ <a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
3482
+ </div>
3483
+ <div class="member-description hidden">
3484
+ <div class="member-text">
3485
+ <p>Adds an effect at the end of the item&rsquo;s effects.</p>
3486
+
3487
+
3488
+ <ul class="member-list">
3489
+ <h4>Parameters:</h4>
3490
+
3491
+ <li>
3492
+ <tt>effect:</tt>
3493
+ <tt>Object</tt>
3494
+ &mdash;&nbsp;the plain object describing the effect
3495
+
3496
+ </li>
3497
+
3498
+ </ul>
3499
+
3500
+
3501
+ <ul class="member-list">
3502
+ <h4>Returns:</h4>
3503
+
3504
+ <li>
3505
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the added instance
3506
+ </li>
3507
+
3508
+
3509
+ </ul>
3510
+
3511
+
3512
+
3513
+
3514
+
3515
+ </div>
3516
+ </div>
3517
+ </div>
3518
+
3519
+
3520
+ <div id="inserteffect-index-effect" class="member">
3521
+ <div class="member-link">
3522
+ <a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
3523
+ </div>
3524
+ <div class="member-description hidden">
3525
+ <div class="member-text">
3526
+ <p>Inserts an effect into the item&rsquo;s effects at the given index.</p>
3527
+
3528
+
3529
+ <ul class="member-list">
3530
+ <h4>Parameters:</h4>
3531
+
3532
+ <li>
3533
+ <tt>index:</tt>
3534
+ <tt>Number</tt>
3535
+ &mdash;&nbsp;the index at which to insert the effect
3536
+
3537
+ </li>
3538
+
3539
+ <li>
3540
+ <tt>effect:</tt>
3541
+ <tt>Object</tt>
3542
+ &mdash;&nbsp;the plain object describing the effect
3543
+
3544
+ </li>
3545
+
3546
+ </ul>
3547
+
3548
+
3549
+ <ul class="member-list">
3550
+ <h4>Returns:</h4>
3551
+
3552
+ <li>
3553
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted instance
3554
+ </li>
3555
+
3556
+
3557
+ </ul>
3558
+
3559
+
3560
+
3561
+
3562
+
3563
+ </div>
3564
+ </div>
3565
+ </div>
3566
+
3567
+
3568
+ <div id="inserteffects-index-effects" class="member">
3569
+ <div class="member-link">
3570
+ <a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
3571
+ </div>
3572
+ <div class="member-description hidden">
3573
+ <div class="member-text">
3574
+ <p>Inserts effects into the item&rsquo;s effects at the given index.</p>
3575
+
3576
+
3577
+ <ul class="member-list">
3578
+ <h4>Parameters:</h4>
3579
+
3580
+ <li>
3581
+ <tt>index:</tt>
3582
+ <tt>Number</tt>
3583
+ &mdash;&nbsp;the index at which to insert the effects
3584
+
3585
+ </li>
3586
+
3587
+ <li>
3588
+ <tt>effects:</tt>
3589
+ Array of <tt>Object</tt> objects
3590
+ &mdash;&nbsp;the plain objects describing the effects
3591
+
3592
+ </li>
3593
+
3594
+ </ul>
3595
+
3596
+
3597
+ <ul class="member-list">
3598
+ <h4>Returns:</h4>
3599
+
3600
+ <li>
3601
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the inserted instances
3602
+ </li>
3603
+
3604
+
3605
+ </ul>
3095
3606
 
3096
3607
 
3097
- </div>
3098
3608
 
3609
+
3610
+
3611
+ </div>
3099
3612
  </div>
3100
3613
  </div>
3101
3614
 
3102
3615
 
3103
- <div id="onmouseenter" class="member">
3616
+ <div id="removeeffect-index" class="member">
3104
3617
  <div class="member-link">
3105
- <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
3618
+ <a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
3106
3619
  </div>
3107
3620
  <div class="member-description hidden">
3108
-
3109
3621
  <div class="member-text">
3110
- <p>The function to be called when the mouse moves over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
3622
+ <p>Removes the effect at the given index from the item&rsquo;s effects.</p>
3623
+
3111
3624
 
3625
+ <ul class="member-list">
3626
+ <h4>Parameters:</h4>
3112
3627
 
3628
+ <li>
3629
+ <tt>index:</tt>
3630
+ <tt>Number</tt>
3631
+ &mdash;&nbsp;the index of the effect to remove
3632
+
3633
+ </li>
3113
3634
 
3114
- <ul class="member-list">
3115
- <h4>Type:</h4>
3116
- <li>
3117
- <tt>Function</tt>⟋<tt>null</tt>
3118
- </li>
3119
- </ul>
3120
-
3635
+ </ul>
3636
+
3121
3637
 
3122
3638
  <ul class="member-list">
3123
- <h4>See also:</h4>
3639
+ <h4>Returns:</h4>
3124
3640
 
3125
- <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
3641
+ <li>
3642
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the removed instance, or <code>null</code>
3643
+ </li>
3644
+
3126
3645
 
3127
3646
  </ul>
3128
3647
 
3129
- <h4>Example:<span class="description">When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
3130
3648
 
3131
- <div class="paperscript split">
3132
3649
 
3133
- <div class="buttons">
3134
- <div class="button run">Run</div>
3650
+
3651
+
3135
3652
  </div>
3136
-
3137
- <script type="text/paperscript" canvas="canvas-33">
3138
- // Create a circle shaped path at the center of the view:
3139
- var path = new Path.Circle({
3140
- center: view.center,
3141
- radius: 25,
3142
- fillColor: 'black'
3143
- });
3144
-
3145
- // When the mouse enters the item, set its fill color to red:
3146
- path.onMouseEnter = function(event) {
3147
- this.fillColor = 'red';
3148
- }
3149
-
3150
- // When the mouse leaves the item, set its fill color to black:
3151
- path.onMouseLeave = function(event) {
3152
- this.fillColor = 'black';
3153
- }
3154
- </script>
3155
- <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
3156
3653
  </div>
3157
-
3158
-
3159
- <h4>Example:<span class="description">When you click the mouse, you create new circle shaped items. When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
3160
-
3161
- <div class="paperscript split">
3162
-
3163
- <div class="buttons">
3164
- <div class="button run">Run</div>
3165
3654
  </div>
3166
3655
 
3167
- <script type="text/paperscript" canvas="canvas-34">
3168
- function enter(event) {
3169
- this.fillColor = 'red';
3170
- }
3171
-
3172
- function leave(event) {
3173
- this.fillColor = 'black';
3174
- }
3656
+
3657
+ <div id="removeeffects" class="member">
3658
+ <div class="member-link">
3659
+ <a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
3660
+ </div>
3661
+ <div class="member-description hidden">
3662
+ <div class="member-text">
3663
+ <p>Removes the effects from the start index to the end index from the item&rsquo;s effects, or all of them.</p>
3664
+
3665
+
3666
+ <ul class="member-list">
3667
+ <h4>Parameters:</h4>
3668
+
3669
+ <li>
3670
+ <tt>start:</tt>
3671
+ <tt>Number</tt>
3672
+ &mdash;&nbsp;the index of the first effect to remove
3673
+ &mdash;&nbsp;optional, default: <tt>0</tt>
3674
+ </li>
3675
+
3676
+ <li>
3677
+ <tt>end:</tt>
3678
+ <tt>Number</tt>
3679
+ &mdash;&nbsp;the index after the last one
3680
+ &mdash;&nbsp;optional, default: <tt>effects.length</tt>
3681
+ </li>
3682
+
3683
+ </ul>
3175
3684
 
3176
- // When the mouse is pressed:
3177
- function onMouseDown(event) {
3178
- // Create a circle shaped path at the position of the mouse:
3179
- var path = new Path.Circle(event.point, 25);
3180
- path.fillColor = 'black';
3685
+
3686
+ <ul class="member-list">
3687
+ <h4>Returns:</h4>
3688
+
3689
+ <li>
3690
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the removed instances
3691
+ </li>
3181
3692
 
3182
- // When the mouse enters the item, set its fill color to red:
3183
- path.onMouseEnter = enter;
3693
+
3694
+ </ul>
3184
3695
 
3185
- // When the mouse leaves the item, set its fill color to black:
3186
- path.onMouseLeave = leave;
3187
- }
3188
- </script>
3189
- <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
3190
- </div>
3191
3696
 
3192
3697
 
3698
+
3699
+
3193
3700
  </div>
3194
-
3195
3701
  </div>
3196
3702
  </div>
3197
3703
 
3198
3704
 
3199
- <div id="onmouseleave" class="member">
3705
+ <div id="geteffectoutput" class="member">
3200
3706
  <div class="member-link">
3201
- <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
3707
+ <a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
3202
3708
  </div>
3203
3709
  <div class="member-description hidden">
3204
-
3205
3710
  <div class="member-text">
3206
- <p>The function to be called when the mouse moves out of the item. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
3207
-
3208
-
3209
-
3210
- <ul class="member-list">
3211
- <h4>Type:</h4>
3212
- <li>
3213
- <tt>Function</tt>⟋<tt>null</tt>
3214
- </li>
3215
- </ul>
3711
+ <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>
3216
3712
 
3217
3713
 
3714
+
3218
3715
  <ul class="member-list">
3219
- <h4>See also:</h4>
3716
+ <h4>Returns:</h4>
3220
3717
 
3221
- <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
3718
+ <li>
3719
+ <tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt>&nbsp;&mdash;&nbsp;the output of the effects
3720
+ </li>
3721
+
3222
3722
 
3223
3723
  </ul>
3224
3724
 
3225
- <h4>Example:<span class="description">Move the mouse over the circle shaped path and then move it out of it again to set its fill color to red:</span></h4>
3226
-
3227
- <div class="paperscript split">
3228
-
3229
- <div class="buttons">
3230
- <div class="button run">Run</div>
3231
- </div>
3232
-
3233
- <script type="text/paperscript" canvas="canvas-35">
3234
- // Create a circle shaped path at the center of the view:
3235
- var path = new Path.Circle({
3236
- center: view.center,
3237
- radius: 25,
3238
- fillColor: 'black'
3239
- });
3240
-
3241
- // When the mouse leaves the item, set its fill color to red:
3242
- path.onMouseLeave = function(event) {
3243
- this.fillColor = 'red';
3244
- }
3245
- </script>
3246
- <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3247
- </div>
3248
-
3249
3725
 
3250
- </div>
3251
3726
 
3727
+
3728
+
3252
3729
  </div>
3253
3730
  </div>
3254
-
3255
3731
  </div>
3256
3732
 
3257
-
3258
- <!-- =========================== inherited methods ========================= -->
3259
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3260
-
3261
3733
 
3262
3734
  <div id="set-props" class="member">
3263
3735
  <div class="member-link">
@@ -3302,7 +3774,7 @@ path.onMouseLeave = function(event) {
3302
3774
  <div class="button run">Run</div>
3303
3775
  </div>
3304
3776
 
3305
- <script type="text/paperscript" canvas="canvas-36">
3777
+ <script type="text/paperscript" canvas="canvas-39">
3306
3778
  var circle = new Path.Circle({
3307
3779
  center: [80, 50],
3308
3780
  radius: 35
@@ -3315,7 +3787,7 @@ circle.set({
3315
3787
  selected: true
3316
3788
  });
3317
3789
  </script>
3318
- <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3790
+ <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
3319
3791
  </div>
3320
3792
 
3321
3793
 
@@ -3371,7 +3843,7 @@ circle.set({
3371
3843
  <div class="button run">Run</div>
3372
3844
  </div>
3373
3845
 
3374
- <script type="text/paperscript" canvas="canvas-37">
3846
+ <script type="text/paperscript" canvas="canvas-40">
3375
3847
  var circle = new Path.Circle({
3376
3848
  center: [50, 50],
3377
3849
  radius: 10,
@@ -3386,7 +3858,7 @@ for (var i = 0; i < 20; i++) {
3386
3858
  copy.position.x += i * copy.bounds.width;
3387
3859
  }
3388
3860
  </script>
3389
- <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3861
+ <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
3390
3862
  </div>
3391
3863
 
3392
3864
 
@@ -3512,7 +3984,7 @@ for (var i = 0; i < 20; i++) {
3512
3984
  <div class="button run">Run</div>
3513
3985
  </div>
3514
3986
 
3515
- <script type="text/paperscript" canvas="canvas-38">
3987
+ <script type="text/paperscript" canvas="canvas-41">
3516
3988
  var circle = new Path.Circle({
3517
3989
  center: [50, 50],
3518
3990
  radius: 5,
@@ -3529,7 +4001,7 @@ raster.position.x += 100;
3529
4001
  circle.scale(5);
3530
4002
  raster.scale(5);
3531
4003
  </script>
3532
- <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
4004
+ <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
3533
4005
  </div>
3534
4006
 
3535
4007
 
@@ -3583,7 +4055,7 @@ raster.scale(5);
3583
4055
  <div class="button run">Run</div>
3584
4056
  </div>
3585
4057
 
3586
- <script type="text/paperscript" canvas="canvas-39">
4058
+ <script type="text/paperscript" canvas="canvas-42">
3587
4059
  var path = new Path.Star({
3588
4060
  center: [50, 50],
3589
4061
  points: 12,
@@ -3604,7 +4076,7 @@ function onMouseDown(event) {
3604
4076
  }
3605
4077
  }
3606
4078
  </script>
3607
- <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
4079
+ <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
3608
4080
  </div>
3609
4081
 
3610
4082
 
@@ -4122,11 +4594,17 @@ function onMouseDown(event) {
4122
4594
  </div>
4123
4595
  <div class="member-description hidden">
4124
4596
  <div class="member-text">
4125
- <p>Exports the item with its content and child items as an SVG DOM.</p>
4597
+ <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>
4126
4598
  <ul class="member-list">
4127
4599
  <h4>Options:</h4>
4128
- <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>
4129
- <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>
4600
+ <li>[options.bounds] {String|Rectangle} the bounds of the area to
4601
+ export, either as a string ({@values 'view', content'}), or a
4602
+ {@link Rectangle} object: `'view'` uses the view bounds,
4603
+ `'content'` uses the stroke bounds of the item</li>
4604
+ <li>[options.matrix] {Matrix} the matrix with which to transform the
4605
+ exported content: If `options.bounds` is set to `'view'`,
4606
+ `paper.view.matrix` is used, for all other settings of
4607
+ `options.bounds` the identity matrix is used.</li>
4130
4608
  <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>
4131
4609
  <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>
4132
4610
  <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>
@@ -5480,7 +5958,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5480
5958
  <div class="button run">Run</div>
5481
5959
  </div>
5482
5960
 
5483
- <script type="text/paperscript" canvas="canvas-40">
5961
+ <script type="text/paperscript" canvas="canvas-43">
5484
5962
  // Create a rectangle shaped path with its top left
5485
5963
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
5486
5964
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -5489,7 +5967,7 @@ path.fillColor = 'black';
5489
5967
  // Rotate the path by 30 degrees:
5490
5968
  path.rotate(30);
5491
5969
  </script>
5492
- <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
5970
+ <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
5493
5971
  </div>
5494
5972
 
5495
5973
 
@@ -5501,7 +5979,7 @@ path.rotate(30);
5501
5979
  <div class="button run">Run</div>
5502
5980
  </div>
5503
5981
 
5504
- <script type="text/paperscript" canvas="canvas-41">
5982
+ <script type="text/paperscript" canvas="canvas-44">
5505
5983
  // Create a rectangle shaped path with its top left
5506
5984
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
5507
5985
  var topLeft = new Point(175, 50);
@@ -5523,7 +6001,7 @@ function onFrame(event) {
5523
6001
  path.rotate(3, view.center);
5524
6002
  }
5525
6003
  </script>
5526
- <div class="canvas"><canvas width="516" height="200" id="canvas-41"></canvas></div>
6004
+ <div class="canvas"><canvas width="516" height="200" id="canvas-44"></canvas></div>
5527
6005
  </div>
5528
6006
 
5529
6007
 
@@ -5572,7 +6050,7 @@ function onFrame(event) {
5572
6050
  <div class="button run">Run</div>
5573
6051
  </div>
5574
6052
 
5575
- <script type="text/paperscript" canvas="canvas-42">
6053
+ <script type="text/paperscript" canvas="canvas-45">
5576
6054
  // Create a circle shaped path at { x: 80, y: 50 }
5577
6055
  // with a radius of 20:
5578
6056
  var circle = new Path.Circle({
@@ -5584,7 +6062,7 @@ var circle = new Path.Circle({
5584
6062
  // Scale the path by 150% from its center point
5585
6063
  circle.scale(1.5);
5586
6064
  </script>
5587
- <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
6065
+ <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
5588
6066
  </div>
5589
6067
 
5590
6068
 
@@ -5596,7 +6074,7 @@ circle.scale(1.5);
5596
6074
  <div class="button run">Run</div>
5597
6075
  </div>
5598
6076
 
5599
- <script type="text/paperscript" canvas="canvas-43">
6077
+ <script type="text/paperscript" canvas="canvas-46">
5600
6078
  // Create a circle shaped path at { x: 80, y: 50 }
5601
6079
  // with a radius of 20:
5602
6080
  var circle = new Path.Circle({
@@ -5608,7 +6086,7 @@ var circle = new Path.Circle({
5608
6086
  // Scale the path 150% from its bottom left corner
5609
6087
  circle.scale(1.5, circle.bounds.bottomLeft);
5610
6088
  </script>
5611
- <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
6089
+ <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
5612
6090
  </div>
5613
6091
 
5614
6092
 
@@ -5664,7 +6142,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
5664
6142
  <div class="button run">Run</div>
5665
6143
  </div>
5666
6144
 
5667
- <script type="text/paperscript" canvas="canvas-44">
6145
+ <script type="text/paperscript" canvas="canvas-47">
5668
6146
  // Create a circle shaped path at { x: 100, y: 50 }
5669
6147
  // with a radius of 20:
5670
6148
  var circle = new Path.Circle({
@@ -5676,7 +6154,7 @@ var circle = new Path.Circle({
5676
6154
  // Scale the path horizontally by 300%
5677
6155
  circle.scale(3, 1);
5678
6156
  </script>
5679
- <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
6157
+ <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
5680
6158
  </div>
5681
6159
 
5682
6160
 
@@ -6114,7 +6592,7 @@ circle.scale(3, 1);
6114
6592
  <div class="button run">Run</div>
6115
6593
  </div>
6116
6594
 
6117
- <script type="text/paperscript" canvas="canvas-45">
6595
+ <script type="text/paperscript" canvas="canvas-48">
6118
6596
  // Create a rectangle shaped path with its top left corner
6119
6597
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6120
6598
  var path = new Path.Rectangle({
@@ -6135,7 +6613,7 @@ var circlePath = new Path.Circle({
6135
6613
  // the rectangular path:
6136
6614
  circlePath.fitBounds(path.bounds);
6137
6615
  </script>
6138
- <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
6616
+ <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6139
6617
  </div>
6140
6618
 
6141
6619
 
@@ -6147,7 +6625,7 @@ circlePath.fitBounds(path.bounds);
6147
6625
  <div class="button run">Run</div>
6148
6626
  </div>
6149
6627
 
6150
- <script type="text/paperscript" canvas="canvas-46">
6628
+ <script type="text/paperscript" canvas="canvas-49">
6151
6629
  // Create a rectangle shaped path with its top left corner
6152
6630
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6153
6631
  var path = new Path.Rectangle({
@@ -6168,7 +6646,7 @@ var circlePath = new Path.Circle({
6168
6646
  // the rectangular path:
6169
6647
  circlePath.fitBounds(path.bounds, 'cover');
6170
6648
  </script>
6171
- <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
6649
+ <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
6172
6650
  </div>
6173
6651
 
6174
6652
 
@@ -6180,7 +6658,7 @@ circlePath.fitBounds(path.bounds, 'cover');
6180
6658
  <div class="button run">Run</div>
6181
6659
  </div>
6182
6660
 
6183
- <script type="text/paperscript" canvas="canvas-47">
6661
+ <script type="text/paperscript" canvas="canvas-50">
6184
6662
  var path = new Path.Circle({
6185
6663
  center: [80, 50],
6186
6664
  radius: 30,
@@ -6190,7 +6668,7 @@ var path = new Path.Circle({
6190
6668
  // Fit the path to the bounding rectangle of the view:
6191
6669
  path.fitBounds(view.bounds);
6192
6670
  </script>
6193
- <div class="canvas"><canvas width="516" height="200" id="canvas-47"></canvas></div>
6671
+ <div class="canvas"><canvas width="516" height="200" id="canvas-50"></canvas></div>
6194
6672
  </div>
6195
6673
 
6196
6674
 
@@ -6216,7 +6694,7 @@ path.fitBounds(view.bounds);
6216
6694
  <li>
6217
6695
  <tt>type:</tt>
6218
6696
  <tt>String</tt>
6219
- &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>
6697
+ &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>
6220
6698
 
6221
6699
  </li>
6222
6700
 
@@ -6251,7 +6729,7 @@ path.fitBounds(view.bounds);
6251
6729
  <div class="button run">Run</div>
6252
6730
  </div>
6253
6731
 
6254
- <script type="text/paperscript" canvas="canvas-48">
6732
+ <script type="text/paperscript" canvas="canvas-51">
6255
6733
  // Create a circle shaped path at the center of the view:
6256
6734
  var path = new Path.Circle({
6257
6735
  center: view.center,
@@ -6269,7 +6747,7 @@ path.on('mouseleave', function() {
6269
6747
  this.fillColor = 'black';
6270
6748
  });
6271
6749
  </script>
6272
- <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6750
+ <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
6273
6751
  </div>
6274
6752
 
6275
6753
 
@@ -6293,7 +6771,7 @@ path.on('mouseleave', function() {
6293
6771
  <li>
6294
6772
  <tt>object:</tt>
6295
6773
  <tt>Object</tt>
6296
- &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>
6774
+ &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>
6297
6775
 
6298
6776
  </li>
6299
6777
 
@@ -6321,7 +6799,7 @@ path.on('mouseleave', function() {
6321
6799
  <div class="button run">Run</div>
6322
6800
  </div>
6323
6801
 
6324
- <script type="text/paperscript" canvas="canvas-49">
6802
+ <script type="text/paperscript" canvas="canvas-52">
6325
6803
  // Create a circle shaped path at the center of the view:
6326
6804
  var path = new Path.Circle({
6327
6805
  center: view.center,
@@ -6339,7 +6817,7 @@ path.on({
6339
6817
  }
6340
6818
  });
6341
6819
  </script>
6342
- <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
6820
+ <div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
6343
6821
  </div>
6344
6822
 
6345
6823
 
@@ -6351,7 +6829,7 @@ path.on({
6351
6829
  <div class="button run">Run</div>
6352
6830
  </div>
6353
6831
 
6354
- <script type="text/paperscript" canvas="canvas-50">
6832
+ <script type="text/paperscript" canvas="canvas-53">
6355
6833
  var pathHandlers = {
6356
6834
  mouseenter: function(event) {
6357
6835
  this.fillColor = 'red';
@@ -6374,7 +6852,7 @@ function onMouseDown(event) {
6374
6852
  path.on(pathHandlers);
6375
6853
  }
6376
6854
  </script>
6377
- <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
6855
+ <div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
6378
6856
  </div>
6379
6857
 
6380
6858
 
@@ -6398,7 +6876,7 @@ function onMouseDown(event) {
6398
6876
  <li>
6399
6877
  <tt>type:</tt>
6400
6878
  <tt>String</tt>
6401
- &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>
6879
+ &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>
6402
6880
 
6403
6881
  </li>
6404
6882
 
@@ -6446,7 +6924,7 @@ function onMouseDown(event) {
6446
6924
  <li>
6447
6925
  <tt>object:</tt>
6448
6926
  <tt>Object</tt>
6449
- &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>
6927
+ &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>
6450
6928
 
6451
6929
  </li>
6452
6930
 
@@ -6487,7 +6965,7 @@ function onMouseDown(event) {
6487
6965
  <li>
6488
6966
  <tt>type:</tt>
6489
6967
  <tt>String</tt>
6490
- &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>
6968
+ &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>
6491
6969
 
6492
6970
  </li>
6493
6971
 
@@ -6535,7 +7013,7 @@ function onMouseDown(event) {
6535
7013
  <li>
6536
7014
  <tt>type:</tt>
6537
7015
  <tt>String</tt>
6538
- &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>
7016
+ &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>
6539
7017
 
6540
7018
  </li>
6541
7019
 
@@ -6602,7 +7080,7 @@ function onMouseDown(event) {
6602
7080
  <div class="button run">Run</div>
6603
7081
  </div>
6604
7082
 
6605
- <script type="text/paperscript" canvas="canvas-51">
7083
+ <script type="text/paperscript" canvas="canvas-54">
6606
7084
  function onMouseDrag(event) {
6607
7085
  // Create a circle shaped path at the mouse position,
6608
7086
  // with a radius of 10:
@@ -6619,7 +7097,7 @@ function onMouseDrag(event) {
6619
7097
  });
6620
7098
  }
6621
7099
  </script>
6622
- <div class="canvas"><canvas width="516" height="200" id="canvas-51"></canvas></div>
7100
+ <div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
6623
7101
  </div>
6624
7102
 
6625
7103
 
@@ -6649,7 +7127,7 @@ function onMouseDrag(event) {
6649
7127
  <div class="button run">Run</div>
6650
7128
  </div>
6651
7129
 
6652
- <script type="text/paperscript" canvas="canvas-52">
7130
+ <script type="text/paperscript" canvas="canvas-55">
6653
7131
  function onMouseMove(event) {
6654
7132
  // Create a circle shaped path at the mouse position,
6655
7133
  // with a radius of 10:
@@ -6663,7 +7141,7 @@ function onMouseMove(event) {
6663
7141
  path.removeOnMove();
6664
7142
  }
6665
7143
  </script>
6666
- <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
7144
+ <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
6667
7145
  </div>
6668
7146
 
6669
7147
 
@@ -6693,7 +7171,7 @@ function onMouseMove(event) {
6693
7171
  <div class="button run">Run</div>
6694
7172
  </div>
6695
7173
 
6696
- <script type="text/paperscript" canvas="canvas-53">
7174
+ <script type="text/paperscript" canvas="canvas-56">
6697
7175
  function onMouseDown(event) {
6698
7176
  // Create a circle shaped path at the mouse position,
6699
7177
  // with a radius of 10:
@@ -6707,7 +7185,7 @@ function onMouseDown(event) {
6707
7185
  path.removeOnDown();
6708
7186
  }
6709
7187
  </script>
6710
- <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
7188
+ <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
6711
7189
  </div>
6712
7190
 
6713
7191
 
@@ -6737,7 +7215,7 @@ function onMouseDown(event) {
6737
7215
  <div class="button run">Run</div>
6738
7216
  </div>
6739
7217
 
6740
- <script type="text/paperscript" canvas="canvas-54">
7218
+ <script type="text/paperscript" canvas="canvas-57">
6741
7219
  function onMouseDrag(event) {
6742
7220
  // Create a circle shaped path at the mouse position,
6743
7221
  // with a radius of 10:
@@ -6751,7 +7229,7 @@ function onMouseDrag(event) {
6751
7229
  path.removeOnDrag();
6752
7230
  }
6753
7231
  </script>
6754
- <div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
7232
+ <div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
6755
7233
  </div>
6756
7234
 
6757
7235
 
@@ -6781,7 +7259,7 @@ function onMouseDrag(event) {
6781
7259
  <div class="button run">Run</div>
6782
7260
  </div>
6783
7261
 
6784
- <script type="text/paperscript" canvas="canvas-55">
7262
+ <script type="text/paperscript" canvas="canvas-58">
6785
7263
  function onMouseDown(event) {
6786
7264
  // Create a circle shaped path at the mouse position,
6787
7265
  // with a radius of 10:
@@ -6795,7 +7273,7 @@ function onMouseDown(event) {
6795
7273
  path.removeOnUp();
6796
7274
  }
6797
7275
  </script>
6798
- <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
7276
+ <div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
6799
7277
  </div>
6800
7278
 
6801
7279
 
@@ -6868,7 +7346,7 @@ function onMouseDown(event) {
6868
7346
  <div class="button run">Run</div>
6869
7347
  </div>
6870
7348
 
6871
- <script type="text/paperscript" canvas="canvas-56">
7349
+ <script type="text/paperscript" canvas="canvas-59">
6872
7350
  var path = new Path.Circle({
6873
7351
  radius: view.bounds.height * 0.4,
6874
7352
  center: view.center
@@ -6879,7 +7357,7 @@ path.tween(
6879
7357
  3000
6880
7358
  );
6881
7359
  </script>
6882
- <div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
7360
+ <div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
6883
7361
  </div>
6884
7362
 
6885
7363
 
@@ -6891,7 +7369,7 @@ path.tween(
6891
7369
  <div class="button run">Run</div>
6892
7370
  </div>
6893
7371
 
6894
- <script type="text/paperscript" canvas="canvas-57">
7372
+ <script type="text/paperscript" canvas="canvas-60">
6895
7373
  var path = new Shape.Rectangle({
6896
7374
  fillColor: 'red',
6897
7375
  center: [50, view.center.y],
@@ -6906,7 +7384,7 @@ path.tween({
6906
7384
  duration: 2000
6907
7385
  });
6908
7386
  </script>
6909
- <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
7387
+ <div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
6910
7388
  </div>
6911
7389
 
6912
7390
 
@@ -6972,7 +7450,7 @@ path.tween({
6972
7450
  <div class="button run">Run</div>
6973
7451
  </div>
6974
7452
 
6975
- <script type="text/paperscript" canvas="canvas-58">
7453
+ <script type="text/paperscript" canvas="canvas-61">
6976
7454
  var path = new Path.Rectangle({
6977
7455
  size: [100, 100],
6978
7456
  position: view.center,
@@ -6986,7 +7464,7 @@ path.tween({
6986
7464
  'segments[2].point.x': '-= 50'
6987
7465
  }, 3000);
6988
7466
  </script>
6989
- <div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
7467
+ <div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
6990
7468
  </div>
6991
7469
 
6992
7470
 
@@ -7045,7 +7523,7 @@ path.tween({
7045
7523
  <div class="button run">Run</div>
7046
7524
  </div>
7047
7525
 
7048
- <script type="text/paperscript" canvas="canvas-59">
7526
+ <script type="text/paperscript" canvas="canvas-62">
7049
7527
  var path = new Path.Circle({
7050
7528
  fillColor: 'blue',
7051
7529
  radius: view.bounds.height * 0.4,
@@ -7061,7 +7539,7 @@ path.tween(2000).onUpdate = function(event) {
7061
7539
  path.interpolate(pathFrom, pathTo, event.factor)
7062
7540
  };
7063
7541
  </script>
7064
- <div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
7542
+ <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7065
7543
  </div>
7066
7544
 
7067
7545
 
@@ -7182,7 +7660,7 @@ path.tween(2000).onUpdate = function(event) {
7182
7660
  <div class="button run">Run</div>
7183
7661
  </div>
7184
7662
 
7185
- <script type="text/paperscript" canvas="canvas-60">
7663
+ <script type="text/paperscript" canvas="canvas-63">
7186
7664
  var path = new Path.Circle({
7187
7665
  fillColor: 'blue',
7188
7666
  radius: view.bounds.height * 0.4,
@@ -7190,7 +7668,7 @@ var path = new Path.Circle({
7190
7668
  });
7191
7669
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7192
7670
  </script>
7193
- <div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
7671
+ <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
7194
7672
  </div>
7195
7673
 
7196
7674
 
@@ -8699,7 +9177,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
8699
9177
 
8700
9178
  <!-- =========================== copyright notice ========================== -->
8701
9179
  <p class="footer">
8702
- Paper.js v0.16.0<br>
9180
+ Paper.js v0.17.0<br>
8703
9181
  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>
8704
9182
  <div class="content-end"></div>
8705
9183