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
@@ -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
 
@@ -3521,7 +3606,7 @@ path.dashArray = [10, 4];
3521
3606
  <div class="button run">Run</div>
3522
3607
  </div>
3523
3608
 
3524
- <script type="text/paperscript" canvas="canvas-19">
3609
+ <script type="text/paperscript" canvas="canvas-20">
3525
3610
  // Create a circle shaped path at { x: 80, y: 50 }
3526
3611
  // with a radius of 35:
3527
3612
  var circle = new Path.Circle({
@@ -3532,7 +3617,7 @@ var circle = new Path.Circle({
3532
3617
  // Set the fill color of the circle to RGB red:
3533
3618
  circle.fillColor = new Color(1, 0, 0);
3534
3619
  </script>
3535
- <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>
3536
3621
  </div>
3537
3622
 
3538
3623
 
@@ -3607,7 +3692,7 @@ circle.fillColor = new Color(1, 0, 0);
3607
3692
  <div class="button run">Run</div>
3608
3693
  </div>
3609
3694
 
3610
- <script type="text/paperscript" canvas="canvas-20">
3695
+ <script type="text/paperscript" canvas="canvas-21">
3611
3696
  var circle = new Path.Circle({
3612
3697
  center: [80, 50],
3613
3698
  radius: 35,
@@ -3620,7 +3705,7 @@ var circle = new Path.Circle({
3620
3705
  shadowOffset: new Point(5, 5)
3621
3706
  });
3622
3707
  </script>
3623
- <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>
3624
3709
  </div>
3625
3710
 
3626
3711
 
@@ -3761,7 +3846,7 @@ var circle = new Path.Circle({
3761
3846
  <div class="button run">Run</div>
3762
3847
  </div>
3763
3848
 
3764
- <script type="text/paperscript" canvas="canvas-21">
3849
+ <script type="text/paperscript" canvas="canvas-22">
3765
3850
  // Create a rectangle shaped path with its top left point at:
3766
3851
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
3767
3852
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -3772,7 +3857,7 @@ path.onFrame = function(event) {
3772
3857
  this.rotate(3);
3773
3858
  }
3774
3859
  </script>
3775
- <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>
3776
3861
  </div>
3777
3862
 
3778
3863
 
@@ -3816,7 +3901,7 @@ path.onFrame = function(event) {
3816
3901
  <div class="button run">Run</div>
3817
3902
  </div>
3818
3903
 
3819
- <script type="text/paperscript" canvas="canvas-22">
3904
+ <script type="text/paperscript" canvas="canvas-23">
3820
3905
  // Create a circle shaped path at the center of the view:
3821
3906
  var path = new Path.Circle({
3822
3907
  center: view.center,
@@ -3830,7 +3915,7 @@ path.onMouseDown = function(event) {
3830
3915
  this.fillColor = 'red';
3831
3916
  }
3832
3917
  </script>
3833
- <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>
3834
3919
  </div>
3835
3920
 
3836
3921
 
@@ -3842,7 +3927,7 @@ path.onMouseDown = function(event) {
3842
3927
  <div class="button run">Run</div>
3843
3928
  </div>
3844
3929
 
3845
- <script type="text/paperscript" canvas="canvas-23">
3930
+ <script type="text/paperscript" canvas="canvas-24">
3846
3931
  // Loop 30 times:
3847
3932
  for (var i = 0; i < 30; i++) {
3848
3933
  // Create a circle shaped path at a random position
@@ -3860,7 +3945,7 @@ for (var i = 0; i < 30; i++) {
3860
3945
  }
3861
3946
  }
3862
3947
  </script>
3863
- <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>
3864
3949
  </div>
3865
3950
 
3866
3951
 
@@ -3904,7 +3989,7 @@ for (var i = 0; i < 30; i++) {
3904
3989
  <div class="button run">Run</div>
3905
3990
  </div>
3906
3991
 
3907
- <script type="text/paperscript" canvas="canvas-24">
3992
+ <script type="text/paperscript" canvas="canvas-25">
3908
3993
  // Create a circle shaped path at the center of the view:
3909
3994
  var path = new Path.Circle({
3910
3995
  center: view.center,
@@ -3917,7 +4002,7 @@ path.onMouseDrag = function(event) {
3917
4002
  path.position += event.delta;
3918
4003
  }
3919
4004
  </script>
3920
- <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>
3921
4006
  </div>
3922
4007
 
3923
4008
 
@@ -3961,7 +4046,7 @@ path.onMouseDrag = function(event) {
3961
4046
  <div class="button run">Run</div>
3962
4047
  </div>
3963
4048
 
3964
- <script type="text/paperscript" canvas="canvas-25">
4049
+ <script type="text/paperscript" canvas="canvas-26">
3965
4050
  // Create a circle shaped path at the center of the view:
3966
4051
  var path = new Path.Circle({
3967
4052
  center: view.center,
@@ -3975,7 +4060,7 @@ path.onMouseUp = function(event) {
3975
4060
  this.fillColor = 'red';
3976
4061
  }
3977
4062
  </script>
3978
- <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>
3979
4064
  </div>
3980
4065
 
3981
4066
 
@@ -4019,7 +4104,7 @@ path.onMouseUp = function(event) {
4019
4104
  <div class="button run">Run</div>
4020
4105
  </div>
4021
4106
 
4022
- <script type="text/paperscript" canvas="canvas-26">
4107
+ <script type="text/paperscript" canvas="canvas-27">
4023
4108
  // Create a circle shaped path at the center of the view:
4024
4109
  var path = new Path.Circle({
4025
4110
  center: view.center,
@@ -4033,7 +4118,7 @@ path.onClick = function(event) {
4033
4118
  this.fillColor = 'red';
4034
4119
  }
4035
4120
  </script>
4036
- <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>
4037
4122
  </div>
4038
4123
 
4039
4124
 
@@ -4045,7 +4130,7 @@ path.onClick = function(event) {
4045
4130
  <div class="button run">Run</div>
4046
4131
  </div>
4047
4132
 
4048
- <script type="text/paperscript" canvas="canvas-27">
4133
+ <script type="text/paperscript" canvas="canvas-28">
4049
4134
  // Loop 30 times:
4050
4135
  for (var i = 0; i < 30; i++) {
4051
4136
  // Create a circle shaped path at a random position
@@ -4063,7 +4148,7 @@ for (var i = 0; i < 30; i++) {
4063
4148
  }
4064
4149
  }
4065
4150
  </script>
4066
- <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>
4067
4152
  </div>
4068
4153
 
4069
4154
 
@@ -4107,7 +4192,7 @@ for (var i = 0; i < 30; i++) {
4107
4192
  <div class="button run">Run</div>
4108
4193
  </div>
4109
4194
 
4110
- <script type="text/paperscript" canvas="canvas-28">
4195
+ <script type="text/paperscript" canvas="canvas-29">
4111
4196
  // Create a circle shaped path at the center of the view:
4112
4197
  var path = new Path.Circle({
4113
4198
  center: view.center,
@@ -4121,7 +4206,7 @@ path.onDoubleClick = function(event) {
4121
4206
  this.fillColor = 'red';
4122
4207
  }
4123
4208
  </script>
4124
- <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>
4125
4210
  </div>
4126
4211
 
4127
4212
 
@@ -4133,7 +4218,7 @@ path.onDoubleClick = function(event) {
4133
4218
  <div class="button run">Run</div>
4134
4219
  </div>
4135
4220
 
4136
- <script type="text/paperscript" canvas="canvas-29">
4221
+ <script type="text/paperscript" canvas="canvas-30">
4137
4222
  // Loop 30 times:
4138
4223
  for (var i = 0; i < 30; i++) {
4139
4224
  // Create a circle shaped path at a random position
@@ -4151,7 +4236,7 @@ for (var i = 0; i < 30; i++) {
4151
4236
  }
4152
4237
  }
4153
4238
  </script>
4154
- <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>
4155
4240
  </div>
4156
4241
 
4157
4242
 
@@ -4195,7 +4280,7 @@ for (var i = 0; i < 30; i++) {
4195
4280
  <div class="button run">Run</div>
4196
4281
  </div>
4197
4282
 
4198
- <script type="text/paperscript" canvas="canvas-30">
4283
+ <script type="text/paperscript" canvas="canvas-31">
4199
4284
  // Create a circle shaped path at the center of the view:
4200
4285
  var path = new Path.Circle({
4201
4286
  center: view.center,
@@ -4203,180 +4288,567 @@ for (var i = 0; i < 30; i++) {
4203
4288
  fillColor: 'black'
4204
4289
  });
4205
4290
 
4206
- // When the mouse moves on top of the item, set its opacity
4207
- // to a random value between 0 and 1:
4208
- path.onMouseMove = function(event) {
4209
- this.opacity = Math.random();
4210
- }
4211
- </script>
4212
- <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
4213
- </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>
4214
4725
 
4215
4726
 
4216
- </div>
4217
4727
 
4728
+
4729
+
4730
+ </div>
4218
4731
  </div>
4219
4732
  </div>
4220
4733
 
4221
4734
 
4222
- <div id="onmouseenter" class="member">
4735
+ <div id="removeeffect-index" class="member">
4223
4736
  <div class="member-link">
4224
- <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>
4225
4738
  </div>
4226
4739
  <div class="member-description hidden">
4227
-
4228
4740
  <div class="member-text">
4229
- <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
+
4230
4743
 
4744
+ <ul class="member-list">
4745
+ <h4>Parameters:</h4>
4231
4746
 
4747
+ <li>
4748
+ <tt>index:</tt>
4749
+ <tt>Number</tt>
4750
+ &mdash;&nbsp;the index of the effect to remove
4751
+
4752
+ </li>
4232
4753
 
4233
- <ul class="member-list">
4234
- <h4>Type:</h4>
4235
- <li>
4236
- <tt>Function</tt>⟋<tt>null</tt>
4237
- </li>
4238
- </ul>
4239
-
4754
+ </ul>
4755
+
4240
4756
 
4241
4757
  <ul class="member-list">
4242
- <h4>See also:</h4>
4758
+ <h4>Returns:</h4>
4243
4759
 
4244
- <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
+
4245
4764
 
4246
4765
  </ul>
4247
4766
 
4248
- <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>
4249
4767
 
4250
- <div class="paperscript split">
4251
4768
 
4252
- <div class="buttons">
4253
- <div class="button run">Run</div>
4769
+
4770
+
4254
4771
  </div>
4255
-
4256
- <script type="text/paperscript" canvas="canvas-31">
4257
- // Create a circle shaped path at the center of the view:
4258
- var path = new Path.Circle({
4259
- center: view.center,
4260
- radius: 25,
4261
- fillColor: 'black'
4262
- });
4263
-
4264
- // When the mouse enters the item, set its fill color to red:
4265
- path.onMouseEnter = function(event) {
4266
- this.fillColor = 'red';
4267
- }
4268
-
4269
- // When the mouse leaves the item, set its fill color to black:
4270
- path.onMouseLeave = function(event) {
4271
- this.fillColor = 'black';
4272
- }
4273
- </script>
4274
- <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
4275
4772
  </div>
4276
-
4277
-
4278
- <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>
4279
-
4280
- <div class="paperscript split">
4281
-
4282
- <div class="buttons">
4283
- <div class="button run">Run</div>
4284
4773
  </div>
4285
4774
 
4286
- <script type="text/paperscript" canvas="canvas-32">
4287
- function enter(event) {
4288
- this.fillColor = 'red';
4289
- }
4290
-
4291
- function leave(event) {
4292
- this.fillColor = 'black';
4293
- }
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>
4294
4803
 
4295
- // When the mouse is pressed:
4296
- function onMouseDown(event) {
4297
- // Create a circle shaped path at the position of the mouse:
4298
- var path = new Path.Circle(event.point, 25);
4299
- 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>
4300
4811
 
4301
- // When the mouse enters the item, set its fill color to red:
4302
- path.onMouseEnter = enter;
4812
+
4813
+ </ul>
4303
4814
 
4304
- // When the mouse leaves the item, set its fill color to black:
4305
- path.onMouseLeave = leave;
4306
- }
4307
- </script>
4308
- <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
4309
- </div>
4310
4815
 
4311
4816
 
4817
+
4818
+
4312
4819
  </div>
4313
-
4314
4820
  </div>
4315
4821
  </div>
4316
4822
 
4317
4823
 
4318
- <div id="onmouseleave" class="member">
4824
+ <div id="geteffectoutput" class="member">
4319
4825
  <div class="member-link">
4320
- <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
4826
+ <a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
4321
4827
  </div>
4322
4828
  <div class="member-description hidden">
4323
-
4324
4829
  <div class="member-text">
4325
- <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>
4326
-
4327
-
4328
-
4329
- <ul class="member-list">
4330
- <h4>Type:</h4>
4331
- <li>
4332
- <tt>Function</tt>⟋<tt>null</tt>
4333
- </li>
4334
- </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>
4335
4831
 
4336
4832
 
4833
+
4337
4834
  <ul class="member-list">
4338
- <h4>See also:</h4>
4835
+ <h4>Returns:</h4>
4339
4836
 
4340
- <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
+
4341
4841
 
4342
4842
  </ul>
4343
4843
 
4344
- <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>
4345
-
4346
- <div class="paperscript split">
4347
-
4348
- <div class="buttons">
4349
- <div class="button run">Run</div>
4350
- </div>
4351
-
4352
- <script type="text/paperscript" canvas="canvas-33">
4353
- // Create a circle shaped path at the center of the view:
4354
- var path = new Path.Circle({
4355
- center: view.center,
4356
- radius: 25,
4357
- fillColor: 'black'
4358
- });
4359
-
4360
- // When the mouse leaves the item, set its fill color to red:
4361
- path.onMouseLeave = function(event) {
4362
- this.fillColor = 'red';
4363
- }
4364
- </script>
4365
- <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
4366
- </div>
4367
-
4368
4844
 
4369
- </div>
4370
4845
 
4846
+
4847
+
4371
4848
  </div>
4372
4849
  </div>
4373
-
4374
4850
  </div>
4375
4851
 
4376
-
4377
- <!-- =========================== inherited methods ========================= -->
4378
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
4379
-
4380
4852
 
4381
4853
  <div id="set-props" class="member">
4382
4854
  <div class="member-link">
@@ -4421,7 +4893,7 @@ path.onMouseLeave = function(event) {
4421
4893
  <div class="button run">Run</div>
4422
4894
  </div>
4423
4895
 
4424
- <script type="text/paperscript" canvas="canvas-34">
4896
+ <script type="text/paperscript" canvas="canvas-37">
4425
4897
  var circle = new Path.Circle({
4426
4898
  center: [80, 50],
4427
4899
  radius: 35
@@ -4434,7 +4906,7 @@ circle.set({
4434
4906
  selected: true
4435
4907
  });
4436
4908
  </script>
4437
- <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>
4438
4910
  </div>
4439
4911
 
4440
4912
 
@@ -4490,7 +4962,7 @@ circle.set({
4490
4962
  <div class="button run">Run</div>
4491
4963
  </div>
4492
4964
 
4493
- <script type="text/paperscript" canvas="canvas-35">
4965
+ <script type="text/paperscript" canvas="canvas-38">
4494
4966
  var circle = new Path.Circle({
4495
4967
  center: [50, 50],
4496
4968
  radius: 10,
@@ -4505,7 +4977,7 @@ for (var i = 0; i < 20; i++) {
4505
4977
  copy.position.x += i * copy.bounds.width;
4506
4978
  }
4507
4979
  </script>
4508
- <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>
4509
4981
  </div>
4510
4982
 
4511
4983
 
@@ -4631,7 +5103,7 @@ for (var i = 0; i < 20; i++) {
4631
5103
  <div class="button run">Run</div>
4632
5104
  </div>
4633
5105
 
4634
- <script type="text/paperscript" canvas="canvas-36">
5106
+ <script type="text/paperscript" canvas="canvas-39">
4635
5107
  var circle = new Path.Circle({
4636
5108
  center: [50, 50],
4637
5109
  radius: 5,
@@ -4648,7 +5120,7 @@ raster.position.x += 100;
4648
5120
  circle.scale(5);
4649
5121
  raster.scale(5);
4650
5122
  </script>
4651
- <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>
4652
5124
  </div>
4653
5125
 
4654
5126
 
@@ -4702,7 +5174,7 @@ raster.scale(5);
4702
5174
  <div class="button run">Run</div>
4703
5175
  </div>
4704
5176
 
4705
- <script type="text/paperscript" canvas="canvas-37">
5177
+ <script type="text/paperscript" canvas="canvas-40">
4706
5178
  var path = new Path.Star({
4707
5179
  center: [50, 50],
4708
5180
  points: 12,
@@ -4723,7 +5195,7 @@ function onMouseDown(event) {
4723
5195
  }
4724
5196
  }
4725
5197
  </script>
4726
- <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>
4727
5199
  </div>
4728
5200
 
4729
5201
 
@@ -5241,11 +5713,17 @@ function onMouseDown(event) {
5241
5713
  </div>
5242
5714
  <div class="member-description hidden">
5243
5715
  <div class="member-text">
5244
- <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>
5245
5717
  <ul class="member-list">
5246
5718
  <h4>Options:</h4>
5247
- <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>
5248
- <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>
5249
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>
5250
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>
5251
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>
@@ -6599,7 +7077,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
6599
7077
  <div class="button run">Run</div>
6600
7078
  </div>
6601
7079
 
6602
- <script type="text/paperscript" canvas="canvas-38">
7080
+ <script type="text/paperscript" canvas="canvas-41">
6603
7081
  // Create a rectangle shaped path with its top left
6604
7082
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
6605
7083
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -6608,7 +7086,7 @@ path.fillColor = 'black';
6608
7086
  // Rotate the path by 30 degrees:
6609
7087
  path.rotate(30);
6610
7088
  </script>
6611
- <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>
6612
7090
  </div>
6613
7091
 
6614
7092
 
@@ -6620,7 +7098,7 @@ path.rotate(30);
6620
7098
  <div class="button run">Run</div>
6621
7099
  </div>
6622
7100
 
6623
- <script type="text/paperscript" canvas="canvas-39">
7101
+ <script type="text/paperscript" canvas="canvas-42">
6624
7102
  // Create a rectangle shaped path with its top left
6625
7103
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
6626
7104
  var topLeft = new Point(175, 50);
@@ -6642,7 +7120,7 @@ function onFrame(event) {
6642
7120
  path.rotate(3, view.center);
6643
7121
  }
6644
7122
  </script>
6645
- <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>
6646
7124
  </div>
6647
7125
 
6648
7126
 
@@ -6691,7 +7169,7 @@ function onFrame(event) {
6691
7169
  <div class="button run">Run</div>
6692
7170
  </div>
6693
7171
 
6694
- <script type="text/paperscript" canvas="canvas-40">
7172
+ <script type="text/paperscript" canvas="canvas-43">
6695
7173
  // Create a circle shaped path at { x: 80, y: 50 }
6696
7174
  // with a radius of 20:
6697
7175
  var circle = new Path.Circle({
@@ -6703,7 +7181,7 @@ var circle = new Path.Circle({
6703
7181
  // Scale the path by 150% from its center point
6704
7182
  circle.scale(1.5);
6705
7183
  </script>
6706
- <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>
6707
7185
  </div>
6708
7186
 
6709
7187
 
@@ -6715,7 +7193,7 @@ circle.scale(1.5);
6715
7193
  <div class="button run">Run</div>
6716
7194
  </div>
6717
7195
 
6718
- <script type="text/paperscript" canvas="canvas-41">
7196
+ <script type="text/paperscript" canvas="canvas-44">
6719
7197
  // Create a circle shaped path at { x: 80, y: 50 }
6720
7198
  // with a radius of 20:
6721
7199
  var circle = new Path.Circle({
@@ -6727,7 +7205,7 @@ var circle = new Path.Circle({
6727
7205
  // Scale the path 150% from its bottom left corner
6728
7206
  circle.scale(1.5, circle.bounds.bottomLeft);
6729
7207
  </script>
6730
- <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>
6731
7209
  </div>
6732
7210
 
6733
7211
 
@@ -6783,7 +7261,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
6783
7261
  <div class="button run">Run</div>
6784
7262
  </div>
6785
7263
 
6786
- <script type="text/paperscript" canvas="canvas-42">
7264
+ <script type="text/paperscript" canvas="canvas-45">
6787
7265
  // Create a circle shaped path at { x: 100, y: 50 }
6788
7266
  // with a radius of 20:
6789
7267
  var circle = new Path.Circle({
@@ -6795,7 +7273,7 @@ var circle = new Path.Circle({
6795
7273
  // Scale the path horizontally by 300%
6796
7274
  circle.scale(3, 1);
6797
7275
  </script>
6798
- <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>
6799
7277
  </div>
6800
7278
 
6801
7279
 
@@ -7233,7 +7711,7 @@ circle.scale(3, 1);
7233
7711
  <div class="button run">Run</div>
7234
7712
  </div>
7235
7713
 
7236
- <script type="text/paperscript" canvas="canvas-43">
7714
+ <script type="text/paperscript" canvas="canvas-46">
7237
7715
  // Create a rectangle shaped path with its top left corner
7238
7716
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
7239
7717
  var path = new Path.Rectangle({
@@ -7254,7 +7732,7 @@ var circlePath = new Path.Circle({
7254
7732
  // the rectangular path:
7255
7733
  circlePath.fitBounds(path.bounds);
7256
7734
  </script>
7257
- <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>
7258
7736
  </div>
7259
7737
 
7260
7738
 
@@ -7266,7 +7744,7 @@ circlePath.fitBounds(path.bounds);
7266
7744
  <div class="button run">Run</div>
7267
7745
  </div>
7268
7746
 
7269
- <script type="text/paperscript" canvas="canvas-44">
7747
+ <script type="text/paperscript" canvas="canvas-47">
7270
7748
  // Create a rectangle shaped path with its top left corner
7271
7749
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
7272
7750
  var path = new Path.Rectangle({
@@ -7287,7 +7765,7 @@ var circlePath = new Path.Circle({
7287
7765
  // the rectangular path:
7288
7766
  circlePath.fitBounds(path.bounds, 'cover');
7289
7767
  </script>
7290
- <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>
7291
7769
  </div>
7292
7770
 
7293
7771
 
@@ -7299,7 +7777,7 @@ circlePath.fitBounds(path.bounds, 'cover');
7299
7777
  <div class="button run">Run</div>
7300
7778
  </div>
7301
7779
 
7302
- <script type="text/paperscript" canvas="canvas-45">
7780
+ <script type="text/paperscript" canvas="canvas-48">
7303
7781
  var path = new Path.Circle({
7304
7782
  center: [80, 50],
7305
7783
  radius: 30,
@@ -7309,7 +7787,7 @@ var path = new Path.Circle({
7309
7787
  // Fit the path to the bounding rectangle of the view:
7310
7788
  path.fitBounds(view.bounds);
7311
7789
  </script>
7312
- <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>
7313
7791
  </div>
7314
7792
 
7315
7793
 
@@ -7335,7 +7813,7 @@ path.fitBounds(view.bounds);
7335
7813
  <li>
7336
7814
  <tt>type:</tt>
7337
7815
  <tt>String</tt>
7338
- &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>
7339
7817
 
7340
7818
  </li>
7341
7819
 
@@ -7370,7 +7848,7 @@ path.fitBounds(view.bounds);
7370
7848
  <div class="button run">Run</div>
7371
7849
  </div>
7372
7850
 
7373
- <script type="text/paperscript" canvas="canvas-46">
7851
+ <script type="text/paperscript" canvas="canvas-49">
7374
7852
  // Create a circle shaped path at the center of the view:
7375
7853
  var path = new Path.Circle({
7376
7854
  center: view.center,
@@ -7388,7 +7866,7 @@ path.on('mouseleave', function() {
7388
7866
  this.fillColor = 'black';
7389
7867
  });
7390
7868
  </script>
7391
- <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>
7392
7870
  </div>
7393
7871
 
7394
7872
 
@@ -7412,7 +7890,7 @@ path.on('mouseleave', function() {
7412
7890
  <li>
7413
7891
  <tt>object:</tt>
7414
7892
  <tt>Object</tt>
7415
- &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>
7416
7894
 
7417
7895
  </li>
7418
7896
 
@@ -7440,7 +7918,7 @@ path.on('mouseleave', function() {
7440
7918
  <div class="button run">Run</div>
7441
7919
  </div>
7442
7920
 
7443
- <script type="text/paperscript" canvas="canvas-47">
7921
+ <script type="text/paperscript" canvas="canvas-50">
7444
7922
  // Create a circle shaped path at the center of the view:
7445
7923
  var path = new Path.Circle({
7446
7924
  center: view.center,
@@ -7458,7 +7936,7 @@ path.on({
7458
7936
  }
7459
7937
  });
7460
7938
  </script>
7461
- <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>
7462
7940
  </div>
7463
7941
 
7464
7942
 
@@ -7470,7 +7948,7 @@ path.on({
7470
7948
  <div class="button run">Run</div>
7471
7949
  </div>
7472
7950
 
7473
- <script type="text/paperscript" canvas="canvas-48">
7951
+ <script type="text/paperscript" canvas="canvas-51">
7474
7952
  var pathHandlers = {
7475
7953
  mouseenter: function(event) {
7476
7954
  this.fillColor = 'red';
@@ -7493,7 +7971,7 @@ function onMouseDown(event) {
7493
7971
  path.on(pathHandlers);
7494
7972
  }
7495
7973
  </script>
7496
- <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>
7497
7975
  </div>
7498
7976
 
7499
7977
 
@@ -7517,7 +7995,7 @@ function onMouseDown(event) {
7517
7995
  <li>
7518
7996
  <tt>type:</tt>
7519
7997
  <tt>String</tt>
7520
- &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>
7521
7999
 
7522
8000
  </li>
7523
8001
 
@@ -7565,7 +8043,7 @@ function onMouseDown(event) {
7565
8043
  <li>
7566
8044
  <tt>object:</tt>
7567
8045
  <tt>Object</tt>
7568
- &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>
7569
8047
 
7570
8048
  </li>
7571
8049
 
@@ -7606,7 +8084,7 @@ function onMouseDown(event) {
7606
8084
  <li>
7607
8085
  <tt>type:</tt>
7608
8086
  <tt>String</tt>
7609
- &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>
7610
8088
 
7611
8089
  </li>
7612
8090
 
@@ -7654,7 +8132,7 @@ function onMouseDown(event) {
7654
8132
  <li>
7655
8133
  <tt>type:</tt>
7656
8134
  <tt>String</tt>
7657
- &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>
7658
8136
 
7659
8137
  </li>
7660
8138
 
@@ -7721,7 +8199,7 @@ function onMouseDown(event) {
7721
8199
  <div class="button run">Run</div>
7722
8200
  </div>
7723
8201
 
7724
- <script type="text/paperscript" canvas="canvas-49">
8202
+ <script type="text/paperscript" canvas="canvas-52">
7725
8203
  function onMouseDrag(event) {
7726
8204
  // Create a circle shaped path at the mouse position,
7727
8205
  // with a radius of 10:
@@ -7738,7 +8216,7 @@ function onMouseDrag(event) {
7738
8216
  });
7739
8217
  }
7740
8218
  </script>
7741
- <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>
7742
8220
  </div>
7743
8221
 
7744
8222
 
@@ -7768,7 +8246,7 @@ function onMouseDrag(event) {
7768
8246
  <div class="button run">Run</div>
7769
8247
  </div>
7770
8248
 
7771
- <script type="text/paperscript" canvas="canvas-50">
8249
+ <script type="text/paperscript" canvas="canvas-53">
7772
8250
  function onMouseMove(event) {
7773
8251
  // Create a circle shaped path at the mouse position,
7774
8252
  // with a radius of 10:
@@ -7782,7 +8260,7 @@ function onMouseMove(event) {
7782
8260
  path.removeOnMove();
7783
8261
  }
7784
8262
  </script>
7785
- <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>
7786
8264
  </div>
7787
8265
 
7788
8266
 
@@ -7812,7 +8290,7 @@ function onMouseMove(event) {
7812
8290
  <div class="button run">Run</div>
7813
8291
  </div>
7814
8292
 
7815
- <script type="text/paperscript" canvas="canvas-51">
8293
+ <script type="text/paperscript" canvas="canvas-54">
7816
8294
  function onMouseDown(event) {
7817
8295
  // Create a circle shaped path at the mouse position,
7818
8296
  // with a radius of 10:
@@ -7826,7 +8304,7 @@ function onMouseDown(event) {
7826
8304
  path.removeOnDown();
7827
8305
  }
7828
8306
  </script>
7829
- <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>
7830
8308
  </div>
7831
8309
 
7832
8310
 
@@ -7856,7 +8334,7 @@ function onMouseDown(event) {
7856
8334
  <div class="button run">Run</div>
7857
8335
  </div>
7858
8336
 
7859
- <script type="text/paperscript" canvas="canvas-52">
8337
+ <script type="text/paperscript" canvas="canvas-55">
7860
8338
  function onMouseDrag(event) {
7861
8339
  // Create a circle shaped path at the mouse position,
7862
8340
  // with a radius of 10:
@@ -7870,7 +8348,7 @@ function onMouseDrag(event) {
7870
8348
  path.removeOnDrag();
7871
8349
  }
7872
8350
  </script>
7873
- <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>
7874
8352
  </div>
7875
8353
 
7876
8354
 
@@ -7900,7 +8378,7 @@ function onMouseDrag(event) {
7900
8378
  <div class="button run">Run</div>
7901
8379
  </div>
7902
8380
 
7903
- <script type="text/paperscript" canvas="canvas-53">
8381
+ <script type="text/paperscript" canvas="canvas-56">
7904
8382
  function onMouseDown(event) {
7905
8383
  // Create a circle shaped path at the mouse position,
7906
8384
  // with a radius of 10:
@@ -7914,7 +8392,7 @@ function onMouseDown(event) {
7914
8392
  path.removeOnUp();
7915
8393
  }
7916
8394
  </script>
7917
- <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>
7918
8396
  </div>
7919
8397
 
7920
8398
 
@@ -7987,7 +8465,7 @@ function onMouseDown(event) {
7987
8465
  <div class="button run">Run</div>
7988
8466
  </div>
7989
8467
 
7990
- <script type="text/paperscript" canvas="canvas-54">
8468
+ <script type="text/paperscript" canvas="canvas-57">
7991
8469
  var path = new Path.Circle({
7992
8470
  radius: view.bounds.height * 0.4,
7993
8471
  center: view.center
@@ -7998,7 +8476,7 @@ path.tween(
7998
8476
  3000
7999
8477
  );
8000
8478
  </script>
8001
- <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>
8002
8480
  </div>
8003
8481
 
8004
8482
 
@@ -8010,7 +8488,7 @@ path.tween(
8010
8488
  <div class="button run">Run</div>
8011
8489
  </div>
8012
8490
 
8013
- <script type="text/paperscript" canvas="canvas-55">
8491
+ <script type="text/paperscript" canvas="canvas-58">
8014
8492
  var path = new Shape.Rectangle({
8015
8493
  fillColor: 'red',
8016
8494
  center: [50, view.center.y],
@@ -8025,7 +8503,7 @@ path.tween({
8025
8503
  duration: 2000
8026
8504
  });
8027
8505
  </script>
8028
- <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>
8029
8507
  </div>
8030
8508
 
8031
8509
 
@@ -8091,7 +8569,7 @@ path.tween({
8091
8569
  <div class="button run">Run</div>
8092
8570
  </div>
8093
8571
 
8094
- <script type="text/paperscript" canvas="canvas-56">
8572
+ <script type="text/paperscript" canvas="canvas-59">
8095
8573
  var path = new Path.Rectangle({
8096
8574
  size: [100, 100],
8097
8575
  position: view.center,
@@ -8105,7 +8583,7 @@ path.tween({
8105
8583
  'segments[2].point.x': '-= 50'
8106
8584
  }, 3000);
8107
8585
  </script>
8108
- <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>
8109
8587
  </div>
8110
8588
 
8111
8589
 
@@ -8164,7 +8642,7 @@ path.tween({
8164
8642
  <div class="button run">Run</div>
8165
8643
  </div>
8166
8644
 
8167
- <script type="text/paperscript" canvas="canvas-57">
8645
+ <script type="text/paperscript" canvas="canvas-60">
8168
8646
  var path = new Path.Circle({
8169
8647
  fillColor: 'blue',
8170
8648
  radius: view.bounds.height * 0.4,
@@ -8180,7 +8658,7 @@ path.tween(2000).onUpdate = function(event) {
8180
8658
  path.interpolate(pathFrom, pathTo, event.factor)
8181
8659
  };
8182
8660
  </script>
8183
- <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>
8184
8662
  </div>
8185
8663
 
8186
8664
 
@@ -8301,7 +8779,7 @@ path.tween(2000).onUpdate = function(event) {
8301
8779
  <div class="button run">Run</div>
8302
8780
  </div>
8303
8781
 
8304
- <script type="text/paperscript" canvas="canvas-58">
8782
+ <script type="text/paperscript" canvas="canvas-61">
8305
8783
  var path = new Path.Circle({
8306
8784
  fillColor: 'blue',
8307
8785
  radius: view.bounds.height * 0.4,
@@ -8309,7 +8787,7 @@ var path = new Path.Circle({
8309
8787
  });
8310
8788
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
8311
8789
  </script>
8312
- <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>
8313
8791
  </div>
8314
8792
 
8315
8793
 
@@ -8323,7 +8801,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
8323
8801
 
8324
8802
  <!-- =========================== copyright notice ========================== -->
8325
8803
  <p class="footer">
8326
- Paper.js v0.16.0<br>
8804
+ Paper.js v0.17.0<br>
8327
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>
8328
8806
  <div class="content-end"></div>
8329
8807