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
@@ -1270,6 +1270,91 @@ raster.on('load', function() {
1270
1270
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
1271
1271
 
1272
1272
 
1273
+ <div id="effects" class="member">
1274
+ <div class="member-link">
1275
+ <a name="effects" href="#effects"><tt><b>effects</b></tt></a>
1276
+ </div>
1277
+ <div class="member-description hidden">
1278
+
1279
+ <div class="member-text">
1280
+ <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,
1281
+ 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>
1282
+ <p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
1283
+ <ul>
1284
+ <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>
1285
+ <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>
1286
+ </ul>
1287
+
1288
+
1289
+
1290
+ <ul class="member-list">
1291
+ <h4>Type:</h4>
1292
+ <li>
1293
+ Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
1294
+ </li>
1295
+ </ul>
1296
+
1297
+
1298
+ <h4>Example:</h4>
1299
+
1300
+ <div class="paperscript split">
1301
+
1302
+ <div class="buttons">
1303
+ <div class="button run">Run</div>
1304
+ </div>
1305
+
1306
+ <script type="text/paperscript" canvas="canvas-7">
1307
+ var path = new Path.Star({
1308
+ center: view.center,
1309
+ points: 5,
1310
+ radius1: 20,
1311
+ radius2: 40,
1312
+ strokeColor: 'black',
1313
+ strokeWidth: 8
1314
+ });
1315
+ path.effects = [
1316
+ { type: 'offset', parameters: { distance: 10, join: 'round' } },
1317
+ { type: 'outline' }
1318
+ ];
1319
+ </script>
1320
+ <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
1321
+ </div>
1322
+
1323
+
1324
+ </div>
1325
+
1326
+ </div>
1327
+ </div>
1328
+
1329
+
1330
+ <div id="previewbounds-matrix" class="member">
1331
+ <div class="member-link">
1332
+ <a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
1333
+ </div>
1334
+ <div class="member-description hidden">
1335
+
1336
+ <div class="member-text">
1337
+ <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>
1338
+
1339
+ <p>Read only.</p>
1340
+
1341
+
1342
+
1343
+ <ul class="member-list">
1344
+ <h4>Type:</h4>
1345
+ <li>
1346
+ <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
1347
+ </li>
1348
+ </ul>
1349
+
1350
+
1351
+
1352
+ </div>
1353
+
1354
+ </div>
1355
+ </div>
1356
+
1357
+
1273
1358
  <div id="key" class="member">
1274
1359
  <div class="member-link">
1275
1360
  <a name="key" href="#key"><tt><b>key</b></tt></a>
@@ -1382,7 +1467,7 @@ raster.on('load', function() {
1382
1467
  <div class="button run">Run</div>
1383
1468
  </div>
1384
1469
 
1385
- <script type="text/paperscript" canvas="canvas-7">
1470
+ <script type="text/paperscript" canvas="canvas-8">
1386
1471
  var path = new Path.Circle({
1387
1472
  center: [80, 50],
1388
1473
  radius: 35
@@ -1397,7 +1482,7 @@ group.addChild(path);
1397
1482
  // The path can be accessed by name:
1398
1483
  group.children['example'].fillColor = 'red';
1399
1484
  </script>
1400
- <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
1485
+ <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
1401
1486
  </div>
1402
1487
 
1403
1488
 
@@ -1435,7 +1520,7 @@ group.children['example'].fillColor = 'red';
1435
1520
  <div class="button run">Run</div>
1436
1521
  </div>
1437
1522
 
1438
- <script type="text/paperscript" canvas="canvas-8">
1523
+ <script type="text/paperscript" canvas="canvas-9">
1439
1524
  var circle = new Path.Circle({
1440
1525
  center: [80, 50],
1441
1526
  radius: 30
@@ -1446,7 +1531,7 @@ circle.style = {
1446
1531
  strokeWidth: 5
1447
1532
  };
1448
1533
  </script>
1449
- <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
1534
+ <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
1450
1535
  </div>
1451
1536
 
1452
1537
 
@@ -1458,7 +1543,7 @@ circle.style = {
1458
1543
  <div class="button run">Run</div>
1459
1544
  </div>
1460
1545
 
1461
- <script type="text/paperscript" canvas="canvas-9">
1546
+ <script type="text/paperscript" canvas="canvas-10">
1462
1547
  var path = new Path.Circle({
1463
1548
  center: [50, 50],
1464
1549
  radius: 30,
@@ -1473,7 +1558,7 @@ var path2 = new Path.Circle({
1473
1558
  // Copy the path style of path:
1474
1559
  path2.style = path.style;
1475
1560
  </script>
1476
- <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
1561
+ <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
1477
1562
  </div>
1478
1563
 
1479
1564
 
@@ -1485,7 +1570,7 @@ path2.style = path.style;
1485
1570
  <div class="button run">Run</div>
1486
1571
  </div>
1487
1572
 
1488
- <script type="text/paperscript" canvas="canvas-10">
1573
+ <script type="text/paperscript" canvas="canvas-11">
1489
1574
  var myStyle = {
1490
1575
  fillColor: 'red',
1491
1576
  strokeColor: 'blue',
@@ -1504,7 +1589,7 @@ var path2 = new Path.Circle({
1504
1589
  });
1505
1590
  path2.style = myStyle;
1506
1591
  </script>
1507
- <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
1592
+ <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
1508
1593
  </div>
1509
1594
 
1510
1595
 
@@ -1546,7 +1631,7 @@ path2.style = myStyle;
1546
1631
  <div class="button run">Run</div>
1547
1632
  </div>
1548
1633
 
1549
- <script type="text/paperscript" canvas="canvas-11">
1634
+ <script type="text/paperscript" canvas="canvas-12">
1550
1635
  var unlockedItem = new Path.Circle({
1551
1636
  center: view.center - [35, 0],
1552
1637
  radius: 30,
@@ -1573,7 +1658,7 @@ new PointText({
1573
1658
  justification: 'center'
1574
1659
  });
1575
1660
  </script>
1576
- <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
1661
+ <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1577
1662
  </div>
1578
1663
 
1579
1664
 
@@ -1615,7 +1700,7 @@ new PointText({
1615
1700
  <div class="button run">Run</div>
1616
1701
  </div>
1617
1702
 
1618
- <script type="text/paperscript" canvas="canvas-12">
1703
+ <script type="text/paperscript" canvas="canvas-13">
1619
1704
  var path = new Path.Circle({
1620
1705
  center: [50, 50],
1621
1706
  radius: 20,
@@ -1625,7 +1710,7 @@ var path = new Path.Circle({
1625
1710
  // Hide the path:
1626
1711
  path.visible = false;
1627
1712
  </script>
1628
- <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1713
+ <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1629
1714
  </div>
1630
1715
 
1631
1716
 
@@ -1673,7 +1758,7 @@ path.visible = false;
1673
1758
  <div class="button run">Run</div>
1674
1759
  </div>
1675
1760
 
1676
- <script type="text/paperscript" canvas="canvas-13">
1761
+ <script type="text/paperscript" canvas="canvas-14">
1677
1762
  // Create a white rectangle in the background
1678
1763
  // with the same dimensions as the view:
1679
1764
  var background = new Path.Rectangle(view.bounds);
@@ -1694,7 +1779,7 @@ var circle2 = new Path.Circle({
1694
1779
  // Set the blend mode of circle2:
1695
1780
  circle2.blendMode = 'multiply';
1696
1781
  </script>
1697
- <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1782
+ <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1698
1783
  </div>
1699
1784
 
1700
1785
 
@@ -1736,7 +1821,7 @@ circle2.blendMode = 'multiply';
1736
1821
  <div class="button run">Run</div>
1737
1822
  </div>
1738
1823
 
1739
- <script type="text/paperscript" canvas="canvas-14">
1824
+ <script type="text/paperscript" canvas="canvas-15">
1740
1825
  var circle = new Path.Circle({
1741
1826
  center: [80, 50],
1742
1827
  radius: 35,
@@ -1754,7 +1839,7 @@ var circle2 = new Path.Circle({
1754
1839
  // Make circle2 50% transparent:
1755
1840
  circle2.opacity = 0.5;
1756
1841
  </script>
1757
- <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1842
+ <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1758
1843
  </div>
1759
1844
 
1760
1845
 
@@ -1877,14 +1962,14 @@ circle.textWrap = { offset: 10 };</code></pre>
1877
1962
  <div class="button run">Run</div>
1878
1963
  </div>
1879
1964
 
1880
- <script type="text/paperscript" canvas="canvas-15">
1965
+ <script type="text/paperscript" canvas="canvas-16">
1881
1966
  var path = new Path.Circle({
1882
1967
  center: [80, 50],
1883
1968
  radius: 35
1884
1969
  });
1885
1970
  path.selected = true; // Select the path
1886
1971
  </script>
1887
- <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1972
+ <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
1888
1973
  </div>
1889
1974
 
1890
1975
 
@@ -2041,7 +2126,7 @@ console.log(path.data.pets.length); // 1</code></pre>
2041
2126
  <div class="button run">Run</div>
2042
2127
  </div>
2043
2128
 
2044
- <script type="text/paperscript" canvas="canvas-16">
2129
+ <script type="text/paperscript" canvas="canvas-17">
2045
2130
  // Create a circle at position { x: 10, y: 10 }
2046
2131
  var circle = new Path.Circle({
2047
2132
  center: new Point(10, 10),
@@ -2055,7 +2140,7 @@ circle.position = new Point(20, 20);
2055
2140
  // Move the circle 100 points to the right and 50 points down
2056
2141
  circle.position += new Point(100, 50);
2057
2142
  </script>
2058
- <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
2143
+ <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
2059
2144
  </div>
2060
2145
 
2061
2146
 
@@ -2067,7 +2152,7 @@ circle.position += new Point(100, 50);
2067
2152
  <div class="button run">Run</div>
2068
2153
  </div>
2069
2154
 
2070
- <script type="text/paperscript" canvas="canvas-17">
2155
+ <script type="text/paperscript" canvas="canvas-18">
2071
2156
  // Create a circle at position { x: 20, y: 20 }
2072
2157
  var circle = new Path.Circle({
2073
2158
  center: new Point(20, 20),
@@ -2078,7 +2163,7 @@ var circle = new Path.Circle({
2078
2163
  // Move the circle 100 points to the right
2079
2164
  circle.position.x += 100;
2080
2165
  </script>
2081
- <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
2166
+ <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
2082
2167
  </div>
2083
2168
 
2084
2169
 
@@ -2604,7 +2689,7 @@ console.log(group.children[0] == path); // true</code></pre>
2604
2689
  <div class="button run">Run</div>
2605
2690
  </div>
2606
2691
 
2607
- <script type="text/paperscript" canvas="canvas-18">
2692
+ <script type="text/paperscript" canvas="canvas-19">
2608
2693
  var path = new Path.Circle({
2609
2694
  center: [80, 50],
2610
2695
  radius: 35
@@ -2617,7 +2702,7 @@ group.addChild(path);
2617
2702
  // Access the path through the group's children array:
2618
2703
  group.children[0].fillColor = 'red';
2619
2704
  </script>
2620
- <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
2705
+ <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
2621
2706
  </div>
2622
2707
 
2623
2708
 
@@ -2629,7 +2714,7 @@ group.children[0].fillColor = 'red';
2629
2714
  <div class="button run">Run</div>
2630
2715
  </div>
2631
2716
 
2632
- <script type="text/paperscript" canvas="canvas-19">
2717
+ <script type="text/paperscript" canvas="canvas-20">
2633
2718
  var path = new Path.Circle({
2634
2719
  center: [80, 50],
2635
2720
  radius: 35
@@ -2644,7 +2729,7 @@ group.addChild(path);
2644
2729
  // The path can be accessed by name:
2645
2730
  group.children['example'].fillColor = 'orange';
2646
2731
  </script>
2647
- <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
2732
+ <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
2648
2733
  </div>
2649
2734
 
2650
2735
 
@@ -2656,7 +2741,7 @@ group.children['example'].fillColor = 'orange';
2656
2741
  <div class="button run">Run</div>
2657
2742
  </div>
2658
2743
 
2659
- <script type="text/paperscript" canvas="canvas-20">
2744
+ <script type="text/paperscript" canvas="canvas-21">
2660
2745
  var path = new Path.Circle({
2661
2746
  center: [80, 50],
2662
2747
  radius: 35
@@ -2668,7 +2753,7 @@ group.children = [path];
2668
2753
  // The path is the first child of the group:
2669
2754
  group.firstChild.fillColor = 'green';
2670
2755
  </script>
2671
- <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
2756
+ <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2672
2757
  </div>
2673
2758
 
2674
2759
 
@@ -2845,7 +2930,7 @@ group.firstChild.fillColor = 'green';
2845
2930
  <div class="button run">Run</div>
2846
2931
  </div>
2847
2932
 
2848
- <script type="text/paperscript" canvas="canvas-21">
2933
+ <script type="text/paperscript" canvas="canvas-22">
2849
2934
  // Create a circle shaped path at { x: 80, y: 50 }
2850
2935
  // with a radius of 35:
2851
2936
  var circle = new Path.Circle({
@@ -2856,7 +2941,7 @@ var circle = new Path.Circle({
2856
2941
  // Set its stroke color to RGB red:
2857
2942
  circle.strokeColor = new Color(1, 0, 0);
2858
2943
  </script>
2859
- <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2944
+ <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2860
2945
  </div>
2861
2946
 
2862
2947
 
@@ -2893,7 +2978,7 @@ circle.strokeColor = new Color(1, 0, 0);
2893
2978
  <div class="button run">Run</div>
2894
2979
  </div>
2895
2980
 
2896
- <script type="text/paperscript" canvas="canvas-22">
2981
+ <script type="text/paperscript" canvas="canvas-23">
2897
2982
  // Create a circle shaped path at { x: 80, y: 50 }
2898
2983
  // with a radius of 35:
2899
2984
  var circle = new Path.Circle({
@@ -2905,7 +2990,7 @@ var circle = new Path.Circle({
2905
2990
  // Set its stroke width to 10:
2906
2991
  circle.strokeWidth = 10;
2907
2992
  </script>
2908
- <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2993
+ <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2909
2994
  </div>
2910
2995
 
2911
2996
 
@@ -2952,7 +3037,7 @@ circle.strokeWidth = 10;
2952
3037
  <div class="button run">Run</div>
2953
3038
  </div>
2954
3039
 
2955
- <script type="text/paperscript" canvas="canvas-23">
3040
+ <script type="text/paperscript" canvas="canvas-24">
2956
3041
  var line = new Path({
2957
3042
  segments: [[80, 50], [420, 50]],
2958
3043
  strokeColor: 'black',
@@ -2973,7 +3058,7 @@ var line2 = line.clone();
2973
3058
  line2.position.y += 100;
2974
3059
  line2.strokeCap = 'butt';
2975
3060
  </script>
2976
- <div class="canvas"><canvas width="516" height="200" id="canvas-23"></canvas></div>
3061
+ <div class="canvas"><canvas width="516" height="200" id="canvas-24"></canvas></div>
2977
3062
  </div>
2978
3063
 
2979
3064
 
@@ -3020,7 +3105,7 @@ line2.strokeCap = 'butt';
3020
3105
  <div class="button run">Run</div>
3021
3106
  </div>
3022
3107
 
3023
- <script type="text/paperscript" canvas="canvas-24">
3108
+ <script type="text/paperscript" canvas="canvas-25">
3024
3109
  var path = new Path({
3025
3110
  segments: [[80, 100], [120, 40], [160, 100]],
3026
3111
  strokeColor: 'black',
@@ -3037,7 +3122,7 @@ var path3 = path2.clone();
3037
3122
  path3.position.x += path3.bounds.width * 1.5;
3038
3123
  path3.strokeJoin = 'bevel';
3039
3124
  </script>
3040
- <div class="canvas"><canvas width="516" height="120" id="canvas-24"></canvas></div>
3125
+ <div class="canvas"><canvas width="516" height="120" id="canvas-25"></canvas></div>
3041
3126
  </div>
3042
3127
 
3043
3128
 
@@ -3141,7 +3226,7 @@ path3.strokeJoin = 'bevel';
3141
3226
  <div class="button run">Run</div>
3142
3227
  </div>
3143
3228
 
3144
- <script type="text/paperscript" canvas="canvas-25">
3229
+ <script type="text/paperscript" canvas="canvas-26">
3145
3230
  var path = new Path.Circle({
3146
3231
  center: [80, 50],
3147
3232
  radius: 40,
@@ -3152,7 +3237,7 @@ var path = new Path.Circle({
3152
3237
  // Set the dashed stroke to [10pt dash, 4pt gap]:
3153
3238
  path.dashArray = [10, 4];
3154
3239
  </script>
3155
- <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
3240
+ <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
3156
3241
  </div>
3157
3242
 
3158
3243
 
@@ -3258,7 +3343,7 @@ path.dashArray = [10, 4];
3258
3343
  <div class="button run">Run</div>
3259
3344
  </div>
3260
3345
 
3261
- <script type="text/paperscript" canvas="canvas-26">
3346
+ <script type="text/paperscript" canvas="canvas-27">
3262
3347
  // Create a circle shaped path at { x: 80, y: 50 }
3263
3348
  // with a radius of 35:
3264
3349
  var circle = new Path.Circle({
@@ -3269,7 +3354,7 @@ var circle = new Path.Circle({
3269
3354
  // Set the fill color of the circle to RGB red:
3270
3355
  circle.fillColor = new Color(1, 0, 0);
3271
3356
  </script>
3272
- <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
3357
+ <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
3273
3358
  </div>
3274
3359
 
3275
3360
 
@@ -3344,7 +3429,7 @@ circle.fillColor = new Color(1, 0, 0);
3344
3429
  <div class="button run">Run</div>
3345
3430
  </div>
3346
3431
 
3347
- <script type="text/paperscript" canvas="canvas-27">
3432
+ <script type="text/paperscript" canvas="canvas-28">
3348
3433
  var circle = new Path.Circle({
3349
3434
  center: [80, 50],
3350
3435
  radius: 35,
@@ -3357,7 +3442,7 @@ var circle = new Path.Circle({
3357
3442
  shadowOffset: new Point(5, 5)
3358
3443
  });
3359
3444
  </script>
3360
- <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
3445
+ <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
3361
3446
  </div>
3362
3447
 
3363
3448
 
@@ -3498,7 +3583,7 @@ var circle = new Path.Circle({
3498
3583
  <div class="button run">Run</div>
3499
3584
  </div>
3500
3585
 
3501
- <script type="text/paperscript" canvas="canvas-28">
3586
+ <script type="text/paperscript" canvas="canvas-29">
3502
3587
  // Create a rectangle shaped path with its top left point at:
3503
3588
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
3504
3589
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -3509,7 +3594,7 @@ path.onFrame = function(event) {
3509
3594
  this.rotate(3);
3510
3595
  }
3511
3596
  </script>
3512
- <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
3597
+ <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
3513
3598
  </div>
3514
3599
 
3515
3600
 
@@ -3553,7 +3638,7 @@ path.onFrame = function(event) {
3553
3638
  <div class="button run">Run</div>
3554
3639
  </div>
3555
3640
 
3556
- <script type="text/paperscript" canvas="canvas-29">
3641
+ <script type="text/paperscript" canvas="canvas-30">
3557
3642
  // Create a circle shaped path at the center of the view:
3558
3643
  var path = new Path.Circle({
3559
3644
  center: view.center,
@@ -3567,7 +3652,7 @@ path.onMouseDown = function(event) {
3567
3652
  this.fillColor = 'red';
3568
3653
  }
3569
3654
  </script>
3570
- <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
3655
+ <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
3571
3656
  </div>
3572
3657
 
3573
3658
 
@@ -3579,7 +3664,7 @@ path.onMouseDown = function(event) {
3579
3664
  <div class="button run">Run</div>
3580
3665
  </div>
3581
3666
 
3582
- <script type="text/paperscript" canvas="canvas-30">
3667
+ <script type="text/paperscript" canvas="canvas-31">
3583
3668
  // Loop 30 times:
3584
3669
  for (var i = 0; i < 30; i++) {
3585
3670
  // Create a circle shaped path at a random position
@@ -3597,7 +3682,7 @@ for (var i = 0; i < 30; i++) {
3597
3682
  }
3598
3683
  }
3599
3684
  </script>
3600
- <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
3685
+ <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
3601
3686
  </div>
3602
3687
 
3603
3688
 
@@ -3641,7 +3726,7 @@ for (var i = 0; i < 30; i++) {
3641
3726
  <div class="button run">Run</div>
3642
3727
  </div>
3643
3728
 
3644
- <script type="text/paperscript" canvas="canvas-31">
3729
+ <script type="text/paperscript" canvas="canvas-32">
3645
3730
  // Create a circle shaped path at the center of the view:
3646
3731
  var path = new Path.Circle({
3647
3732
  center: view.center,
@@ -3654,7 +3739,7 @@ path.onMouseDrag = function(event) {
3654
3739
  path.position += event.delta;
3655
3740
  }
3656
3741
  </script>
3657
- <div class="canvas"><canvas width="516" height="240" id="canvas-31"></canvas></div>
3742
+ <div class="canvas"><canvas width="516" height="240" id="canvas-32"></canvas></div>
3658
3743
  </div>
3659
3744
 
3660
3745
 
@@ -3698,7 +3783,7 @@ path.onMouseDrag = function(event) {
3698
3783
  <div class="button run">Run</div>
3699
3784
  </div>
3700
3785
 
3701
- <script type="text/paperscript" canvas="canvas-32">
3786
+ <script type="text/paperscript" canvas="canvas-33">
3702
3787
  // Create a circle shaped path at the center of the view:
3703
3788
  var path = new Path.Circle({
3704
3789
  center: view.center,
@@ -3712,7 +3797,7 @@ path.onMouseUp = function(event) {
3712
3797
  this.fillColor = 'red';
3713
3798
  }
3714
3799
  </script>
3715
- <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
3800
+ <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
3716
3801
  </div>
3717
3802
 
3718
3803
 
@@ -3756,7 +3841,7 @@ path.onMouseUp = function(event) {
3756
3841
  <div class="button run">Run</div>
3757
3842
  </div>
3758
3843
 
3759
- <script type="text/paperscript" canvas="canvas-33">
3844
+ <script type="text/paperscript" canvas="canvas-34">
3760
3845
  // Create a circle shaped path at the center of the view:
3761
3846
  var path = new Path.Circle({
3762
3847
  center: view.center,
@@ -3770,7 +3855,7 @@ path.onClick = function(event) {
3770
3855
  this.fillColor = 'red';
3771
3856
  }
3772
3857
  </script>
3773
- <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
3858
+ <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
3774
3859
  </div>
3775
3860
 
3776
3861
 
@@ -3782,7 +3867,7 @@ path.onClick = function(event) {
3782
3867
  <div class="button run">Run</div>
3783
3868
  </div>
3784
3869
 
3785
- <script type="text/paperscript" canvas="canvas-34">
3870
+ <script type="text/paperscript" canvas="canvas-35">
3786
3871
  // Loop 30 times:
3787
3872
  for (var i = 0; i < 30; i++) {
3788
3873
  // Create a circle shaped path at a random position
@@ -3800,7 +3885,7 @@ for (var i = 0; i < 30; i++) {
3800
3885
  }
3801
3886
  }
3802
3887
  </script>
3803
- <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
3888
+ <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3804
3889
  </div>
3805
3890
 
3806
3891
 
@@ -3844,7 +3929,7 @@ for (var i = 0; i < 30; i++) {
3844
3929
  <div class="button run">Run</div>
3845
3930
  </div>
3846
3931
 
3847
- <script type="text/paperscript" canvas="canvas-35">
3932
+ <script type="text/paperscript" canvas="canvas-36">
3848
3933
  // Create a circle shaped path at the center of the view:
3849
3934
  var path = new Path.Circle({
3850
3935
  center: view.center,
@@ -3858,7 +3943,7 @@ path.onDoubleClick = function(event) {
3858
3943
  this.fillColor = 'red';
3859
3944
  }
3860
3945
  </script>
3861
- <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3946
+ <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3862
3947
  </div>
3863
3948
 
3864
3949
 
@@ -3870,7 +3955,7 @@ path.onDoubleClick = function(event) {
3870
3955
  <div class="button run">Run</div>
3871
3956
  </div>
3872
3957
 
3873
- <script type="text/paperscript" canvas="canvas-36">
3958
+ <script type="text/paperscript" canvas="canvas-37">
3874
3959
  // Loop 30 times:
3875
3960
  for (var i = 0; i < 30; i++) {
3876
3961
  // Create a circle shaped path at a random position
@@ -3888,7 +3973,7 @@ for (var i = 0; i < 30; i++) {
3888
3973
  }
3889
3974
  }
3890
3975
  </script>
3891
- <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3976
+ <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3892
3977
  </div>
3893
3978
 
3894
3979
 
@@ -3932,7 +4017,7 @@ for (var i = 0; i < 30; i++) {
3932
4017
  <div class="button run">Run</div>
3933
4018
  </div>
3934
4019
 
3935
- <script type="text/paperscript" canvas="canvas-37">
4020
+ <script type="text/paperscript" canvas="canvas-38">
3936
4021
  // Create a circle shaped path at the center of the view:
3937
4022
  var path = new Path.Circle({
3938
4023
  center: view.center,
@@ -3940,180 +4025,567 @@ for (var i = 0; i < 30; i++) {
3940
4025
  fillColor: 'black'
3941
4026
  });
3942
4027
 
3943
- // When the mouse moves on top of the item, set its opacity
3944
- // to a random value between 0 and 1:
3945
- path.onMouseMove = function(event) {
3946
- this.opacity = Math.random();
3947
- }
3948
- </script>
3949
- <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3950
- </div>
4028
+ // When the mouse moves on top of the item, set its opacity
4029
+ // to a random value between 0 and 1:
4030
+ path.onMouseMove = function(event) {
4031
+ this.opacity = Math.random();
4032
+ }
4033
+ </script>
4034
+ <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
4035
+ </div>
4036
+
4037
+
4038
+ </div>
4039
+
4040
+ </div>
4041
+ </div>
4042
+
4043
+
4044
+ <div id="onmouseenter" class="member">
4045
+ <div class="member-link">
4046
+ <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
4047
+ </div>
4048
+ <div class="member-description hidden">
4049
+
4050
+ <div class="member-text">
4051
+ <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>
4052
+
4053
+
4054
+
4055
+ <ul class="member-list">
4056
+ <h4>Type:</h4>
4057
+ <li>
4058
+ <tt>Function</tt>⟋<tt>null</tt>
4059
+ </li>
4060
+ </ul>
4061
+
4062
+
4063
+ <ul class="member-list">
4064
+ <h4>See also:</h4>
4065
+
4066
+ <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
4067
+
4068
+ </ul>
4069
+
4070
+ <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>
4071
+
4072
+ <div class="paperscript split">
4073
+
4074
+ <div class="buttons">
4075
+ <div class="button run">Run</div>
4076
+ </div>
4077
+
4078
+ <script type="text/paperscript" canvas="canvas-39">
4079
+ // Create a circle shaped path at the center of the view:
4080
+ var path = new Path.Circle({
4081
+ center: view.center,
4082
+ radius: 25,
4083
+ fillColor: 'black'
4084
+ });
4085
+
4086
+ // When the mouse enters the item, set its fill color to red:
4087
+ path.onMouseEnter = function(event) {
4088
+ this.fillColor = 'red';
4089
+ }
4090
+
4091
+ // When the mouse leaves the item, set its fill color to black:
4092
+ path.onMouseLeave = function(event) {
4093
+ this.fillColor = 'black';
4094
+ }
4095
+ </script>
4096
+ <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
4097
+ </div>
4098
+
4099
+
4100
+ <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>
4101
+
4102
+ <div class="paperscript split">
4103
+
4104
+ <div class="buttons">
4105
+ <div class="button run">Run</div>
4106
+ </div>
4107
+
4108
+ <script type="text/paperscript" canvas="canvas-40">
4109
+ function enter(event) {
4110
+ this.fillColor = 'red';
4111
+ }
4112
+
4113
+ function leave(event) {
4114
+ this.fillColor = 'black';
4115
+ }
4116
+
4117
+ // When the mouse is pressed:
4118
+ function onMouseDown(event) {
4119
+ // Create a circle shaped path at the position of the mouse:
4120
+ var path = new Path.Circle(event.point, 25);
4121
+ path.fillColor = 'black';
4122
+
4123
+ // When the mouse enters the item, set its fill color to red:
4124
+ path.onMouseEnter = enter;
4125
+
4126
+ // When the mouse leaves the item, set its fill color to black:
4127
+ path.onMouseLeave = leave;
4128
+ }
4129
+ </script>
4130
+ <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
4131
+ </div>
4132
+
4133
+
4134
+ </div>
4135
+
4136
+ </div>
4137
+ </div>
4138
+
4139
+
4140
+ <div id="onmouseleave" class="member">
4141
+ <div class="member-link">
4142
+ <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
4143
+ </div>
4144
+ <div class="member-description hidden">
4145
+
4146
+ <div class="member-text">
4147
+ <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>
4148
+
4149
+
4150
+
4151
+ <ul class="member-list">
4152
+ <h4>Type:</h4>
4153
+ <li>
4154
+ <tt>Function</tt>⟋<tt>null</tt>
4155
+ </li>
4156
+ </ul>
4157
+
4158
+
4159
+ <ul class="member-list">
4160
+ <h4>See also:</h4>
4161
+
4162
+ <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
4163
+
4164
+ </ul>
4165
+
4166
+ <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>
4167
+
4168
+ <div class="paperscript split">
4169
+
4170
+ <div class="buttons">
4171
+ <div class="button run">Run</div>
4172
+ </div>
4173
+
4174
+ <script type="text/paperscript" canvas="canvas-41">
4175
+ // Create a circle shaped path at the center of the view:
4176
+ var path = new Path.Circle({
4177
+ center: view.center,
4178
+ radius: 25,
4179
+ fillColor: 'black'
4180
+ });
4181
+
4182
+ // When the mouse leaves the item, set its fill color to red:
4183
+ path.onMouseLeave = function(event) {
4184
+ this.fillColor = 'red';
4185
+ }
4186
+ </script>
4187
+ <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
4188
+ </div>
4189
+
4190
+
4191
+ </div>
4192
+
4193
+ </div>
4194
+ </div>
4195
+
4196
+
4197
+ <div id="ondraw" class="member">
4198
+ <div class="member-link">
4199
+ <a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
4200
+ </div>
4201
+ <div class="member-description hidden">
4202
+
4203
+ <div class="member-text">
4204
+ <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>
4205
+
4206
+
4207
+
4208
+ <ul class="member-list">
4209
+ <h4>Type:</h4>
4210
+ <li>
4211
+ <tt>Function</tt>⟋<tt>null</tt>
4212
+ </li>
4213
+ </ul>
4214
+ <ul class="member-list">
4215
+ <h4>Options:</h4>
4216
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the item that is drawn</li>
4217
+ <li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> &mdash; the canvas context, transformed into the item&rsquo;s coordinates</li>
4218
+ <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>
4219
+ <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>
4220
+ <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>()
4221
+ 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>
4222
+ </ul>
4223
+
4224
+ <h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
4225
+
4226
+ <div class="paperscript split">
4227
+
4228
+ <div class="buttons">
4229
+ <div class="button run">Run</div>
4230
+ </div>
4231
+
4232
+ <script type="text/paperscript" canvas="canvas-42">
4233
+ var path = new Path.Circle({
4234
+ center: view.center,
4235
+ radius: 25,
4236
+ fillColor: 'rgba(255, 0, 0, 0.5)'
4237
+ });
4238
+
4239
+ path.onDraw = function(event) {
4240
+ var ctx = event.context,
4241
+ center = this.position,
4242
+ scale = event.matrix.scaling.x;
4243
+ ctx.beginPath();
4244
+ ctx.moveTo(center.x - 40, center.y);
4245
+ ctx.lineTo(center.x + 40, center.y);
4246
+ ctx.moveTo(center.x, center.y - 40);
4247
+ ctx.lineTo(center.x, center.y + 40);
4248
+ ctx.lineWidth = 1 / scale;
4249
+ ctx.stroke();
4250
+ }
4251
+ </script>
4252
+ <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
4253
+ </div>
4254
+
4255
+
4256
+ </div>
4257
+
4258
+ </div>
4259
+ </div>
4260
+
4261
+
4262
+ <div id="ondrawselection" class="member">
4263
+ <div class="member-link">
4264
+ <a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
4265
+ </div>
4266
+ <div class="member-description hidden">
4267
+
4268
+ <div class="member-text">
4269
+ <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>
4270
+
4271
+
4272
+
4273
+ <ul class="member-list">
4274
+ <h4>Type:</h4>
4275
+ <li>
4276
+ <tt>Function</tt>⟋<tt>null</tt>
4277
+ </li>
4278
+ </ul>
4279
+ <ul class="member-list">
4280
+ <h4>Options:</h4>
4281
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the selected item</li>
4282
+ <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>
4283
+ <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>
4284
+ <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>
4285
+ <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>
4286
+ <li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> &mdash; the view drawn into
4287
+ What the handler draws isn&rsquo;t part of the item&rsquo;s hit testing, its bounds or its SVG export.</li>
4288
+ </ul>
4289
+
4290
+ <h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
4291
+
4292
+ <div class="paperscript split">
4293
+
4294
+ <div class="buttons">
4295
+ <div class="button run">Run</div>
4296
+ </div>
4297
+
4298
+ <script type="text/paperscript" canvas="canvas-43">
4299
+ var path = new Path.Star({
4300
+ center: view.center,
4301
+ points: 5,
4302
+ radius1: 20,
4303
+ radius2: 40,
4304
+ strokeColor: 'black',
4305
+ selected: true
4306
+ });
4307
+
4308
+ path.onDrawSelection = function(event) {
4309
+ var ctx = event.context;
4310
+ this.segments.forEach(function(segment) {
4311
+ var point = event.matrix.transform(segment.point);
4312
+ ctx.beginPath();
4313
+ ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
4314
+ ctx.fill();
4315
+ });
4316
+ return false;
4317
+ }
4318
+ </script>
4319
+ <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
4320
+ </div>
4321
+
4322
+
4323
+ </div>
4324
+
4325
+ </div>
4326
+ </div>
4327
+
4328
+ </div>
4329
+
4330
+
4331
+ <!-- =========================== inherited methods ========================= -->
4332
+ <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
4333
+
4334
+
4335
+ <div id="addeffect-effect" class="member">
4336
+ <div class="member-link">
4337
+ <a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
4338
+ </div>
4339
+ <div class="member-description hidden">
4340
+ <div class="member-text">
4341
+ <p>Adds an effect at the end of the item&rsquo;s effects.</p>
4342
+
4343
+
4344
+ <ul class="member-list">
4345
+ <h4>Parameters:</h4>
4346
+
4347
+ <li>
4348
+ <tt>effect:</tt>
4349
+ <tt>Object</tt>
4350
+ &mdash;&nbsp;the plain object describing the effect
4351
+
4352
+ </li>
4353
+
4354
+ </ul>
4355
+
4356
+
4357
+ <ul class="member-list">
4358
+ <h4>Returns:</h4>
4359
+
4360
+ <li>
4361
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the added instance
4362
+ </li>
4363
+
4364
+
4365
+ </ul>
4366
+
4367
+
4368
+
4369
+
4370
+
4371
+ </div>
4372
+ </div>
4373
+ </div>
4374
+
4375
+
4376
+ <div id="inserteffect-index-effect" class="member">
4377
+ <div class="member-link">
4378
+ <a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
4379
+ </div>
4380
+ <div class="member-description hidden">
4381
+ <div class="member-text">
4382
+ <p>Inserts an effect into the item&rsquo;s effects at the given index.</p>
4383
+
4384
+
4385
+ <ul class="member-list">
4386
+ <h4>Parameters:</h4>
4387
+
4388
+ <li>
4389
+ <tt>index:</tt>
4390
+ <tt>Number</tt>
4391
+ &mdash;&nbsp;the index at which to insert the effect
4392
+
4393
+ </li>
4394
+
4395
+ <li>
4396
+ <tt>effect:</tt>
4397
+ <tt>Object</tt>
4398
+ &mdash;&nbsp;the plain object describing the effect
4399
+
4400
+ </li>
4401
+
4402
+ </ul>
4403
+
4404
+
4405
+ <ul class="member-list">
4406
+ <h4>Returns:</h4>
4407
+
4408
+ <li>
4409
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted instance
4410
+ </li>
4411
+
4412
+
4413
+ </ul>
4414
+
4415
+
4416
+
4417
+
4418
+
4419
+ </div>
4420
+ </div>
4421
+ </div>
4422
+
4423
+
4424
+ <div id="inserteffects-index-effects" class="member">
4425
+ <div class="member-link">
4426
+ <a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
4427
+ </div>
4428
+ <div class="member-description hidden">
4429
+ <div class="member-text">
4430
+ <p>Inserts effects into the item&rsquo;s effects at the given index.</p>
4431
+
4432
+
4433
+ <ul class="member-list">
4434
+ <h4>Parameters:</h4>
4435
+
4436
+ <li>
4437
+ <tt>index:</tt>
4438
+ <tt>Number</tt>
4439
+ &mdash;&nbsp;the index at which to insert the effects
4440
+
4441
+ </li>
4442
+
4443
+ <li>
4444
+ <tt>effects:</tt>
4445
+ Array of <tt>Object</tt> objects
4446
+ &mdash;&nbsp;the plain objects describing the effects
4447
+
4448
+ </li>
4449
+
4450
+ </ul>
4451
+
4452
+
4453
+ <ul class="member-list">
4454
+ <h4>Returns:</h4>
4455
+
4456
+ <li>
4457
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the inserted instances
4458
+ </li>
4459
+
4460
+
4461
+ </ul>
3951
4462
 
3952
4463
 
3953
- </div>
3954
4464
 
4465
+
4466
+
4467
+ </div>
3955
4468
  </div>
3956
4469
  </div>
3957
4470
 
3958
4471
 
3959
- <div id="onmouseenter" class="member">
4472
+ <div id="removeeffect-index" class="member">
3960
4473
  <div class="member-link">
3961
- <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
4474
+ <a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
3962
4475
  </div>
3963
4476
  <div class="member-description hidden">
3964
-
3965
4477
  <div class="member-text">
3966
- <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>
4478
+ <p>Removes the effect at the given index from the item&rsquo;s effects.</p>
4479
+
3967
4480
 
4481
+ <ul class="member-list">
4482
+ <h4>Parameters:</h4>
3968
4483
 
4484
+ <li>
4485
+ <tt>index:</tt>
4486
+ <tt>Number</tt>
4487
+ &mdash;&nbsp;the index of the effect to remove
4488
+
4489
+ </li>
3969
4490
 
3970
- <ul class="member-list">
3971
- <h4>Type:</h4>
3972
- <li>
3973
- <tt>Function</tt>⟋<tt>null</tt>
3974
- </li>
3975
- </ul>
3976
-
4491
+ </ul>
4492
+
3977
4493
 
3978
4494
  <ul class="member-list">
3979
- <h4>See also:</h4>
4495
+ <h4>Returns:</h4>
3980
4496
 
3981
- <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
4497
+ <li>
4498
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the removed instance, or <code>null</code>
4499
+ </li>
4500
+
3982
4501
 
3983
4502
  </ul>
3984
4503
 
3985
- <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>
3986
4504
 
3987
- <div class="paperscript split">
3988
4505
 
3989
- <div class="buttons">
3990
- <div class="button run">Run</div>
4506
+
4507
+
3991
4508
  </div>
3992
-
3993
- <script type="text/paperscript" canvas="canvas-38">
3994
- // Create a circle shaped path at the center of the view:
3995
- var path = new Path.Circle({
3996
- center: view.center,
3997
- radius: 25,
3998
- fillColor: 'black'
3999
- });
4000
-
4001
- // When the mouse enters the item, set its fill color to red:
4002
- path.onMouseEnter = function(event) {
4003
- this.fillColor = 'red';
4004
- }
4005
-
4006
- // When the mouse leaves the item, set its fill color to black:
4007
- path.onMouseLeave = function(event) {
4008
- this.fillColor = 'black';
4009
- }
4010
- </script>
4011
- <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
4012
4509
  </div>
4013
-
4014
-
4015
- <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>
4016
-
4017
- <div class="paperscript split">
4018
-
4019
- <div class="buttons">
4020
- <div class="button run">Run</div>
4021
4510
  </div>
4022
4511
 
4023
- <script type="text/paperscript" canvas="canvas-39">
4024
- function enter(event) {
4025
- this.fillColor = 'red';
4026
- }
4027
-
4028
- function leave(event) {
4029
- this.fillColor = 'black';
4030
- }
4512
+
4513
+ <div id="removeeffects" class="member">
4514
+ <div class="member-link">
4515
+ <a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
4516
+ </div>
4517
+ <div class="member-description hidden">
4518
+ <div class="member-text">
4519
+ <p>Removes the effects from the start index to the end index from the item&rsquo;s effects, or all of them.</p>
4520
+
4521
+
4522
+ <ul class="member-list">
4523
+ <h4>Parameters:</h4>
4524
+
4525
+ <li>
4526
+ <tt>start:</tt>
4527
+ <tt>Number</tt>
4528
+ &mdash;&nbsp;the index of the first effect to remove
4529
+ &mdash;&nbsp;optional, default: <tt>0</tt>
4530
+ </li>
4531
+
4532
+ <li>
4533
+ <tt>end:</tt>
4534
+ <tt>Number</tt>
4535
+ &mdash;&nbsp;the index after the last one
4536
+ &mdash;&nbsp;optional, default: <tt>effects.length</tt>
4537
+ </li>
4538
+
4539
+ </ul>
4031
4540
 
4032
- // When the mouse is pressed:
4033
- function onMouseDown(event) {
4034
- // Create a circle shaped path at the position of the mouse:
4035
- var path = new Path.Circle(event.point, 25);
4036
- path.fillColor = 'black';
4541
+
4542
+ <ul class="member-list">
4543
+ <h4>Returns:</h4>
4544
+
4545
+ <li>
4546
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the removed instances
4547
+ </li>
4037
4548
 
4038
- // When the mouse enters the item, set its fill color to red:
4039
- path.onMouseEnter = enter;
4549
+
4550
+ </ul>
4040
4551
 
4041
- // When the mouse leaves the item, set its fill color to black:
4042
- path.onMouseLeave = leave;
4043
- }
4044
- </script>
4045
- <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
4046
- </div>
4047
4552
 
4048
4553
 
4554
+
4555
+
4049
4556
  </div>
4050
-
4051
4557
  </div>
4052
4558
  </div>
4053
4559
 
4054
4560
 
4055
- <div id="onmouseleave" class="member">
4561
+ <div id="geteffectoutput" class="member">
4056
4562
  <div class="member-link">
4057
- <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
4563
+ <a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
4058
4564
  </div>
4059
4565
  <div class="member-description hidden">
4060
-
4061
4566
  <div class="member-text">
4062
- <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>
4063
-
4064
-
4065
-
4066
- <ul class="member-list">
4067
- <h4>Type:</h4>
4068
- <li>
4069
- <tt>Function</tt>⟋<tt>null</tt>
4070
- </li>
4071
- </ul>
4567
+ <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>
4072
4568
 
4073
4569
 
4570
+
4074
4571
  <ul class="member-list">
4075
- <h4>See also:</h4>
4572
+ <h4>Returns:</h4>
4076
4573
 
4077
- <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
4574
+ <li>
4575
+ <tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt>&nbsp;&mdash;&nbsp;the output of the effects
4576
+ </li>
4577
+
4078
4578
 
4079
4579
  </ul>
4080
4580
 
4081
- <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>
4082
-
4083
- <div class="paperscript split">
4084
-
4085
- <div class="buttons">
4086
- <div class="button run">Run</div>
4087
- </div>
4088
-
4089
- <script type="text/paperscript" canvas="canvas-40">
4090
- // Create a circle shaped path at the center of the view:
4091
- var path = new Path.Circle({
4092
- center: view.center,
4093
- radius: 25,
4094
- fillColor: 'black'
4095
- });
4096
-
4097
- // When the mouse leaves the item, set its fill color to red:
4098
- path.onMouseLeave = function(event) {
4099
- this.fillColor = 'red';
4100
- }
4101
- </script>
4102
- <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
4103
- </div>
4104
-
4105
4581
 
4106
- </div>
4107
4582
 
4583
+
4584
+
4108
4585
  </div>
4109
4586
  </div>
4110
-
4111
4587
  </div>
4112
4588
 
4113
-
4114
- <!-- =========================== inherited methods ========================= -->
4115
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
4116
-
4117
4589
 
4118
4590
  <div id="set-props" class="member">
4119
4591
  <div class="member-link">
@@ -4158,7 +4630,7 @@ path.onMouseLeave = function(event) {
4158
4630
  <div class="button run">Run</div>
4159
4631
  </div>
4160
4632
 
4161
- <script type="text/paperscript" canvas="canvas-41">
4633
+ <script type="text/paperscript" canvas="canvas-44">
4162
4634
  var circle = new Path.Circle({
4163
4635
  center: [80, 50],
4164
4636
  radius: 35
@@ -4171,7 +4643,7 @@ circle.set({
4171
4643
  selected: true
4172
4644
  });
4173
4645
  </script>
4174
- <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
4646
+ <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
4175
4647
  </div>
4176
4648
 
4177
4649
 
@@ -4227,7 +4699,7 @@ circle.set({
4227
4699
  <div class="button run">Run</div>
4228
4700
  </div>
4229
4701
 
4230
- <script type="text/paperscript" canvas="canvas-42">
4702
+ <script type="text/paperscript" canvas="canvas-45">
4231
4703
  var circle = new Path.Circle({
4232
4704
  center: [50, 50],
4233
4705
  radius: 10,
@@ -4242,7 +4714,7 @@ for (var i = 0; i < 20; i++) {
4242
4714
  copy.position.x += i * copy.bounds.width;
4243
4715
  }
4244
4716
  </script>
4245
- <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
4717
+ <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
4246
4718
  </div>
4247
4719
 
4248
4720
 
@@ -4368,7 +4840,7 @@ for (var i = 0; i < 20; i++) {
4368
4840
  <div class="button run">Run</div>
4369
4841
  </div>
4370
4842
 
4371
- <script type="text/paperscript" canvas="canvas-43">
4843
+ <script type="text/paperscript" canvas="canvas-46">
4372
4844
  var circle = new Path.Circle({
4373
4845
  center: [50, 50],
4374
4846
  radius: 5,
@@ -4385,7 +4857,7 @@ raster.position.x += 100;
4385
4857
  circle.scale(5);
4386
4858
  raster.scale(5);
4387
4859
  </script>
4388
- <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
4860
+ <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
4389
4861
  </div>
4390
4862
 
4391
4863
 
@@ -4439,7 +4911,7 @@ raster.scale(5);
4439
4911
  <div class="button run">Run</div>
4440
4912
  </div>
4441
4913
 
4442
- <script type="text/paperscript" canvas="canvas-44">
4914
+ <script type="text/paperscript" canvas="canvas-47">
4443
4915
  var path = new Path.Star({
4444
4916
  center: [50, 50],
4445
4917
  points: 12,
@@ -4460,7 +4932,7 @@ function onMouseDown(event) {
4460
4932
  }
4461
4933
  }
4462
4934
  </script>
4463
- <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
4935
+ <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
4464
4936
  </div>
4465
4937
 
4466
4938
 
@@ -4978,11 +5450,17 @@ function onMouseDown(event) {
4978
5450
  </div>
4979
5451
  <div class="member-description hidden">
4980
5452
  <div class="member-text">
4981
- <p>Exports the item with its content and child items as an SVG DOM.</p>
5453
+ <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>
4982
5454
  <ul class="member-list">
4983
5455
  <h4>Options:</h4>
4984
- <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>
4985
- <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>
5456
+ <li>[options.bounds] {String|Rectangle} the bounds of the area to
5457
+ export, either as a string ({@values 'view', content'}), or a
5458
+ {@link Rectangle} object: `'view'` uses the view bounds,
5459
+ `'content'` uses the stroke bounds of the item</li>
5460
+ <li>[options.matrix] {Matrix} the matrix with which to transform the
5461
+ exported content: If `options.bounds` is set to `'view'`,
5462
+ `paper.view.matrix` is used, for all other settings of
5463
+ `options.bounds` the identity matrix is used.</li>
4986
5464
  <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>
4987
5465
  <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>
4988
5466
  <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>
@@ -6336,7 +6814,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
6336
6814
  <div class="button run">Run</div>
6337
6815
  </div>
6338
6816
 
6339
- <script type="text/paperscript" canvas="canvas-45">
6817
+ <script type="text/paperscript" canvas="canvas-48">
6340
6818
  // Create a rectangle shaped path with its top left
6341
6819
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
6342
6820
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -6345,7 +6823,7 @@ path.fillColor = 'black';
6345
6823
  // Rotate the path by 30 degrees:
6346
6824
  path.rotate(30);
6347
6825
  </script>
6348
- <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
6826
+ <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6349
6827
  </div>
6350
6828
 
6351
6829
 
@@ -6357,7 +6835,7 @@ path.rotate(30);
6357
6835
  <div class="button run">Run</div>
6358
6836
  </div>
6359
6837
 
6360
- <script type="text/paperscript" canvas="canvas-46">
6838
+ <script type="text/paperscript" canvas="canvas-49">
6361
6839
  // Create a rectangle shaped path with its top left
6362
6840
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
6363
6841
  var topLeft = new Point(175, 50);
@@ -6379,7 +6857,7 @@ function onFrame(event) {
6379
6857
  path.rotate(3, view.center);
6380
6858
  }
6381
6859
  </script>
6382
- <div class="canvas"><canvas width="516" height="200" id="canvas-46"></canvas></div>
6860
+ <div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
6383
6861
  </div>
6384
6862
 
6385
6863
 
@@ -6428,7 +6906,7 @@ function onFrame(event) {
6428
6906
  <div class="button run">Run</div>
6429
6907
  </div>
6430
6908
 
6431
- <script type="text/paperscript" canvas="canvas-47">
6909
+ <script type="text/paperscript" canvas="canvas-50">
6432
6910
  // Create a circle shaped path at { x: 80, y: 50 }
6433
6911
  // with a radius of 20:
6434
6912
  var circle = new Path.Circle({
@@ -6440,7 +6918,7 @@ var circle = new Path.Circle({
6440
6918
  // Scale the path by 150% from its center point
6441
6919
  circle.scale(1.5);
6442
6920
  </script>
6443
- <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
6921
+ <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
6444
6922
  </div>
6445
6923
 
6446
6924
 
@@ -6452,7 +6930,7 @@ circle.scale(1.5);
6452
6930
  <div class="button run">Run</div>
6453
6931
  </div>
6454
6932
 
6455
- <script type="text/paperscript" canvas="canvas-48">
6933
+ <script type="text/paperscript" canvas="canvas-51">
6456
6934
  // Create a circle shaped path at { x: 80, y: 50 }
6457
6935
  // with a radius of 20:
6458
6936
  var circle = new Path.Circle({
@@ -6464,7 +6942,7 @@ var circle = new Path.Circle({
6464
6942
  // Scale the path 150% from its bottom left corner
6465
6943
  circle.scale(1.5, circle.bounds.bottomLeft);
6466
6944
  </script>
6467
- <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6945
+ <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
6468
6946
  </div>
6469
6947
 
6470
6948
 
@@ -6520,7 +6998,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
6520
6998
  <div class="button run">Run</div>
6521
6999
  </div>
6522
7000
 
6523
- <script type="text/paperscript" canvas="canvas-49">
7001
+ <script type="text/paperscript" canvas="canvas-52">
6524
7002
  // Create a circle shaped path at { x: 100, y: 50 }
6525
7003
  // with a radius of 20:
6526
7004
  var circle = new Path.Circle({
@@ -6532,7 +7010,7 @@ var circle = new Path.Circle({
6532
7010
  // Scale the path horizontally by 300%
6533
7011
  circle.scale(3, 1);
6534
7012
  </script>
6535
- <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
7013
+ <div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
6536
7014
  </div>
6537
7015
 
6538
7016
 
@@ -6970,7 +7448,7 @@ circle.scale(3, 1);
6970
7448
  <div class="button run">Run</div>
6971
7449
  </div>
6972
7450
 
6973
- <script type="text/paperscript" canvas="canvas-50">
7451
+ <script type="text/paperscript" canvas="canvas-53">
6974
7452
  // Create a rectangle shaped path with its top left corner
6975
7453
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6976
7454
  var path = new Path.Rectangle({
@@ -6991,7 +7469,7 @@ var circlePath = new Path.Circle({
6991
7469
  // the rectangular path:
6992
7470
  circlePath.fitBounds(path.bounds);
6993
7471
  </script>
6994
- <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
7472
+ <div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
6995
7473
  </div>
6996
7474
 
6997
7475
 
@@ -7003,7 +7481,7 @@ circlePath.fitBounds(path.bounds);
7003
7481
  <div class="button run">Run</div>
7004
7482
  </div>
7005
7483
 
7006
- <script type="text/paperscript" canvas="canvas-51">
7484
+ <script type="text/paperscript" canvas="canvas-54">
7007
7485
  // Create a rectangle shaped path with its top left corner
7008
7486
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
7009
7487
  var path = new Path.Rectangle({
@@ -7024,7 +7502,7 @@ var circlePath = new Path.Circle({
7024
7502
  // the rectangular path:
7025
7503
  circlePath.fitBounds(path.bounds, 'cover');
7026
7504
  </script>
7027
- <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
7505
+ <div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
7028
7506
  </div>
7029
7507
 
7030
7508
 
@@ -7036,7 +7514,7 @@ circlePath.fitBounds(path.bounds, 'cover');
7036
7514
  <div class="button run">Run</div>
7037
7515
  </div>
7038
7516
 
7039
- <script type="text/paperscript" canvas="canvas-52">
7517
+ <script type="text/paperscript" canvas="canvas-55">
7040
7518
  var path = new Path.Circle({
7041
7519
  center: [80, 50],
7042
7520
  radius: 30,
@@ -7046,7 +7524,7 @@ var path = new Path.Circle({
7046
7524
  // Fit the path to the bounding rectangle of the view:
7047
7525
  path.fitBounds(view.bounds);
7048
7526
  </script>
7049
- <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
7527
+ <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
7050
7528
  </div>
7051
7529
 
7052
7530
 
@@ -7072,7 +7550,7 @@ path.fitBounds(view.bounds);
7072
7550
  <li>
7073
7551
  <tt>type:</tt>
7074
7552
  <tt>String</tt>
7075
- &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>
7553
+ &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>
7076
7554
 
7077
7555
  </li>
7078
7556
 
@@ -7107,7 +7585,7 @@ path.fitBounds(view.bounds);
7107
7585
  <div class="button run">Run</div>
7108
7586
  </div>
7109
7587
 
7110
- <script type="text/paperscript" canvas="canvas-53">
7588
+ <script type="text/paperscript" canvas="canvas-56">
7111
7589
  // Create a circle shaped path at the center of the view:
7112
7590
  var path = new Path.Circle({
7113
7591
  center: view.center,
@@ -7125,7 +7603,7 @@ path.on('mouseleave', function() {
7125
7603
  this.fillColor = 'black';
7126
7604
  });
7127
7605
  </script>
7128
- <div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
7606
+ <div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
7129
7607
  </div>
7130
7608
 
7131
7609
 
@@ -7149,7 +7627,7 @@ path.on('mouseleave', function() {
7149
7627
  <li>
7150
7628
  <tt>object:</tt>
7151
7629
  <tt>Object</tt>
7152
- &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>
7630
+ &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>
7153
7631
 
7154
7632
  </li>
7155
7633
 
@@ -7177,7 +7655,7 @@ path.on('mouseleave', function() {
7177
7655
  <div class="button run">Run</div>
7178
7656
  </div>
7179
7657
 
7180
- <script type="text/paperscript" canvas="canvas-54">
7658
+ <script type="text/paperscript" canvas="canvas-57">
7181
7659
  // Create a circle shaped path at the center of the view:
7182
7660
  var path = new Path.Circle({
7183
7661
  center: view.center,
@@ -7195,7 +7673,7 @@ path.on({
7195
7673
  }
7196
7674
  });
7197
7675
  </script>
7198
- <div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
7676
+ <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
7199
7677
  </div>
7200
7678
 
7201
7679
 
@@ -7207,7 +7685,7 @@ path.on({
7207
7685
  <div class="button run">Run</div>
7208
7686
  </div>
7209
7687
 
7210
- <script type="text/paperscript" canvas="canvas-55">
7688
+ <script type="text/paperscript" canvas="canvas-58">
7211
7689
  var pathHandlers = {
7212
7690
  mouseenter: function(event) {
7213
7691
  this.fillColor = 'red';
@@ -7230,7 +7708,7 @@ function onMouseDown(event) {
7230
7708
  path.on(pathHandlers);
7231
7709
  }
7232
7710
  </script>
7233
- <div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
7711
+ <div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
7234
7712
  </div>
7235
7713
 
7236
7714
 
@@ -7254,7 +7732,7 @@ function onMouseDown(event) {
7254
7732
  <li>
7255
7733
  <tt>type:</tt>
7256
7734
  <tt>String</tt>
7257
- &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>
7735
+ &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>
7258
7736
 
7259
7737
  </li>
7260
7738
 
@@ -7302,7 +7780,7 @@ function onMouseDown(event) {
7302
7780
  <li>
7303
7781
  <tt>object:</tt>
7304
7782
  <tt>Object</tt>
7305
- &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>
7783
+ &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>
7306
7784
 
7307
7785
  </li>
7308
7786
 
@@ -7343,7 +7821,7 @@ function onMouseDown(event) {
7343
7821
  <li>
7344
7822
  <tt>type:</tt>
7345
7823
  <tt>String</tt>
7346
- &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>
7824
+ &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>
7347
7825
 
7348
7826
  </li>
7349
7827
 
@@ -7391,7 +7869,7 @@ function onMouseDown(event) {
7391
7869
  <li>
7392
7870
  <tt>type:</tt>
7393
7871
  <tt>String</tt>
7394
- &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>
7872
+ &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>
7395
7873
 
7396
7874
  </li>
7397
7875
 
@@ -7458,7 +7936,7 @@ function onMouseDown(event) {
7458
7936
  <div class="button run">Run</div>
7459
7937
  </div>
7460
7938
 
7461
- <script type="text/paperscript" canvas="canvas-56">
7939
+ <script type="text/paperscript" canvas="canvas-59">
7462
7940
  function onMouseDrag(event) {
7463
7941
  // Create a circle shaped path at the mouse position,
7464
7942
  // with a radius of 10:
@@ -7475,7 +7953,7 @@ function onMouseDrag(event) {
7475
7953
  });
7476
7954
  }
7477
7955
  </script>
7478
- <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
7956
+ <div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
7479
7957
  </div>
7480
7958
 
7481
7959
 
@@ -7505,7 +7983,7 @@ function onMouseDrag(event) {
7505
7983
  <div class="button run">Run</div>
7506
7984
  </div>
7507
7985
 
7508
- <script type="text/paperscript" canvas="canvas-57">
7986
+ <script type="text/paperscript" canvas="canvas-60">
7509
7987
  function onMouseMove(event) {
7510
7988
  // Create a circle shaped path at the mouse position,
7511
7989
  // with a radius of 10:
@@ -7519,7 +7997,7 @@ function onMouseMove(event) {
7519
7997
  path.removeOnMove();
7520
7998
  }
7521
7999
  </script>
7522
- <div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
8000
+ <div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
7523
8001
  </div>
7524
8002
 
7525
8003
 
@@ -7549,7 +8027,7 @@ function onMouseMove(event) {
7549
8027
  <div class="button run">Run</div>
7550
8028
  </div>
7551
8029
 
7552
- <script type="text/paperscript" canvas="canvas-58">
8030
+ <script type="text/paperscript" canvas="canvas-61">
7553
8031
  function onMouseDown(event) {
7554
8032
  // Create a circle shaped path at the mouse position,
7555
8033
  // with a radius of 10:
@@ -7563,7 +8041,7 @@ function onMouseDown(event) {
7563
8041
  path.removeOnDown();
7564
8042
  }
7565
8043
  </script>
7566
- <div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
8044
+ <div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
7567
8045
  </div>
7568
8046
 
7569
8047
 
@@ -7593,7 +8071,7 @@ function onMouseDown(event) {
7593
8071
  <div class="button run">Run</div>
7594
8072
  </div>
7595
8073
 
7596
- <script type="text/paperscript" canvas="canvas-59">
8074
+ <script type="text/paperscript" canvas="canvas-62">
7597
8075
  function onMouseDrag(event) {
7598
8076
  // Create a circle shaped path at the mouse position,
7599
8077
  // with a radius of 10:
@@ -7607,7 +8085,7 @@ function onMouseDrag(event) {
7607
8085
  path.removeOnDrag();
7608
8086
  }
7609
8087
  </script>
7610
- <div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
8088
+ <div class="canvas"><canvas width="516" height="200" id="canvas-62"></canvas></div>
7611
8089
  </div>
7612
8090
 
7613
8091
 
@@ -7637,7 +8115,7 @@ function onMouseDrag(event) {
7637
8115
  <div class="button run">Run</div>
7638
8116
  </div>
7639
8117
 
7640
- <script type="text/paperscript" canvas="canvas-60">
8118
+ <script type="text/paperscript" canvas="canvas-63">
7641
8119
  function onMouseDown(event) {
7642
8120
  // Create a circle shaped path at the mouse position,
7643
8121
  // with a radius of 10:
@@ -7651,7 +8129,7 @@ function onMouseDown(event) {
7651
8129
  path.removeOnUp();
7652
8130
  }
7653
8131
  </script>
7654
- <div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
8132
+ <div class="canvas"><canvas width="516" height="200" id="canvas-63"></canvas></div>
7655
8133
  </div>
7656
8134
 
7657
8135
 
@@ -7724,7 +8202,7 @@ function onMouseDown(event) {
7724
8202
  <div class="button run">Run</div>
7725
8203
  </div>
7726
8204
 
7727
- <script type="text/paperscript" canvas="canvas-61">
8205
+ <script type="text/paperscript" canvas="canvas-64">
7728
8206
  var path = new Path.Circle({
7729
8207
  radius: view.bounds.height * 0.4,
7730
8208
  center: view.center
@@ -7735,7 +8213,7 @@ path.tween(
7735
8213
  3000
7736
8214
  );
7737
8215
  </script>
7738
- <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
8216
+ <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
7739
8217
  </div>
7740
8218
 
7741
8219
 
@@ -7747,7 +8225,7 @@ path.tween(
7747
8225
  <div class="button run">Run</div>
7748
8226
  </div>
7749
8227
 
7750
- <script type="text/paperscript" canvas="canvas-62">
8228
+ <script type="text/paperscript" canvas="canvas-65">
7751
8229
  var path = new Shape.Rectangle({
7752
8230
  fillColor: 'red',
7753
8231
  center: [50, view.center.y],
@@ -7762,7 +8240,7 @@ path.tween({
7762
8240
  duration: 2000
7763
8241
  });
7764
8242
  </script>
7765
- <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
8243
+ <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
7766
8244
  </div>
7767
8245
 
7768
8246
 
@@ -7828,7 +8306,7 @@ path.tween({
7828
8306
  <div class="button run">Run</div>
7829
8307
  </div>
7830
8308
 
7831
- <script type="text/paperscript" canvas="canvas-63">
8309
+ <script type="text/paperscript" canvas="canvas-66">
7832
8310
  var path = new Path.Rectangle({
7833
8311
  size: [100, 100],
7834
8312
  position: view.center,
@@ -7842,7 +8320,7 @@ path.tween({
7842
8320
  'segments[2].point.x': '-= 50'
7843
8321
  }, 3000);
7844
8322
  </script>
7845
- <div class="canvas"><canvas width="516" height="200" id="canvas-63"></canvas></div>
8323
+ <div class="canvas"><canvas width="516" height="200" id="canvas-66"></canvas></div>
7846
8324
  </div>
7847
8325
 
7848
8326
 
@@ -7901,7 +8379,7 @@ path.tween({
7901
8379
  <div class="button run">Run</div>
7902
8380
  </div>
7903
8381
 
7904
- <script type="text/paperscript" canvas="canvas-64">
8382
+ <script type="text/paperscript" canvas="canvas-67">
7905
8383
  var path = new Path.Circle({
7906
8384
  fillColor: 'blue',
7907
8385
  radius: view.bounds.height * 0.4,
@@ -7917,7 +8395,7 @@ path.tween(2000).onUpdate = function(event) {
7917
8395
  path.interpolate(pathFrom, pathTo, event.factor)
7918
8396
  };
7919
8397
  </script>
7920
- <div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
8398
+ <div class="canvas"><canvas width="516" height="100" id="canvas-67"></canvas></div>
7921
8399
  </div>
7922
8400
 
7923
8401
 
@@ -8038,7 +8516,7 @@ path.tween(2000).onUpdate = function(event) {
8038
8516
  <div class="button run">Run</div>
8039
8517
  </div>
8040
8518
 
8041
- <script type="text/paperscript" canvas="canvas-65">
8519
+ <script type="text/paperscript" canvas="canvas-68">
8042
8520
  var path = new Path.Circle({
8043
8521
  fillColor: 'blue',
8044
8522
  radius: view.bounds.height * 0.4,
@@ -8046,7 +8524,7 @@ var path = new Path.Circle({
8046
8524
  });
8047
8525
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
8048
8526
  </script>
8049
- <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
8527
+ <div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
8050
8528
  </div>
8051
8529
 
8052
8530
 
@@ -8060,7 +8538,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
8060
8538
 
8061
8539
  <!-- =========================== copyright notice ========================== -->
8062
8540
  <p class="footer">
8063
- Paper.js v0.16.0<br>
8541
+ Paper.js v0.17.0<br>
8064
8542
  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>
8065
8543
  <div class="content-end"></div>
8066
8544