paper 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +24 -16
  3. package/dist/docs/assets/js/paper.js +4811 -808
  4. package/dist/docs/classes/AreaText.html +771 -243
  5. package/dist/docs/classes/ChangeFlag.html +1 -1
  6. package/dist/docs/classes/Color.html +218 -21
  7. package/dist/docs/classes/CompoundPath.html +1174 -274
  8. package/dist/docs/classes/Curve.html +2 -2
  9. package/dist/docs/classes/CurveLocation.html +1 -1
  10. package/dist/docs/classes/DrawEvent.html +69 -0
  11. package/dist/docs/classes/Effect.html +434 -0
  12. package/dist/docs/classes/EffectInstance.html +304 -0
  13. package/dist/docs/classes/Event.html +1 -1
  14. package/dist/docs/classes/Gradient.html +1 -1
  15. package/dist/docs/classes/GradientStop.html +1 -1
  16. package/dist/docs/classes/Group.html +842 -243
  17. package/dist/docs/classes/HitResult.html +1 -1
  18. package/dist/docs/classes/HostItem.html +770 -242
  19. package/dist/docs/classes/Item.html +827 -242
  20. package/dist/docs/classes/Key.html +1 -1
  21. package/dist/docs/classes/KeyEvent.html +1 -1
  22. package/dist/docs/classes/Layer.html +784 -185
  23. package/dist/docs/classes/Matrix.html +1 -1
  24. package/dist/docs/classes/MouseEvent.html +1 -1
  25. package/dist/docs/classes/PaperScope.html +1 -1
  26. package/dist/docs/classes/PaperScript.html +4 -2
  27. package/dist/docs/classes/Path.html +1366 -352
  28. package/dist/docs/classes/PathItem.html +1198 -298
  29. package/dist/docs/classes/PathText.html +772 -244
  30. package/dist/docs/classes/PatternDefinition.html +367 -0
  31. package/dist/docs/classes/Point.html +33 -5
  32. package/dist/docs/classes/PointText.html +771 -243
  33. package/dist/docs/classes/Project.html +251 -9
  34. package/dist/docs/classes/Raster.html +770 -242
  35. package/dist/docs/classes/Rectangle.html +50 -8
  36. package/dist/docs/classes/Segment.html +79 -2
  37. package/dist/docs/classes/Shape.html +770 -242
  38. package/dist/docs/classes/Size.html +31 -3
  39. package/dist/docs/classes/StrokeProfileStop.html +346 -0
  40. package/dist/docs/classes/Style.html +67 -6
  41. package/dist/docs/classes/SymbolDefinition.html +28 -2
  42. package/dist/docs/classes/SymbolItem.html +807 -242
  43. package/dist/docs/classes/TextItem.html +771 -243
  44. package/dist/docs/classes/TextRange.html +1 -1
  45. package/dist/docs/classes/TextStory.html +1 -1
  46. package/dist/docs/classes/Tool.html +2 -2
  47. package/dist/docs/classes/ToolEvent.html +1 -1
  48. package/dist/docs/classes/Tween.html +1 -1
  49. package/dist/docs/classes/View.html +2 -2
  50. package/dist/docs/classes/global.html +1 -1
  51. package/dist/docs/classes/index.html +2 -2
  52. package/dist/docs/index.html +1 -1
  53. package/dist/node/browser.js +15 -0
  54. package/dist/paper-core.js +4701 -728
  55. package/dist/paper-core.min.js +3 -3
  56. package/dist/paper-full.js +4811 -808
  57. package/dist/paper-full.min.js +3 -3
  58. package/dist/paper-hosted.js +5389 -892
  59. package/dist/paper.d.ts +1058 -69
  60. package/examples/Paperjs.org/LiveEffects.html +366 -0
  61. package/examples/Paperjs.org/Offsetting.html +379 -0
  62. package/examples/Paperjs.org/StrokeProfiles.html +706 -0
  63. package/examples/Scripts/Patterns.html +57 -0
  64. package/package.json +21 -11
@@ -1148,7 +1148,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
1148
1148
  <div class="member-description hidden">
1149
1149
 
1150
1150
  <div class="member-text">
1151
- <p>The direction the paragraph&rsquo;s lines run in, which <code>&#39;start&#39;</code> and <code>&#39;end&#39;</code> follow; <code>null</code> for left to right.</p>
1151
+ <p>The direction the paragraph&rsquo;s lines run in, which <code>&#39;start&#39;</code> and <code>&#39;end&#39;</code> follow, and from which side their pieces are placed; <code>null</code> for left to right. Lines that mix directions across styles aren&rsquo;t reordered by the Unicode bidirectional algorithm: their pieces follow the paragraph&rsquo;s direction, and canvas orders only the letters within each piece.</p>
1152
1152
 
1153
1153
 
1154
1154
  <ul class="member-list">
@@ -1533,6 +1533,91 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
1533
1533
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
1534
1534
 
1535
1535
 
1536
+ <div id="effects" class="member">
1537
+ <div class="member-link">
1538
+ <a name="effects" href="#effects"><tt><b>effects</b></tt></a>
1539
+ </div>
1540
+ <div class="member-description hidden">
1541
+
1542
+ <div class="member-text">
1543
+ <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,
1544
+ 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>
1545
+ <p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
1546
+ <ul>
1547
+ <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>
1548
+ <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>
1549
+ </ul>
1550
+
1551
+
1552
+
1553
+ <ul class="member-list">
1554
+ <h4>Type:</h4>
1555
+ <li>
1556
+ Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
1557
+ </li>
1558
+ </ul>
1559
+
1560
+
1561
+ <h4>Example:</h4>
1562
+
1563
+ <div class="paperscript split">
1564
+
1565
+ <div class="buttons">
1566
+ <div class="button run">Run</div>
1567
+ </div>
1568
+
1569
+ <script type="text/paperscript" canvas="canvas-0">
1570
+ var path = new Path.Star({
1571
+ center: view.center,
1572
+ points: 5,
1573
+ radius1: 20,
1574
+ radius2: 40,
1575
+ strokeColor: 'black',
1576
+ strokeWidth: 8
1577
+ });
1578
+ path.effects = [
1579
+ { type: 'offset', parameters: { distance: 10, join: 'round' } },
1580
+ { type: 'outline' }
1581
+ ];
1582
+ </script>
1583
+ <div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
1584
+ </div>
1585
+
1586
+
1587
+ </div>
1588
+
1589
+ </div>
1590
+ </div>
1591
+
1592
+
1593
+ <div id="previewbounds-matrix" class="member">
1594
+ <div class="member-link">
1595
+ <a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
1596
+ </div>
1597
+ <div class="member-description hidden">
1598
+
1599
+ <div class="member-text">
1600
+ <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>
1601
+
1602
+ <p>Read only.</p>
1603
+
1604
+
1605
+
1606
+ <ul class="member-list">
1607
+ <h4>Type:</h4>
1608
+ <li>
1609
+ <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
1610
+ </li>
1611
+ </ul>
1612
+
1613
+
1614
+
1615
+ </div>
1616
+
1617
+ </div>
1618
+ </div>
1619
+
1620
+
1536
1621
  <div id="key" class="member">
1537
1622
  <div class="member-link">
1538
1623
  <a name="key" href="#key"><tt><b>key</b></tt></a>
@@ -1645,7 +1730,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
1645
1730
  <div class="button run">Run</div>
1646
1731
  </div>
1647
1732
 
1648
- <script type="text/paperscript" canvas="canvas-0">
1733
+ <script type="text/paperscript" canvas="canvas-1">
1649
1734
  var path = new Path.Circle({
1650
1735
  center: [80, 50],
1651
1736
  radius: 35
@@ -1660,7 +1745,7 @@ group.addChild(path);
1660
1745
  // The path can be accessed by name:
1661
1746
  group.children['example'].fillColor = 'red';
1662
1747
  </script>
1663
- <div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
1748
+ <div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
1664
1749
  </div>
1665
1750
 
1666
1751
 
@@ -1698,7 +1783,7 @@ group.children['example'].fillColor = 'red';
1698
1783
  <div class="button run">Run</div>
1699
1784
  </div>
1700
1785
 
1701
- <script type="text/paperscript" canvas="canvas-1">
1786
+ <script type="text/paperscript" canvas="canvas-2">
1702
1787
  var circle = new Path.Circle({
1703
1788
  center: [80, 50],
1704
1789
  radius: 30
@@ -1709,7 +1794,7 @@ circle.style = {
1709
1794
  strokeWidth: 5
1710
1795
  };
1711
1796
  </script>
1712
- <div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
1797
+ <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
1713
1798
  </div>
1714
1799
 
1715
1800
 
@@ -1721,7 +1806,7 @@ circle.style = {
1721
1806
  <div class="button run">Run</div>
1722
1807
  </div>
1723
1808
 
1724
- <script type="text/paperscript" canvas="canvas-2">
1809
+ <script type="text/paperscript" canvas="canvas-3">
1725
1810
  var path = new Path.Circle({
1726
1811
  center: [50, 50],
1727
1812
  radius: 30,
@@ -1736,7 +1821,7 @@ var path2 = new Path.Circle({
1736
1821
  // Copy the path style of path:
1737
1822
  path2.style = path.style;
1738
1823
  </script>
1739
- <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
1824
+ <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
1740
1825
  </div>
1741
1826
 
1742
1827
 
@@ -1748,7 +1833,7 @@ path2.style = path.style;
1748
1833
  <div class="button run">Run</div>
1749
1834
  </div>
1750
1835
 
1751
- <script type="text/paperscript" canvas="canvas-3">
1836
+ <script type="text/paperscript" canvas="canvas-4">
1752
1837
  var myStyle = {
1753
1838
  fillColor: 'red',
1754
1839
  strokeColor: 'blue',
@@ -1767,7 +1852,7 @@ var path2 = new Path.Circle({
1767
1852
  });
1768
1853
  path2.style = myStyle;
1769
1854
  </script>
1770
- <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
1855
+ <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
1771
1856
  </div>
1772
1857
 
1773
1858
 
@@ -1809,7 +1894,7 @@ path2.style = myStyle;
1809
1894
  <div class="button run">Run</div>
1810
1895
  </div>
1811
1896
 
1812
- <script type="text/paperscript" canvas="canvas-4">
1897
+ <script type="text/paperscript" canvas="canvas-5">
1813
1898
  var unlockedItem = new Path.Circle({
1814
1899
  center: view.center - [35, 0],
1815
1900
  radius: 30,
@@ -1836,7 +1921,7 @@ new PointText({
1836
1921
  justification: 'center'
1837
1922
  });
1838
1923
  </script>
1839
- <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
1924
+ <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
1840
1925
  </div>
1841
1926
 
1842
1927
 
@@ -1878,7 +1963,7 @@ new PointText({
1878
1963
  <div class="button run">Run</div>
1879
1964
  </div>
1880
1965
 
1881
- <script type="text/paperscript" canvas="canvas-5">
1966
+ <script type="text/paperscript" canvas="canvas-6">
1882
1967
  var path = new Path.Circle({
1883
1968
  center: [50, 50],
1884
1969
  radius: 20,
@@ -1888,7 +1973,7 @@ var path = new Path.Circle({
1888
1973
  // Hide the path:
1889
1974
  path.visible = false;
1890
1975
  </script>
1891
- <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
1976
+ <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
1892
1977
  </div>
1893
1978
 
1894
1979
 
@@ -1936,7 +2021,7 @@ path.visible = false;
1936
2021
  <div class="button run">Run</div>
1937
2022
  </div>
1938
2023
 
1939
- <script type="text/paperscript" canvas="canvas-6">
2024
+ <script type="text/paperscript" canvas="canvas-7">
1940
2025
  // Create a white rectangle in the background
1941
2026
  // with the same dimensions as the view:
1942
2027
  var background = new Path.Rectangle(view.bounds);
@@ -1957,7 +2042,7 @@ var circle2 = new Path.Circle({
1957
2042
  // Set the blend mode of circle2:
1958
2043
  circle2.blendMode = 'multiply';
1959
2044
  </script>
1960
- <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
2045
+ <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
1961
2046
  </div>
1962
2047
 
1963
2048
 
@@ -1999,7 +2084,7 @@ circle2.blendMode = 'multiply';
1999
2084
  <div class="button run">Run</div>
2000
2085
  </div>
2001
2086
 
2002
- <script type="text/paperscript" canvas="canvas-7">
2087
+ <script type="text/paperscript" canvas="canvas-8">
2003
2088
  var circle = new Path.Circle({
2004
2089
  center: [80, 50],
2005
2090
  radius: 35,
@@ -2017,7 +2102,7 @@ var circle2 = new Path.Circle({
2017
2102
  // Make circle2 50% transparent:
2018
2103
  circle2.opacity = 0.5;
2019
2104
  </script>
2020
- <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
2105
+ <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
2021
2106
  </div>
2022
2107
 
2023
2108
 
@@ -2140,14 +2225,14 @@ circle.textWrap = { offset: 10 };</code></pre>
2140
2225
  <div class="button run">Run</div>
2141
2226
  </div>
2142
2227
 
2143
- <script type="text/paperscript" canvas="canvas-8">
2228
+ <script type="text/paperscript" canvas="canvas-9">
2144
2229
  var path = new Path.Circle({
2145
2230
  center: [80, 50],
2146
2231
  radius: 35
2147
2232
  });
2148
2233
  path.selected = true; // Select the path
2149
2234
  </script>
2150
- <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
2235
+ <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
2151
2236
  </div>
2152
2237
 
2153
2238
 
@@ -2304,7 +2389,7 @@ console.log(path.data.pets.length); // 1</code></pre>
2304
2389
  <div class="button run">Run</div>
2305
2390
  </div>
2306
2391
 
2307
- <script type="text/paperscript" canvas="canvas-9">
2392
+ <script type="text/paperscript" canvas="canvas-10">
2308
2393
  // Create a circle at position { x: 10, y: 10 }
2309
2394
  var circle = new Path.Circle({
2310
2395
  center: new Point(10, 10),
@@ -2318,7 +2403,7 @@ circle.position = new Point(20, 20);
2318
2403
  // Move the circle 100 points to the right and 50 points down
2319
2404
  circle.position += new Point(100, 50);
2320
2405
  </script>
2321
- <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
2406
+ <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
2322
2407
  </div>
2323
2408
 
2324
2409
 
@@ -2330,7 +2415,7 @@ circle.position += new Point(100, 50);
2330
2415
  <div class="button run">Run</div>
2331
2416
  </div>
2332
2417
 
2333
- <script type="text/paperscript" canvas="canvas-10">
2418
+ <script type="text/paperscript" canvas="canvas-11">
2334
2419
  // Create a circle at position { x: 20, y: 20 }
2335
2420
  var circle = new Path.Circle({
2336
2421
  center: new Point(20, 20),
@@ -2341,7 +2426,7 @@ var circle = new Path.Circle({
2341
2426
  // Move the circle 100 points to the right
2342
2427
  circle.position.x += 100;
2343
2428
  </script>
2344
- <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
2429
+ <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
2345
2430
  </div>
2346
2431
 
2347
2432
 
@@ -2867,7 +2952,7 @@ console.log(group.children[0] == path); // true</code></pre>
2867
2952
  <div class="button run">Run</div>
2868
2953
  </div>
2869
2954
 
2870
- <script type="text/paperscript" canvas="canvas-11">
2955
+ <script type="text/paperscript" canvas="canvas-12">
2871
2956
  var path = new Path.Circle({
2872
2957
  center: [80, 50],
2873
2958
  radius: 35
@@ -2880,7 +2965,7 @@ group.addChild(path);
2880
2965
  // Access the path through the group's children array:
2881
2966
  group.children[0].fillColor = 'red';
2882
2967
  </script>
2883
- <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
2968
+ <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
2884
2969
  </div>
2885
2970
 
2886
2971
 
@@ -2892,7 +2977,7 @@ group.children[0].fillColor = 'red';
2892
2977
  <div class="button run">Run</div>
2893
2978
  </div>
2894
2979
 
2895
- <script type="text/paperscript" canvas="canvas-12">
2980
+ <script type="text/paperscript" canvas="canvas-13">
2896
2981
  var path = new Path.Circle({
2897
2982
  center: [80, 50],
2898
2983
  radius: 35
@@ -2907,7 +2992,7 @@ group.addChild(path);
2907
2992
  // The path can be accessed by name:
2908
2993
  group.children['example'].fillColor = 'orange';
2909
2994
  </script>
2910
- <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
2995
+ <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
2911
2996
  </div>
2912
2997
 
2913
2998
 
@@ -2919,7 +3004,7 @@ group.children['example'].fillColor = 'orange';
2919
3004
  <div class="button run">Run</div>
2920
3005
  </div>
2921
3006
 
2922
- <script type="text/paperscript" canvas="canvas-13">
3007
+ <script type="text/paperscript" canvas="canvas-14">
2923
3008
  var path = new Path.Circle({
2924
3009
  center: [80, 50],
2925
3010
  radius: 35
@@ -2931,7 +3016,7 @@ group.children = [path];
2931
3016
  // The path is the first child of the group:
2932
3017
  group.firstChild.fillColor = 'green';
2933
3018
  </script>
2934
- <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
3019
+ <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
2935
3020
  </div>
2936
3021
 
2937
3022
 
@@ -3108,7 +3193,7 @@ group.firstChild.fillColor = 'green';
3108
3193
  <div class="button run">Run</div>
3109
3194
  </div>
3110
3195
 
3111
- <script type="text/paperscript" canvas="canvas-14">
3196
+ <script type="text/paperscript" canvas="canvas-15">
3112
3197
  // Create a circle shaped path at { x: 80, y: 50 }
3113
3198
  // with a radius of 35:
3114
3199
  var circle = new Path.Circle({
@@ -3119,7 +3204,7 @@ var circle = new Path.Circle({
3119
3204
  // Set its stroke color to RGB red:
3120
3205
  circle.strokeColor = new Color(1, 0, 0);
3121
3206
  </script>
3122
- <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
3207
+ <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
3123
3208
  </div>
3124
3209
 
3125
3210
 
@@ -3156,7 +3241,7 @@ circle.strokeColor = new Color(1, 0, 0);
3156
3241
  <div class="button run">Run</div>
3157
3242
  </div>
3158
3243
 
3159
- <script type="text/paperscript" canvas="canvas-15">
3244
+ <script type="text/paperscript" canvas="canvas-16">
3160
3245
  // Create a circle shaped path at { x: 80, y: 50 }
3161
3246
  // with a radius of 35:
3162
3247
  var circle = new Path.Circle({
@@ -3168,7 +3253,7 @@ var circle = new Path.Circle({
3168
3253
  // Set its stroke width to 10:
3169
3254
  circle.strokeWidth = 10;
3170
3255
  </script>
3171
- <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
3256
+ <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
3172
3257
  </div>
3173
3258
 
3174
3259
 
@@ -3215,7 +3300,7 @@ circle.strokeWidth = 10;
3215
3300
  <div class="button run">Run</div>
3216
3301
  </div>
3217
3302
 
3218
- <script type="text/paperscript" canvas="canvas-16">
3303
+ <script type="text/paperscript" canvas="canvas-17">
3219
3304
  var line = new Path({
3220
3305
  segments: [[80, 50], [420, 50]],
3221
3306
  strokeColor: 'black',
@@ -3236,7 +3321,7 @@ var line2 = line.clone();
3236
3321
  line2.position.y += 100;
3237
3322
  line2.strokeCap = 'butt';
3238
3323
  </script>
3239
- <div class="canvas"><canvas width="516" height="200" id="canvas-16"></canvas></div>
3324
+ <div class="canvas"><canvas width="516" height="200" id="canvas-17"></canvas></div>
3240
3325
  </div>
3241
3326
 
3242
3327
 
@@ -3283,7 +3368,7 @@ line2.strokeCap = 'butt';
3283
3368
  <div class="button run">Run</div>
3284
3369
  </div>
3285
3370
 
3286
- <script type="text/paperscript" canvas="canvas-17">
3371
+ <script type="text/paperscript" canvas="canvas-18">
3287
3372
  var path = new Path({
3288
3373
  segments: [[80, 100], [120, 40], [160, 100]],
3289
3374
  strokeColor: 'black',
@@ -3300,7 +3385,7 @@ var path3 = path2.clone();
3300
3385
  path3.position.x += path3.bounds.width * 1.5;
3301
3386
  path3.strokeJoin = 'bevel';
3302
3387
  </script>
3303
- <div class="canvas"><canvas width="516" height="120" id="canvas-17"></canvas></div>
3388
+ <div class="canvas"><canvas width="516" height="120" id="canvas-18"></canvas></div>
3304
3389
  </div>
3305
3390
 
3306
3391
 
@@ -3404,7 +3489,7 @@ path3.strokeJoin = 'bevel';
3404
3489
  <div class="button run">Run</div>
3405
3490
  </div>
3406
3491
 
3407
- <script type="text/paperscript" canvas="canvas-18">
3492
+ <script type="text/paperscript" canvas="canvas-19">
3408
3493
  var path = new Path.Circle({
3409
3494
  center: [80, 50],
3410
3495
  radius: 40,
@@ -3415,7 +3500,7 @@ var path = new Path.Circle({
3415
3500
  // Set the dashed stroke to [10pt dash, 4pt gap]:
3416
3501
  path.dashArray = [10, 4];
3417
3502
  </script>
3418
- <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
3503
+ <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
3419
3504
  </div>
3420
3505
 
3421
3506
 
@@ -3450,6 +3535,42 @@ path.dashArray = [10, 4];
3450
3535
 
3451
3536
 
3452
3537
 
3538
+ </div>
3539
+
3540
+ </div>
3541
+ </div>
3542
+
3543
+
3544
+ <div id="paintorder" class="member">
3545
+ <div class="member-link">
3546
+ <a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
3547
+ </div>
3548
+ <div class="member-description hidden">
3549
+
3550
+ <div class="member-text">
3551
+ <p>The order in which the fill and the stroke are painted, as in SVG&rsquo;s <code>paint-order</code>, named after what is painted first: <code>&#39;fill&#39;</code> paints the fill first, <code>&#39;stroke&#39;</code> paints the stroke first, so the fill covers its inner half.</p>
3552
+
3553
+
3554
+ <ul class="member-list">
3555
+ <h4>Values:</h4>
3556
+ <li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
3557
+ </ul>
3558
+
3559
+
3560
+ <ul class="member-list">
3561
+ <h4>Default:</h4>
3562
+ <li><tt>'fill'</tt></li>
3563
+ </ul>
3564
+
3565
+ <ul class="member-list">
3566
+ <h4>Type:</h4>
3567
+ <li>
3568
+ <tt>String</tt>
3569
+ </li>
3570
+ </ul>
3571
+
3572
+
3573
+
3453
3574
  </div>
3454
3575
 
3455
3576
  </div>
@@ -3485,7 +3606,7 @@ path.dashArray = [10, 4];
3485
3606
  <div class="button run">Run</div>
3486
3607
  </div>
3487
3608
 
3488
- <script type="text/paperscript" canvas="canvas-19">
3609
+ <script type="text/paperscript" canvas="canvas-20">
3489
3610
  // Create a circle shaped path at { x: 80, y: 50 }
3490
3611
  // with a radius of 35:
3491
3612
  var circle = new Path.Circle({
@@ -3496,7 +3617,7 @@ var circle = new Path.Circle({
3496
3617
  // Set the fill color of the circle to RGB red:
3497
3618
  circle.fillColor = new Color(1, 0, 0);
3498
3619
  </script>
3499
- <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
3620
+ <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
3500
3621
  </div>
3501
3622
 
3502
3623
 
@@ -3571,7 +3692,7 @@ circle.fillColor = new Color(1, 0, 0);
3571
3692
  <div class="button run">Run</div>
3572
3693
  </div>
3573
3694
 
3574
- <script type="text/paperscript" canvas="canvas-20">
3695
+ <script type="text/paperscript" canvas="canvas-21">
3575
3696
  var circle = new Path.Circle({
3576
3697
  center: [80, 50],
3577
3698
  radius: 35,
@@ -3584,7 +3705,7 @@ var circle = new Path.Circle({
3584
3705
  shadowOffset: new Point(5, 5)
3585
3706
  });
3586
3707
  </script>
3587
- <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
3708
+ <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
3588
3709
  </div>
3589
3710
 
3590
3711
 
@@ -3725,7 +3846,7 @@ var circle = new Path.Circle({
3725
3846
  <div class="button run">Run</div>
3726
3847
  </div>
3727
3848
 
3728
- <script type="text/paperscript" canvas="canvas-21">
3849
+ <script type="text/paperscript" canvas="canvas-22">
3729
3850
  // Create a rectangle shaped path with its top left point at:
3730
3851
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
3731
3852
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -3736,7 +3857,7 @@ path.onFrame = function(event) {
3736
3857
  this.rotate(3);
3737
3858
  }
3738
3859
  </script>
3739
- <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
3860
+ <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
3740
3861
  </div>
3741
3862
 
3742
3863
 
@@ -3780,7 +3901,7 @@ path.onFrame = function(event) {
3780
3901
  <div class="button run">Run</div>
3781
3902
  </div>
3782
3903
 
3783
- <script type="text/paperscript" canvas="canvas-22">
3904
+ <script type="text/paperscript" canvas="canvas-23">
3784
3905
  // Create a circle shaped path at the center of the view:
3785
3906
  var path = new Path.Circle({
3786
3907
  center: view.center,
@@ -3794,7 +3915,7 @@ path.onMouseDown = function(event) {
3794
3915
  this.fillColor = 'red';
3795
3916
  }
3796
3917
  </script>
3797
- <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
3918
+ <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
3798
3919
  </div>
3799
3920
 
3800
3921
 
@@ -3806,7 +3927,7 @@ path.onMouseDown = function(event) {
3806
3927
  <div class="button run">Run</div>
3807
3928
  </div>
3808
3929
 
3809
- <script type="text/paperscript" canvas="canvas-23">
3930
+ <script type="text/paperscript" canvas="canvas-24">
3810
3931
  // Loop 30 times:
3811
3932
  for (var i = 0; i < 30; i++) {
3812
3933
  // Create a circle shaped path at a random position
@@ -3824,7 +3945,7 @@ for (var i = 0; i < 30; i++) {
3824
3945
  }
3825
3946
  }
3826
3947
  </script>
3827
- <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
3948
+ <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
3828
3949
  </div>
3829
3950
 
3830
3951
 
@@ -3868,7 +3989,7 @@ for (var i = 0; i < 30; i++) {
3868
3989
  <div class="button run">Run</div>
3869
3990
  </div>
3870
3991
 
3871
- <script type="text/paperscript" canvas="canvas-24">
3992
+ <script type="text/paperscript" canvas="canvas-25">
3872
3993
  // Create a circle shaped path at the center of the view:
3873
3994
  var path = new Path.Circle({
3874
3995
  center: view.center,
@@ -3881,7 +4002,7 @@ path.onMouseDrag = function(event) {
3881
4002
  path.position += event.delta;
3882
4003
  }
3883
4004
  </script>
3884
- <div class="canvas"><canvas width="516" height="240" id="canvas-24"></canvas></div>
4005
+ <div class="canvas"><canvas width="516" height="240" id="canvas-25"></canvas></div>
3885
4006
  </div>
3886
4007
 
3887
4008
 
@@ -3925,7 +4046,7 @@ path.onMouseDrag = function(event) {
3925
4046
  <div class="button run">Run</div>
3926
4047
  </div>
3927
4048
 
3928
- <script type="text/paperscript" canvas="canvas-25">
4049
+ <script type="text/paperscript" canvas="canvas-26">
3929
4050
  // Create a circle shaped path at the center of the view:
3930
4051
  var path = new Path.Circle({
3931
4052
  center: view.center,
@@ -3939,7 +4060,7 @@ path.onMouseUp = function(event) {
3939
4060
  this.fillColor = 'red';
3940
4061
  }
3941
4062
  </script>
3942
- <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
4063
+ <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
3943
4064
  </div>
3944
4065
 
3945
4066
 
@@ -3983,7 +4104,7 @@ path.onMouseUp = function(event) {
3983
4104
  <div class="button run">Run</div>
3984
4105
  </div>
3985
4106
 
3986
- <script type="text/paperscript" canvas="canvas-26">
4107
+ <script type="text/paperscript" canvas="canvas-27">
3987
4108
  // Create a circle shaped path at the center of the view:
3988
4109
  var path = new Path.Circle({
3989
4110
  center: view.center,
@@ -3997,7 +4118,7 @@ path.onClick = function(event) {
3997
4118
  this.fillColor = 'red';
3998
4119
  }
3999
4120
  </script>
4000
- <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
4121
+ <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
4001
4122
  </div>
4002
4123
 
4003
4124
 
@@ -4009,7 +4130,7 @@ path.onClick = function(event) {
4009
4130
  <div class="button run">Run</div>
4010
4131
  </div>
4011
4132
 
4012
- <script type="text/paperscript" canvas="canvas-27">
4133
+ <script type="text/paperscript" canvas="canvas-28">
4013
4134
  // Loop 30 times:
4014
4135
  for (var i = 0; i < 30; i++) {
4015
4136
  // Create a circle shaped path at a random position
@@ -4027,7 +4148,7 @@ for (var i = 0; i < 30; i++) {
4027
4148
  }
4028
4149
  }
4029
4150
  </script>
4030
- <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
4151
+ <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
4031
4152
  </div>
4032
4153
 
4033
4154
 
@@ -4071,7 +4192,7 @@ for (var i = 0; i < 30; i++) {
4071
4192
  <div class="button run">Run</div>
4072
4193
  </div>
4073
4194
 
4074
- <script type="text/paperscript" canvas="canvas-28">
4195
+ <script type="text/paperscript" canvas="canvas-29">
4075
4196
  // Create a circle shaped path at the center of the view:
4076
4197
  var path = new Path.Circle({
4077
4198
  center: view.center,
@@ -4085,7 +4206,7 @@ path.onDoubleClick = function(event) {
4085
4206
  this.fillColor = 'red';
4086
4207
  }
4087
4208
  </script>
4088
- <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
4209
+ <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
4089
4210
  </div>
4090
4211
 
4091
4212
 
@@ -4097,7 +4218,7 @@ path.onDoubleClick = function(event) {
4097
4218
  <div class="button run">Run</div>
4098
4219
  </div>
4099
4220
 
4100
- <script type="text/paperscript" canvas="canvas-29">
4221
+ <script type="text/paperscript" canvas="canvas-30">
4101
4222
  // Loop 30 times:
4102
4223
  for (var i = 0; i < 30; i++) {
4103
4224
  // Create a circle shaped path at a random position
@@ -4115,7 +4236,7 @@ for (var i = 0; i < 30; i++) {
4115
4236
  }
4116
4237
  }
4117
4238
  </script>
4118
- <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
4239
+ <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
4119
4240
  </div>
4120
4241
 
4121
4242
 
@@ -4159,7 +4280,7 @@ for (var i = 0; i < 30; i++) {
4159
4280
  <div class="button run">Run</div>
4160
4281
  </div>
4161
4282
 
4162
- <script type="text/paperscript" canvas="canvas-30">
4283
+ <script type="text/paperscript" canvas="canvas-31">
4163
4284
  // Create a circle shaped path at the center of the view:
4164
4285
  var path = new Path.Circle({
4165
4286
  center: view.center,
@@ -4167,180 +4288,567 @@ for (var i = 0; i < 30; i++) {
4167
4288
  fillColor: 'black'
4168
4289
  });
4169
4290
 
4170
- // When the mouse moves on top of the item, set its opacity
4171
- // to a random value between 0 and 1:
4172
- path.onMouseMove = function(event) {
4173
- this.opacity = Math.random();
4174
- }
4175
- </script>
4176
- <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
4177
- </div>
4291
+ // When the mouse moves on top of the item, set its opacity
4292
+ // to a random value between 0 and 1:
4293
+ path.onMouseMove = function(event) {
4294
+ this.opacity = Math.random();
4295
+ }
4296
+ </script>
4297
+ <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
4298
+ </div>
4299
+
4300
+
4301
+ </div>
4302
+
4303
+ </div>
4304
+ </div>
4305
+
4306
+
4307
+ <div id="onmouseenter" class="member">
4308
+ <div class="member-link">
4309
+ <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
4310
+ </div>
4311
+ <div class="member-description hidden">
4312
+
4313
+ <div class="member-text">
4314
+ <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>
4315
+
4316
+
4317
+
4318
+ <ul class="member-list">
4319
+ <h4>Type:</h4>
4320
+ <li>
4321
+ <tt>Function</tt>⟋<tt>null</tt>
4322
+ </li>
4323
+ </ul>
4324
+
4325
+
4326
+ <ul class="member-list">
4327
+ <h4>See also:</h4>
4328
+
4329
+ <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
4330
+
4331
+ </ul>
4332
+
4333
+ <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>
4334
+
4335
+ <div class="paperscript split">
4336
+
4337
+ <div class="buttons">
4338
+ <div class="button run">Run</div>
4339
+ </div>
4340
+
4341
+ <script type="text/paperscript" canvas="canvas-32">
4342
+ // Create a circle shaped path at the center of the view:
4343
+ var path = new Path.Circle({
4344
+ center: view.center,
4345
+ radius: 25,
4346
+ fillColor: 'black'
4347
+ });
4348
+
4349
+ // When the mouse enters the item, set its fill color to red:
4350
+ path.onMouseEnter = function(event) {
4351
+ this.fillColor = 'red';
4352
+ }
4353
+
4354
+ // When the mouse leaves the item, set its fill color to black:
4355
+ path.onMouseLeave = function(event) {
4356
+ this.fillColor = 'black';
4357
+ }
4358
+ </script>
4359
+ <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
4360
+ </div>
4361
+
4362
+
4363
+ <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>
4364
+
4365
+ <div class="paperscript split">
4366
+
4367
+ <div class="buttons">
4368
+ <div class="button run">Run</div>
4369
+ </div>
4370
+
4371
+ <script type="text/paperscript" canvas="canvas-33">
4372
+ function enter(event) {
4373
+ this.fillColor = 'red';
4374
+ }
4375
+
4376
+ function leave(event) {
4377
+ this.fillColor = 'black';
4378
+ }
4379
+
4380
+ // When the mouse is pressed:
4381
+ function onMouseDown(event) {
4382
+ // Create a circle shaped path at the position of the mouse:
4383
+ var path = new Path.Circle(event.point, 25);
4384
+ path.fillColor = 'black';
4385
+
4386
+ // When the mouse enters the item, set its fill color to red:
4387
+ path.onMouseEnter = enter;
4388
+
4389
+ // When the mouse leaves the item, set its fill color to black:
4390
+ path.onMouseLeave = leave;
4391
+ }
4392
+ </script>
4393
+ <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
4394
+ </div>
4395
+
4396
+
4397
+ </div>
4398
+
4399
+ </div>
4400
+ </div>
4401
+
4402
+
4403
+ <div id="onmouseleave" class="member">
4404
+ <div class="member-link">
4405
+ <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
4406
+ </div>
4407
+ <div class="member-description hidden">
4408
+
4409
+ <div class="member-text">
4410
+ <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>
4411
+
4412
+
4413
+
4414
+ <ul class="member-list">
4415
+ <h4>Type:</h4>
4416
+ <li>
4417
+ <tt>Function</tt>⟋<tt>null</tt>
4418
+ </li>
4419
+ </ul>
4420
+
4421
+
4422
+ <ul class="member-list">
4423
+ <h4>See also:</h4>
4424
+
4425
+ <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
4426
+
4427
+ </ul>
4428
+
4429
+ <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>
4430
+
4431
+ <div class="paperscript split">
4432
+
4433
+ <div class="buttons">
4434
+ <div class="button run">Run</div>
4435
+ </div>
4436
+
4437
+ <script type="text/paperscript" canvas="canvas-34">
4438
+ // Create a circle shaped path at the center of the view:
4439
+ var path = new Path.Circle({
4440
+ center: view.center,
4441
+ radius: 25,
4442
+ fillColor: 'black'
4443
+ });
4444
+
4445
+ // When the mouse leaves the item, set its fill color to red:
4446
+ path.onMouseLeave = function(event) {
4447
+ this.fillColor = 'red';
4448
+ }
4449
+ </script>
4450
+ <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
4451
+ </div>
4452
+
4453
+
4454
+ </div>
4455
+
4456
+ </div>
4457
+ </div>
4458
+
4459
+
4460
+ <div id="ondraw" class="member">
4461
+ <div class="member-link">
4462
+ <a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
4463
+ </div>
4464
+ <div class="member-description hidden">
4465
+
4466
+ <div class="member-text">
4467
+ <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>
4468
+
4469
+
4470
+
4471
+ <ul class="member-list">
4472
+ <h4>Type:</h4>
4473
+ <li>
4474
+ <tt>Function</tt>⟋<tt>null</tt>
4475
+ </li>
4476
+ </ul>
4477
+ <ul class="member-list">
4478
+ <h4>Options:</h4>
4479
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the item that is drawn</li>
4480
+ <li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> &mdash; the canvas context, transformed into the item&rsquo;s coordinates</li>
4481
+ <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>
4482
+ <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>
4483
+ <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>()
4484
+ 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>
4485
+ </ul>
4486
+
4487
+ <h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
4488
+
4489
+ <div class="paperscript split">
4490
+
4491
+ <div class="buttons">
4492
+ <div class="button run">Run</div>
4493
+ </div>
4494
+
4495
+ <script type="text/paperscript" canvas="canvas-35">
4496
+ var path = new Path.Circle({
4497
+ center: view.center,
4498
+ radius: 25,
4499
+ fillColor: 'rgba(255, 0, 0, 0.5)'
4500
+ });
4501
+
4502
+ path.onDraw = function(event) {
4503
+ var ctx = event.context,
4504
+ center = this.position,
4505
+ scale = event.matrix.scaling.x;
4506
+ ctx.beginPath();
4507
+ ctx.moveTo(center.x - 40, center.y);
4508
+ ctx.lineTo(center.x + 40, center.y);
4509
+ ctx.moveTo(center.x, center.y - 40);
4510
+ ctx.lineTo(center.x, center.y + 40);
4511
+ ctx.lineWidth = 1 / scale;
4512
+ ctx.stroke();
4513
+ }
4514
+ </script>
4515
+ <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
4516
+ </div>
4517
+
4518
+
4519
+ </div>
4520
+
4521
+ </div>
4522
+ </div>
4523
+
4524
+
4525
+ <div id="ondrawselection" class="member">
4526
+ <div class="member-link">
4527
+ <a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
4528
+ </div>
4529
+ <div class="member-description hidden">
4530
+
4531
+ <div class="member-text">
4532
+ <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>
4533
+
4534
+
4535
+
4536
+ <ul class="member-list">
4537
+ <h4>Type:</h4>
4538
+ <li>
4539
+ <tt>Function</tt>⟋<tt>null</tt>
4540
+ </li>
4541
+ </ul>
4542
+ <ul class="member-list">
4543
+ <h4>Options:</h4>
4544
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the selected item</li>
4545
+ <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>
4546
+ <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>
4547
+ <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>
4548
+ <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>
4549
+ <li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> &mdash; the view drawn into
4550
+ What the handler draws isn&rsquo;t part of the item&rsquo;s hit testing, its bounds or its SVG export.</li>
4551
+ </ul>
4552
+
4553
+ <h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
4554
+
4555
+ <div class="paperscript split">
4556
+
4557
+ <div class="buttons">
4558
+ <div class="button run">Run</div>
4559
+ </div>
4560
+
4561
+ <script type="text/paperscript" canvas="canvas-36">
4562
+ var path = new Path.Star({
4563
+ center: view.center,
4564
+ points: 5,
4565
+ radius1: 20,
4566
+ radius2: 40,
4567
+ strokeColor: 'black',
4568
+ selected: true
4569
+ });
4570
+
4571
+ path.onDrawSelection = function(event) {
4572
+ var ctx = event.context;
4573
+ this.segments.forEach(function(segment) {
4574
+ var point = event.matrix.transform(segment.point);
4575
+ ctx.beginPath();
4576
+ ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
4577
+ ctx.fill();
4578
+ });
4579
+ return false;
4580
+ }
4581
+ </script>
4582
+ <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
4583
+ </div>
4584
+
4585
+
4586
+ </div>
4587
+
4588
+ </div>
4589
+ </div>
4590
+
4591
+ </div>
4592
+
4593
+
4594
+ <!-- =========================== inherited methods ========================= -->
4595
+ <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
4596
+
4597
+
4598
+ <div id="addeffect-effect" class="member">
4599
+ <div class="member-link">
4600
+ <a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
4601
+ </div>
4602
+ <div class="member-description hidden">
4603
+ <div class="member-text">
4604
+ <p>Adds an effect at the end of the item&rsquo;s effects.</p>
4605
+
4606
+
4607
+ <ul class="member-list">
4608
+ <h4>Parameters:</h4>
4609
+
4610
+ <li>
4611
+ <tt>effect:</tt>
4612
+ <tt>Object</tt>
4613
+ &mdash;&nbsp;the plain object describing the effect
4614
+
4615
+ </li>
4616
+
4617
+ </ul>
4618
+
4619
+
4620
+ <ul class="member-list">
4621
+ <h4>Returns:</h4>
4622
+
4623
+ <li>
4624
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the added instance
4625
+ </li>
4626
+
4627
+
4628
+ </ul>
4629
+
4630
+
4631
+
4632
+
4633
+
4634
+ </div>
4635
+ </div>
4636
+ </div>
4637
+
4638
+
4639
+ <div id="inserteffect-index-effect" class="member">
4640
+ <div class="member-link">
4641
+ <a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
4642
+ </div>
4643
+ <div class="member-description hidden">
4644
+ <div class="member-text">
4645
+ <p>Inserts an effect into the item&rsquo;s effects at the given index.</p>
4646
+
4647
+
4648
+ <ul class="member-list">
4649
+ <h4>Parameters:</h4>
4650
+
4651
+ <li>
4652
+ <tt>index:</tt>
4653
+ <tt>Number</tt>
4654
+ &mdash;&nbsp;the index at which to insert the effect
4655
+
4656
+ </li>
4657
+
4658
+ <li>
4659
+ <tt>effect:</tt>
4660
+ <tt>Object</tt>
4661
+ &mdash;&nbsp;the plain object describing the effect
4662
+
4663
+ </li>
4664
+
4665
+ </ul>
4666
+
4667
+
4668
+ <ul class="member-list">
4669
+ <h4>Returns:</h4>
4670
+
4671
+ <li>
4672
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted instance
4673
+ </li>
4674
+
4675
+
4676
+ </ul>
4677
+
4678
+
4679
+
4680
+
4681
+
4682
+ </div>
4683
+ </div>
4684
+ </div>
4685
+
4686
+
4687
+ <div id="inserteffects-index-effects" class="member">
4688
+ <div class="member-link">
4689
+ <a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
4690
+ </div>
4691
+ <div class="member-description hidden">
4692
+ <div class="member-text">
4693
+ <p>Inserts effects into the item&rsquo;s effects at the given index.</p>
4694
+
4695
+
4696
+ <ul class="member-list">
4697
+ <h4>Parameters:</h4>
4698
+
4699
+ <li>
4700
+ <tt>index:</tt>
4701
+ <tt>Number</tt>
4702
+ &mdash;&nbsp;the index at which to insert the effects
4703
+
4704
+ </li>
4705
+
4706
+ <li>
4707
+ <tt>effects:</tt>
4708
+ Array of <tt>Object</tt> objects
4709
+ &mdash;&nbsp;the plain objects describing the effects
4710
+
4711
+ </li>
4712
+
4713
+ </ul>
4714
+
4715
+
4716
+ <ul class="member-list">
4717
+ <h4>Returns:</h4>
4718
+
4719
+ <li>
4720
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the inserted instances
4721
+ </li>
4722
+
4723
+
4724
+ </ul>
4178
4725
 
4179
4726
 
4180
- </div>
4181
4727
 
4728
+
4729
+
4730
+ </div>
4182
4731
  </div>
4183
4732
  </div>
4184
4733
 
4185
4734
 
4186
- <div id="onmouseenter" class="member">
4735
+ <div id="removeeffect-index" class="member">
4187
4736
  <div class="member-link">
4188
- <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
4737
+ <a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
4189
4738
  </div>
4190
4739
  <div class="member-description hidden">
4191
-
4192
4740
  <div class="member-text">
4193
- <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>
4741
+ <p>Removes the effect at the given index from the item&rsquo;s effects.</p>
4742
+
4194
4743
 
4744
+ <ul class="member-list">
4745
+ <h4>Parameters:</h4>
4195
4746
 
4747
+ <li>
4748
+ <tt>index:</tt>
4749
+ <tt>Number</tt>
4750
+ &mdash;&nbsp;the index of the effect to remove
4751
+
4752
+ </li>
4196
4753
 
4197
- <ul class="member-list">
4198
- <h4>Type:</h4>
4199
- <li>
4200
- <tt>Function</tt>⟋<tt>null</tt>
4201
- </li>
4202
- </ul>
4203
-
4754
+ </ul>
4755
+
4204
4756
 
4205
4757
  <ul class="member-list">
4206
- <h4>See also:</h4>
4758
+ <h4>Returns:</h4>
4207
4759
 
4208
- <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
4760
+ <li>
4761
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the removed instance, or <code>null</code>
4762
+ </li>
4763
+
4209
4764
 
4210
4765
  </ul>
4211
4766
 
4212
- <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>
4213
4767
 
4214
- <div class="paperscript split">
4215
4768
 
4216
- <div class="buttons">
4217
- <div class="button run">Run</div>
4769
+
4770
+
4218
4771
  </div>
4219
-
4220
- <script type="text/paperscript" canvas="canvas-31">
4221
- // Create a circle shaped path at the center of the view:
4222
- var path = new Path.Circle({
4223
- center: view.center,
4224
- radius: 25,
4225
- fillColor: 'black'
4226
- });
4227
-
4228
- // When the mouse enters the item, set its fill color to red:
4229
- path.onMouseEnter = function(event) {
4230
- this.fillColor = 'red';
4231
- }
4232
-
4233
- // When the mouse leaves the item, set its fill color to black:
4234
- path.onMouseLeave = function(event) {
4235
- this.fillColor = 'black';
4236
- }
4237
- </script>
4238
- <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
4239
4772
  </div>
4240
-
4241
-
4242
- <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>
4243
-
4244
- <div class="paperscript split">
4245
-
4246
- <div class="buttons">
4247
- <div class="button run">Run</div>
4248
4773
  </div>
4249
4774
 
4250
- <script type="text/paperscript" canvas="canvas-32">
4251
- function enter(event) {
4252
- this.fillColor = 'red';
4253
- }
4254
-
4255
- function leave(event) {
4256
- this.fillColor = 'black';
4257
- }
4775
+
4776
+ <div id="removeeffects" class="member">
4777
+ <div class="member-link">
4778
+ <a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
4779
+ </div>
4780
+ <div class="member-description hidden">
4781
+ <div class="member-text">
4782
+ <p>Removes the effects from the start index to the end index from the item&rsquo;s effects, or all of them.</p>
4783
+
4784
+
4785
+ <ul class="member-list">
4786
+ <h4>Parameters:</h4>
4787
+
4788
+ <li>
4789
+ <tt>start:</tt>
4790
+ <tt>Number</tt>
4791
+ &mdash;&nbsp;the index of the first effect to remove
4792
+ &mdash;&nbsp;optional, default: <tt>0</tt>
4793
+ </li>
4794
+
4795
+ <li>
4796
+ <tt>end:</tt>
4797
+ <tt>Number</tt>
4798
+ &mdash;&nbsp;the index after the last one
4799
+ &mdash;&nbsp;optional, default: <tt>effects.length</tt>
4800
+ </li>
4801
+
4802
+ </ul>
4258
4803
 
4259
- // When the mouse is pressed:
4260
- function onMouseDown(event) {
4261
- // Create a circle shaped path at the position of the mouse:
4262
- var path = new Path.Circle(event.point, 25);
4263
- path.fillColor = 'black';
4804
+
4805
+ <ul class="member-list">
4806
+ <h4>Returns:</h4>
4807
+
4808
+ <li>
4809
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the removed instances
4810
+ </li>
4264
4811
 
4265
- // When the mouse enters the item, set its fill color to red:
4266
- path.onMouseEnter = enter;
4812
+
4813
+ </ul>
4267
4814
 
4268
- // When the mouse leaves the item, set its fill color to black:
4269
- path.onMouseLeave = leave;
4270
- }
4271
- </script>
4272
- <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
4273
- </div>
4274
4815
 
4275
4816
 
4817
+
4818
+
4276
4819
  </div>
4277
-
4278
4820
  </div>
4279
4821
  </div>
4280
4822
 
4281
4823
 
4282
- <div id="onmouseleave" class="member">
4824
+ <div id="geteffectoutput" class="member">
4283
4825
  <div class="member-link">
4284
- <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
4826
+ <a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
4285
4827
  </div>
4286
4828
  <div class="member-description hidden">
4287
-
4288
4829
  <div class="member-text">
4289
- <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>
4290
-
4291
-
4292
-
4293
- <ul class="member-list">
4294
- <h4>Type:</h4>
4295
- <li>
4296
- <tt>Function</tt>⟋<tt>null</tt>
4297
- </li>
4298
- </ul>
4830
+ <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>
4299
4831
 
4300
4832
 
4833
+
4301
4834
  <ul class="member-list">
4302
- <h4>See also:</h4>
4835
+ <h4>Returns:</h4>
4303
4836
 
4304
- <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
4837
+ <li>
4838
+ <tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt>&nbsp;&mdash;&nbsp;the output of the effects
4839
+ </li>
4840
+
4305
4841
 
4306
4842
  </ul>
4307
4843
 
4308
- <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>
4309
-
4310
- <div class="paperscript split">
4311
-
4312
- <div class="buttons">
4313
- <div class="button run">Run</div>
4314
- </div>
4315
-
4316
- <script type="text/paperscript" canvas="canvas-33">
4317
- // Create a circle shaped path at the center of the view:
4318
- var path = new Path.Circle({
4319
- center: view.center,
4320
- radius: 25,
4321
- fillColor: 'black'
4322
- });
4323
-
4324
- // When the mouse leaves the item, set its fill color to red:
4325
- path.onMouseLeave = function(event) {
4326
- this.fillColor = 'red';
4327
- }
4328
- </script>
4329
- <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
4330
- </div>
4331
-
4332
4844
 
4333
- </div>
4334
4845
 
4846
+
4847
+
4335
4848
  </div>
4336
4849
  </div>
4337
-
4338
4850
  </div>
4339
4851
 
4340
-
4341
- <!-- =========================== inherited methods ========================= -->
4342
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
4343
-
4344
4852
 
4345
4853
  <div id="set-props" class="member">
4346
4854
  <div class="member-link">
@@ -4385,7 +4893,7 @@ path.onMouseLeave = function(event) {
4385
4893
  <div class="button run">Run</div>
4386
4894
  </div>
4387
4895
 
4388
- <script type="text/paperscript" canvas="canvas-34">
4896
+ <script type="text/paperscript" canvas="canvas-37">
4389
4897
  var circle = new Path.Circle({
4390
4898
  center: [80, 50],
4391
4899
  radius: 35
@@ -4398,7 +4906,7 @@ circle.set({
4398
4906
  selected: true
4399
4907
  });
4400
4908
  </script>
4401
- <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
4909
+ <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
4402
4910
  </div>
4403
4911
 
4404
4912
 
@@ -4454,7 +4962,7 @@ circle.set({
4454
4962
  <div class="button run">Run</div>
4455
4963
  </div>
4456
4964
 
4457
- <script type="text/paperscript" canvas="canvas-35">
4965
+ <script type="text/paperscript" canvas="canvas-38">
4458
4966
  var circle = new Path.Circle({
4459
4967
  center: [50, 50],
4460
4968
  radius: 10,
@@ -4469,7 +4977,7 @@ for (var i = 0; i < 20; i++) {
4469
4977
  copy.position.x += i * copy.bounds.width;
4470
4978
  }
4471
4979
  </script>
4472
- <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
4980
+ <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
4473
4981
  </div>
4474
4982
 
4475
4983
 
@@ -4595,7 +5103,7 @@ for (var i = 0; i < 20; i++) {
4595
5103
  <div class="button run">Run</div>
4596
5104
  </div>
4597
5105
 
4598
- <script type="text/paperscript" canvas="canvas-36">
5106
+ <script type="text/paperscript" canvas="canvas-39">
4599
5107
  var circle = new Path.Circle({
4600
5108
  center: [50, 50],
4601
5109
  radius: 5,
@@ -4612,7 +5120,7 @@ raster.position.x += 100;
4612
5120
  circle.scale(5);
4613
5121
  raster.scale(5);
4614
5122
  </script>
4615
- <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
5123
+ <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
4616
5124
  </div>
4617
5125
 
4618
5126
 
@@ -4666,7 +5174,7 @@ raster.scale(5);
4666
5174
  <div class="button run">Run</div>
4667
5175
  </div>
4668
5176
 
4669
- <script type="text/paperscript" canvas="canvas-37">
5177
+ <script type="text/paperscript" canvas="canvas-40">
4670
5178
  var path = new Path.Star({
4671
5179
  center: [50, 50],
4672
5180
  points: 12,
@@ -4687,7 +5195,7 @@ function onMouseDown(event) {
4687
5195
  }
4688
5196
  }
4689
5197
  </script>
4690
- <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
5198
+ <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
4691
5199
  </div>
4692
5200
 
4693
5201
 
@@ -5205,11 +5713,17 @@ function onMouseDown(event) {
5205
5713
  </div>
5206
5714
  <div class="member-description hidden">
5207
5715
  <div class="member-text">
5208
- <p>Exports the item with its content and child items as an SVG DOM.</p>
5716
+ <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>
5209
5717
  <ul class="member-list">
5210
5718
  <h4>Options:</h4>
5211
- <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>
5212
- <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>
5719
+ <li>[options.bounds] {String|Rectangle} the bounds of the area to
5720
+ export, either as a string ({@values 'view', content'}), or a
5721
+ {@link Rectangle} object: `'view'` uses the view bounds,
5722
+ `'content'` uses the stroke bounds of the item</li>
5723
+ <li>[options.matrix] {Matrix} the matrix with which to transform the
5724
+ exported content: If `options.bounds` is set to `'view'`,
5725
+ `paper.view.matrix` is used, for all other settings of
5726
+ `options.bounds` the identity matrix is used.</li>
5213
5727
  <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>
5214
5728
  <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>
5215
5729
  <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>
@@ -5217,6 +5731,12 @@ function onMouseDown(event) {
5217
5731
  <li><tt>options.reuseImages: <tt>Boolean</tt></tt> &mdash; whether raster images with the same content should only be exported once into the <code>&lt;defs&gt;</code> element, and placed through <code>&lt;use&gt;</code> elements referencing it &mdash;&nbsp;default: <tt>false</tt></li>
5218
5732
  <li><tt>options.idPrefix: <tt>String</tt></tt> &mdash; a prefix for the ids generated for definitions such as gradients, clip paths and symbols, to keep them unique when several exported SVGs are placed in one document &mdash;&nbsp;default: <tt>&rsquo;&rsquo;</tt></li>
5219
5733
  <li><tt>options.reduceAttributes: <tt>Boolean</tt></tt> &mdash; wether to only include style attributes in the SVG output that differ from their parents, or to always include them (much faster but leading to redundancies). &mdash;&nbsp;default: <tt>true</tt></li>
5734
+ <li>[options.processNode] {Function} the function to process the
5735
+ SVG node made for each exported item, receiving an object with the
5736
+ `item` and its `node`: It can change the node, e.g. to add attributes
5737
+ that Paper.js doesn't export, or return a node to replace it with. It
5738
+ is called before the item's name, style, visibility and data are set
5739
+ on the node, which replace attributes of the same names.</li>
5220
5740
  </ul>
5221
5741
 
5222
5742
  <ul class="member-list">
@@ -5259,6 +5779,7 @@ function onMouseDown(event) {
5259
5779
  <div class="member-text">
5260
5780
  <p>Converts the provided SVG content into Paper.js items and adds them to the this item&rsquo;s children list. Note that the item is not cleared first. You can call <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>() to do so.</p>
5261
5781
  <p><code>&lt;symbol&gt;</code> elements are imported as <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> items, and the <code>&lt;use&gt;</code> elements that place them as <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> items. The styles that <code>&lt;use&gt;</code> elements inherit don&rsquo;t reach the symbols&rsquo; content.</p>
5782
+ <p>The layers in SVG content that Paper.js exported come back as <a href="../classes/Layer.html"><tt>Layer</tt></a> items inside the imported group. To make the layers of a project&rsquo;s SVG the layers of a project again, add them to it with <code>item.children.slice().forEach(project.addLayer, project)</code>.</p>
5262
5783
  <p>URLs are fetched as they are, so validate URLs that come from untrusted sources first, especially on servers, where they could reach internal addresses.</p>
5263
5784
  <ul class="member-list">
5264
5785
  <h4>Options:</h4>
@@ -5270,6 +5791,13 @@ function onMouseDown(event) {
5270
5791
  <li><tt>options.onError: <tt>Function</tt></tt> &mdash; the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
5271
5792
  <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the imported items should be added to the item that <code>importSVG()</code> is called on &mdash;&nbsp;default: <tt>true</tt></li>
5272
5793
  <li><tt>options.applyMatrix: <tt>Boolean</tt></tt> &mdash; whether the imported items should have their transformation matrices applied to their contents or not &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.applyMatrix</tt></li>
5794
+ <li>[options.processItem] {Function} the function to process the
5795
+ item made for each imported SVG element, receiving an object with
5796
+ the `item` and its `node`: It can read attributes that Paper.js
5797
+ doesn't import, or return an item to replace it with. It is called
5798
+ after the element's attributes and data are applied to the item, so
5799
+ it can extend `item.data`. A replacement item doesn't receive them:
5800
+ copy them over from `item` as needed.</li>
5273
5801
  </ul>
5274
5802
 
5275
5803
  <ul class="member-list">
@@ -6549,7 +7077,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
6549
7077
  <div class="button run">Run</div>
6550
7078
  </div>
6551
7079
 
6552
- <script type="text/paperscript" canvas="canvas-38">
7080
+ <script type="text/paperscript" canvas="canvas-41">
6553
7081
  // Create a rectangle shaped path with its top left
6554
7082
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
6555
7083
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -6558,7 +7086,7 @@ path.fillColor = 'black';
6558
7086
  // Rotate the path by 30 degrees:
6559
7087
  path.rotate(30);
6560
7088
  </script>
6561
- <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
7089
+ <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
6562
7090
  </div>
6563
7091
 
6564
7092
 
@@ -6570,7 +7098,7 @@ path.rotate(30);
6570
7098
  <div class="button run">Run</div>
6571
7099
  </div>
6572
7100
 
6573
- <script type="text/paperscript" canvas="canvas-39">
7101
+ <script type="text/paperscript" canvas="canvas-42">
6574
7102
  // Create a rectangle shaped path with its top left
6575
7103
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
6576
7104
  var topLeft = new Point(175, 50);
@@ -6592,7 +7120,7 @@ function onFrame(event) {
6592
7120
  path.rotate(3, view.center);
6593
7121
  }
6594
7122
  </script>
6595
- <div class="canvas"><canvas width="516" height="200" id="canvas-39"></canvas></div>
7123
+ <div class="canvas"><canvas width="516" height="200" id="canvas-42"></canvas></div>
6596
7124
  </div>
6597
7125
 
6598
7126
 
@@ -6641,7 +7169,7 @@ function onFrame(event) {
6641
7169
  <div class="button run">Run</div>
6642
7170
  </div>
6643
7171
 
6644
- <script type="text/paperscript" canvas="canvas-40">
7172
+ <script type="text/paperscript" canvas="canvas-43">
6645
7173
  // Create a circle shaped path at { x: 80, y: 50 }
6646
7174
  // with a radius of 20:
6647
7175
  var circle = new Path.Circle({
@@ -6653,7 +7181,7 @@ var circle = new Path.Circle({
6653
7181
  // Scale the path by 150% from its center point
6654
7182
  circle.scale(1.5);
6655
7183
  </script>
6656
- <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
7184
+ <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
6657
7185
  </div>
6658
7186
 
6659
7187
 
@@ -6665,7 +7193,7 @@ circle.scale(1.5);
6665
7193
  <div class="button run">Run</div>
6666
7194
  </div>
6667
7195
 
6668
- <script type="text/paperscript" canvas="canvas-41">
7196
+ <script type="text/paperscript" canvas="canvas-44">
6669
7197
  // Create a circle shaped path at { x: 80, y: 50 }
6670
7198
  // with a radius of 20:
6671
7199
  var circle = new Path.Circle({
@@ -6677,7 +7205,7 @@ var circle = new Path.Circle({
6677
7205
  // Scale the path 150% from its bottom left corner
6678
7206
  circle.scale(1.5, circle.bounds.bottomLeft);
6679
7207
  </script>
6680
- <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
7208
+ <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
6681
7209
  </div>
6682
7210
 
6683
7211
 
@@ -6733,7 +7261,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
6733
7261
  <div class="button run">Run</div>
6734
7262
  </div>
6735
7263
 
6736
- <script type="text/paperscript" canvas="canvas-42">
7264
+ <script type="text/paperscript" canvas="canvas-45">
6737
7265
  // Create a circle shaped path at { x: 100, y: 50 }
6738
7266
  // with a radius of 20:
6739
7267
  var circle = new Path.Circle({
@@ -6745,7 +7273,7 @@ var circle = new Path.Circle({
6745
7273
  // Scale the path horizontally by 300%
6746
7274
  circle.scale(3, 1);
6747
7275
  </script>
6748
- <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
7276
+ <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
6749
7277
  </div>
6750
7278
 
6751
7279
 
@@ -7183,7 +7711,7 @@ circle.scale(3, 1);
7183
7711
  <div class="button run">Run</div>
7184
7712
  </div>
7185
7713
 
7186
- <script type="text/paperscript" canvas="canvas-43">
7714
+ <script type="text/paperscript" canvas="canvas-46">
7187
7715
  // Create a rectangle shaped path with its top left corner
7188
7716
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
7189
7717
  var path = new Path.Rectangle({
@@ -7204,7 +7732,7 @@ var circlePath = new Path.Circle({
7204
7732
  // the rectangular path:
7205
7733
  circlePath.fitBounds(path.bounds);
7206
7734
  </script>
7207
- <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
7735
+ <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
7208
7736
  </div>
7209
7737
 
7210
7738
 
@@ -7216,7 +7744,7 @@ circlePath.fitBounds(path.bounds);
7216
7744
  <div class="button run">Run</div>
7217
7745
  </div>
7218
7746
 
7219
- <script type="text/paperscript" canvas="canvas-44">
7747
+ <script type="text/paperscript" canvas="canvas-47">
7220
7748
  // Create a rectangle shaped path with its top left corner
7221
7749
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
7222
7750
  var path = new Path.Rectangle({
@@ -7237,7 +7765,7 @@ var circlePath = new Path.Circle({
7237
7765
  // the rectangular path:
7238
7766
  circlePath.fitBounds(path.bounds, 'cover');
7239
7767
  </script>
7240
- <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
7768
+ <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
7241
7769
  </div>
7242
7770
 
7243
7771
 
@@ -7249,7 +7777,7 @@ circlePath.fitBounds(path.bounds, 'cover');
7249
7777
  <div class="button run">Run</div>
7250
7778
  </div>
7251
7779
 
7252
- <script type="text/paperscript" canvas="canvas-45">
7780
+ <script type="text/paperscript" canvas="canvas-48">
7253
7781
  var path = new Path.Circle({
7254
7782
  center: [80, 50],
7255
7783
  radius: 30,
@@ -7259,7 +7787,7 @@ var path = new Path.Circle({
7259
7787
  // Fit the path to the bounding rectangle of the view:
7260
7788
  path.fitBounds(view.bounds);
7261
7789
  </script>
7262
- <div class="canvas"><canvas width="516" height="200" id="canvas-45"></canvas></div>
7790
+ <div class="canvas"><canvas width="516" height="200" id="canvas-48"></canvas></div>
7263
7791
  </div>
7264
7792
 
7265
7793
 
@@ -7285,7 +7813,7 @@ path.fitBounds(view.bounds);
7285
7813
  <li>
7286
7814
  <tt>type:</tt>
7287
7815
  <tt>String</tt>
7288
- &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>
7816
+ &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>
7289
7817
 
7290
7818
  </li>
7291
7819
 
@@ -7320,7 +7848,7 @@ path.fitBounds(view.bounds);
7320
7848
  <div class="button run">Run</div>
7321
7849
  </div>
7322
7850
 
7323
- <script type="text/paperscript" canvas="canvas-46">
7851
+ <script type="text/paperscript" canvas="canvas-49">
7324
7852
  // Create a circle shaped path at the center of the view:
7325
7853
  var path = new Path.Circle({
7326
7854
  center: view.center,
@@ -7338,7 +7866,7 @@ path.on('mouseleave', function() {
7338
7866
  this.fillColor = 'black';
7339
7867
  });
7340
7868
  </script>
7341
- <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
7869
+ <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
7342
7870
  </div>
7343
7871
 
7344
7872
 
@@ -7362,7 +7890,7 @@ path.on('mouseleave', function() {
7362
7890
  <li>
7363
7891
  <tt>object:</tt>
7364
7892
  <tt>Object</tt>
7365
- &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>
7893
+ &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>
7366
7894
 
7367
7895
  </li>
7368
7896
 
@@ -7390,7 +7918,7 @@ path.on('mouseleave', function() {
7390
7918
  <div class="button run">Run</div>
7391
7919
  </div>
7392
7920
 
7393
- <script type="text/paperscript" canvas="canvas-47">
7921
+ <script type="text/paperscript" canvas="canvas-50">
7394
7922
  // Create a circle shaped path at the center of the view:
7395
7923
  var path = new Path.Circle({
7396
7924
  center: view.center,
@@ -7408,7 +7936,7 @@ path.on({
7408
7936
  }
7409
7937
  });
7410
7938
  </script>
7411
- <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
7939
+ <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
7412
7940
  </div>
7413
7941
 
7414
7942
 
@@ -7420,7 +7948,7 @@ path.on({
7420
7948
  <div class="button run">Run</div>
7421
7949
  </div>
7422
7950
 
7423
- <script type="text/paperscript" canvas="canvas-48">
7951
+ <script type="text/paperscript" canvas="canvas-51">
7424
7952
  var pathHandlers = {
7425
7953
  mouseenter: function(event) {
7426
7954
  this.fillColor = 'red';
@@ -7443,7 +7971,7 @@ function onMouseDown(event) {
7443
7971
  path.on(pathHandlers);
7444
7972
  }
7445
7973
  </script>
7446
- <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
7974
+ <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
7447
7975
  </div>
7448
7976
 
7449
7977
 
@@ -7467,7 +7995,7 @@ function onMouseDown(event) {
7467
7995
  <li>
7468
7996
  <tt>type:</tt>
7469
7997
  <tt>String</tt>
7470
- &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>
7998
+ &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>
7471
7999
 
7472
8000
  </li>
7473
8001
 
@@ -7515,7 +8043,7 @@ function onMouseDown(event) {
7515
8043
  <li>
7516
8044
  <tt>object:</tt>
7517
8045
  <tt>Object</tt>
7518
- &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>
8046
+ &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>
7519
8047
 
7520
8048
  </li>
7521
8049
 
@@ -7556,7 +8084,7 @@ function onMouseDown(event) {
7556
8084
  <li>
7557
8085
  <tt>type:</tt>
7558
8086
  <tt>String</tt>
7559
- &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>
8087
+ &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>
7560
8088
 
7561
8089
  </li>
7562
8090
 
@@ -7604,7 +8132,7 @@ function onMouseDown(event) {
7604
8132
  <li>
7605
8133
  <tt>type:</tt>
7606
8134
  <tt>String</tt>
7607
- &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>
8135
+ &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>
7608
8136
 
7609
8137
  </li>
7610
8138
 
@@ -7671,7 +8199,7 @@ function onMouseDown(event) {
7671
8199
  <div class="button run">Run</div>
7672
8200
  </div>
7673
8201
 
7674
- <script type="text/paperscript" canvas="canvas-49">
8202
+ <script type="text/paperscript" canvas="canvas-52">
7675
8203
  function onMouseDrag(event) {
7676
8204
  // Create a circle shaped path at the mouse position,
7677
8205
  // with a radius of 10:
@@ -7688,7 +8216,7 @@ function onMouseDrag(event) {
7688
8216
  });
7689
8217
  }
7690
8218
  </script>
7691
- <div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
8219
+ <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
7692
8220
  </div>
7693
8221
 
7694
8222
 
@@ -7718,7 +8246,7 @@ function onMouseDrag(event) {
7718
8246
  <div class="button run">Run</div>
7719
8247
  </div>
7720
8248
 
7721
- <script type="text/paperscript" canvas="canvas-50">
8249
+ <script type="text/paperscript" canvas="canvas-53">
7722
8250
  function onMouseMove(event) {
7723
8251
  // Create a circle shaped path at the mouse position,
7724
8252
  // with a radius of 10:
@@ -7732,7 +8260,7 @@ function onMouseMove(event) {
7732
8260
  path.removeOnMove();
7733
8261
  }
7734
8262
  </script>
7735
- <div class="canvas"><canvas width="516" height="200" id="canvas-50"></canvas></div>
8263
+ <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
7736
8264
  </div>
7737
8265
 
7738
8266
 
@@ -7762,7 +8290,7 @@ function onMouseMove(event) {
7762
8290
  <div class="button run">Run</div>
7763
8291
  </div>
7764
8292
 
7765
- <script type="text/paperscript" canvas="canvas-51">
8293
+ <script type="text/paperscript" canvas="canvas-54">
7766
8294
  function onMouseDown(event) {
7767
8295
  // Create a circle shaped path at the mouse position,
7768
8296
  // with a radius of 10:
@@ -7776,7 +8304,7 @@ function onMouseDown(event) {
7776
8304
  path.removeOnDown();
7777
8305
  }
7778
8306
  </script>
7779
- <div class="canvas"><canvas width="516" height="200" id="canvas-51"></canvas></div>
8307
+ <div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
7780
8308
  </div>
7781
8309
 
7782
8310
 
@@ -7806,7 +8334,7 @@ function onMouseDown(event) {
7806
8334
  <div class="button run">Run</div>
7807
8335
  </div>
7808
8336
 
7809
- <script type="text/paperscript" canvas="canvas-52">
8337
+ <script type="text/paperscript" canvas="canvas-55">
7810
8338
  function onMouseDrag(event) {
7811
8339
  // Create a circle shaped path at the mouse position,
7812
8340
  // with a radius of 10:
@@ -7820,7 +8348,7 @@ function onMouseDrag(event) {
7820
8348
  path.removeOnDrag();
7821
8349
  }
7822
8350
  </script>
7823
- <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
8351
+ <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
7824
8352
  </div>
7825
8353
 
7826
8354
 
@@ -7850,7 +8378,7 @@ function onMouseDrag(event) {
7850
8378
  <div class="button run">Run</div>
7851
8379
  </div>
7852
8380
 
7853
- <script type="text/paperscript" canvas="canvas-53">
8381
+ <script type="text/paperscript" canvas="canvas-56">
7854
8382
  function onMouseDown(event) {
7855
8383
  // Create a circle shaped path at the mouse position,
7856
8384
  // with a radius of 10:
@@ -7864,7 +8392,7 @@ function onMouseDown(event) {
7864
8392
  path.removeOnUp();
7865
8393
  }
7866
8394
  </script>
7867
- <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
8395
+ <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
7868
8396
  </div>
7869
8397
 
7870
8398
 
@@ -7937,7 +8465,7 @@ function onMouseDown(event) {
7937
8465
  <div class="button run">Run</div>
7938
8466
  </div>
7939
8467
 
7940
- <script type="text/paperscript" canvas="canvas-54">
8468
+ <script type="text/paperscript" canvas="canvas-57">
7941
8469
  var path = new Path.Circle({
7942
8470
  radius: view.bounds.height * 0.4,
7943
8471
  center: view.center
@@ -7948,7 +8476,7 @@ path.tween(
7948
8476
  3000
7949
8477
  );
7950
8478
  </script>
7951
- <div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
8479
+ <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
7952
8480
  </div>
7953
8481
 
7954
8482
 
@@ -7960,7 +8488,7 @@ path.tween(
7960
8488
  <div class="button run">Run</div>
7961
8489
  </div>
7962
8490
 
7963
- <script type="text/paperscript" canvas="canvas-55">
8491
+ <script type="text/paperscript" canvas="canvas-58">
7964
8492
  var path = new Shape.Rectangle({
7965
8493
  fillColor: 'red',
7966
8494
  center: [50, view.center.y],
@@ -7975,7 +8503,7 @@ path.tween({
7975
8503
  duration: 2000
7976
8504
  });
7977
8505
  </script>
7978
- <div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
8506
+ <div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
7979
8507
  </div>
7980
8508
 
7981
8509
 
@@ -8041,7 +8569,7 @@ path.tween({
8041
8569
  <div class="button run">Run</div>
8042
8570
  </div>
8043
8571
 
8044
- <script type="text/paperscript" canvas="canvas-56">
8572
+ <script type="text/paperscript" canvas="canvas-59">
8045
8573
  var path = new Path.Rectangle({
8046
8574
  size: [100, 100],
8047
8575
  position: view.center,
@@ -8055,7 +8583,7 @@ path.tween({
8055
8583
  'segments[2].point.x': '-= 50'
8056
8584
  }, 3000);
8057
8585
  </script>
8058
- <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
8586
+ <div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
8059
8587
  </div>
8060
8588
 
8061
8589
 
@@ -8114,7 +8642,7 @@ path.tween({
8114
8642
  <div class="button run">Run</div>
8115
8643
  </div>
8116
8644
 
8117
- <script type="text/paperscript" canvas="canvas-57">
8645
+ <script type="text/paperscript" canvas="canvas-60">
8118
8646
  var path = new Path.Circle({
8119
8647
  fillColor: 'blue',
8120
8648
  radius: view.bounds.height * 0.4,
@@ -8130,7 +8658,7 @@ path.tween(2000).onUpdate = function(event) {
8130
8658
  path.interpolate(pathFrom, pathTo, event.factor)
8131
8659
  };
8132
8660
  </script>
8133
- <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
8661
+ <div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
8134
8662
  </div>
8135
8663
 
8136
8664
 
@@ -8251,7 +8779,7 @@ path.tween(2000).onUpdate = function(event) {
8251
8779
  <div class="button run">Run</div>
8252
8780
  </div>
8253
8781
 
8254
- <script type="text/paperscript" canvas="canvas-58">
8782
+ <script type="text/paperscript" canvas="canvas-61">
8255
8783
  var path = new Path.Circle({
8256
8784
  fillColor: 'blue',
8257
8785
  radius: view.bounds.height * 0.4,
@@ -8259,7 +8787,7 @@ var path = new Path.Circle({
8259
8787
  });
8260
8788
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
8261
8789
  </script>
8262
- <div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
8790
+ <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
8263
8791
  </div>
8264
8792
 
8265
8793
 
@@ -8273,7 +8801,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
8273
8801
 
8274
8802
  <!-- =========================== copyright notice ========================== -->
8275
8803
  <p class="footer">
8276
- Paper.js v0.15.0<br>
8804
+ Paper.js v0.17.0<br>
8277
8805
  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>
8278
8806
  <div class="content-end"></div>
8279
8807