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
@@ -37,6 +37,91 @@
37
37
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
38
38
 
39
39
 
40
+ <div id="effects" class="member">
41
+ <div class="member-link">
42
+ <a name="effects" href="#effects"><tt><b>effects</b></tt></a>
43
+ </div>
44
+ <div class="member-description hidden">
45
+
46
+ <div class="member-text">
47
+ <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,
48
+ 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>
49
+ <p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
50
+ <ul>
51
+ <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>
52
+ <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>
53
+ </ul>
54
+
55
+
56
+
57
+ <ul class="member-list">
58
+ <h4>Type:</h4>
59
+ <li>
60
+ Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
61
+ </li>
62
+ </ul>
63
+
64
+
65
+ <h4>Example:</h4>
66
+
67
+ <div class="paperscript split">
68
+
69
+ <div class="buttons">
70
+ <div class="button run">Run</div>
71
+ </div>
72
+
73
+ <script type="text/paperscript" canvas="canvas-0">
74
+ var path = new Path.Star({
75
+ center: view.center,
76
+ points: 5,
77
+ radius1: 20,
78
+ radius2: 40,
79
+ strokeColor: 'black',
80
+ strokeWidth: 8
81
+ });
82
+ path.effects = [
83
+ { type: 'offset', parameters: { distance: 10, join: 'round' } },
84
+ { type: 'outline' }
85
+ ];
86
+ </script>
87
+ <div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
88
+ </div>
89
+
90
+
91
+ </div>
92
+
93
+ </div>
94
+ </div>
95
+
96
+
97
+ <div id="previewbounds-matrix" class="member">
98
+ <div class="member-link">
99
+ <a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
100
+ </div>
101
+ <div class="member-description hidden">
102
+
103
+ <div class="member-text">
104
+ <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>
105
+
106
+ <p>Read only.</p>
107
+
108
+
109
+
110
+ <ul class="member-list">
111
+ <h4>Type:</h4>
112
+ <li>
113
+ <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
114
+ </li>
115
+ </ul>
116
+
117
+
118
+
119
+ </div>
120
+
121
+ </div>
122
+ </div>
123
+
124
+
40
125
  <div id="key" class="member">
41
126
  <div class="member-link">
42
127
  <a name="key" href="#key"><tt><b>key</b></tt></a>
@@ -149,7 +234,7 @@
149
234
  <div class="button run">Run</div>
150
235
  </div>
151
236
 
152
- <script type="text/paperscript" canvas="canvas-0">
237
+ <script type="text/paperscript" canvas="canvas-1">
153
238
  var path = new Path.Circle({
154
239
  center: [80, 50],
155
240
  radius: 35
@@ -164,7 +249,7 @@ group.addChild(path);
164
249
  // The path can be accessed by name:
165
250
  group.children['example'].fillColor = 'red';
166
251
  </script>
167
- <div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
252
+ <div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
168
253
  </div>
169
254
 
170
255
 
@@ -202,7 +287,7 @@ group.children['example'].fillColor = 'red';
202
287
  <div class="button run">Run</div>
203
288
  </div>
204
289
 
205
- <script type="text/paperscript" canvas="canvas-1">
290
+ <script type="text/paperscript" canvas="canvas-2">
206
291
  var circle = new Path.Circle({
207
292
  center: [80, 50],
208
293
  radius: 30
@@ -213,7 +298,7 @@ circle.style = {
213
298
  strokeWidth: 5
214
299
  };
215
300
  </script>
216
- <div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
301
+ <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
217
302
  </div>
218
303
 
219
304
 
@@ -225,7 +310,7 @@ circle.style = {
225
310
  <div class="button run">Run</div>
226
311
  </div>
227
312
 
228
- <script type="text/paperscript" canvas="canvas-2">
313
+ <script type="text/paperscript" canvas="canvas-3">
229
314
  var path = new Path.Circle({
230
315
  center: [50, 50],
231
316
  radius: 30,
@@ -240,7 +325,7 @@ var path2 = new Path.Circle({
240
325
  // Copy the path style of path:
241
326
  path2.style = path.style;
242
327
  </script>
243
- <div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
328
+ <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
244
329
  </div>
245
330
 
246
331
 
@@ -252,7 +337,7 @@ path2.style = path.style;
252
337
  <div class="button run">Run</div>
253
338
  </div>
254
339
 
255
- <script type="text/paperscript" canvas="canvas-3">
340
+ <script type="text/paperscript" canvas="canvas-4">
256
341
  var myStyle = {
257
342
  fillColor: 'red',
258
343
  strokeColor: 'blue',
@@ -271,7 +356,7 @@ var path2 = new Path.Circle({
271
356
  });
272
357
  path2.style = myStyle;
273
358
  </script>
274
- <div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
359
+ <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
275
360
  </div>
276
361
 
277
362
 
@@ -313,7 +398,7 @@ path2.style = myStyle;
313
398
  <div class="button run">Run</div>
314
399
  </div>
315
400
 
316
- <script type="text/paperscript" canvas="canvas-4">
401
+ <script type="text/paperscript" canvas="canvas-5">
317
402
  var unlockedItem = new Path.Circle({
318
403
  center: view.center - [35, 0],
319
404
  radius: 30,
@@ -340,7 +425,7 @@ new PointText({
340
425
  justification: 'center'
341
426
  });
342
427
  </script>
343
- <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
428
+ <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
344
429
  </div>
345
430
 
346
431
 
@@ -382,7 +467,7 @@ new PointText({
382
467
  <div class="button run">Run</div>
383
468
  </div>
384
469
 
385
- <script type="text/paperscript" canvas="canvas-5">
470
+ <script type="text/paperscript" canvas="canvas-6">
386
471
  var path = new Path.Circle({
387
472
  center: [50, 50],
388
473
  radius: 20,
@@ -392,7 +477,7 @@ var path = new Path.Circle({
392
477
  // Hide the path:
393
478
  path.visible = false;
394
479
  </script>
395
- <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
480
+ <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
396
481
  </div>
397
482
 
398
483
 
@@ -440,7 +525,7 @@ path.visible = false;
440
525
  <div class="button run">Run</div>
441
526
  </div>
442
527
 
443
- <script type="text/paperscript" canvas="canvas-6">
528
+ <script type="text/paperscript" canvas="canvas-7">
444
529
  // Create a white rectangle in the background
445
530
  // with the same dimensions as the view:
446
531
  var background = new Path.Rectangle(view.bounds);
@@ -461,7 +546,7 @@ var circle2 = new Path.Circle({
461
546
  // Set the blend mode of circle2:
462
547
  circle2.blendMode = 'multiply';
463
548
  </script>
464
- <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
549
+ <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
465
550
  </div>
466
551
 
467
552
 
@@ -503,7 +588,7 @@ circle2.blendMode = 'multiply';
503
588
  <div class="button run">Run</div>
504
589
  </div>
505
590
 
506
- <script type="text/paperscript" canvas="canvas-7">
591
+ <script type="text/paperscript" canvas="canvas-8">
507
592
  var circle = new Path.Circle({
508
593
  center: [80, 50],
509
594
  radius: 35,
@@ -521,7 +606,7 @@ var circle2 = new Path.Circle({
521
606
  // Make circle2 50% transparent:
522
607
  circle2.opacity = 0.5;
523
608
  </script>
524
- <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
609
+ <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
525
610
  </div>
526
611
 
527
612
 
@@ -644,14 +729,14 @@ circle.textWrap = { offset: 10 };</code></pre>
644
729
  <div class="button run">Run</div>
645
730
  </div>
646
731
 
647
- <script type="text/paperscript" canvas="canvas-8">
732
+ <script type="text/paperscript" canvas="canvas-9">
648
733
  var path = new Path.Circle({
649
734
  center: [80, 50],
650
735
  radius: 35
651
736
  });
652
737
  path.selected = true; // Select the path
653
738
  </script>
654
- <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
739
+ <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
655
740
  </div>
656
741
 
657
742
 
@@ -808,7 +893,7 @@ console.log(path.data.pets.length); // 1</code></pre>
808
893
  <div class="button run">Run</div>
809
894
  </div>
810
895
 
811
- <script type="text/paperscript" canvas="canvas-9">
896
+ <script type="text/paperscript" canvas="canvas-10">
812
897
  // Create a circle at position { x: 10, y: 10 }
813
898
  var circle = new Path.Circle({
814
899
  center: new Point(10, 10),
@@ -822,7 +907,7 @@ circle.position = new Point(20, 20);
822
907
  // Move the circle 100 points to the right and 50 points down
823
908
  circle.position += new Point(100, 50);
824
909
  </script>
825
- <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
910
+ <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
826
911
  </div>
827
912
 
828
913
 
@@ -834,7 +919,7 @@ circle.position += new Point(100, 50);
834
919
  <div class="button run">Run</div>
835
920
  </div>
836
921
 
837
- <script type="text/paperscript" canvas="canvas-10">
922
+ <script type="text/paperscript" canvas="canvas-11">
838
923
  // Create a circle at position { x: 20, y: 20 }
839
924
  var circle = new Path.Circle({
840
925
  center: new Point(20, 20),
@@ -845,7 +930,7 @@ var circle = new Path.Circle({
845
930
  // Move the circle 100 points to the right
846
931
  circle.position.x += 100;
847
932
  </script>
848
- <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
933
+ <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
849
934
  </div>
850
935
 
851
936
 
@@ -1371,7 +1456,7 @@ console.log(group.children[0] == path); // true</code></pre>
1371
1456
  <div class="button run">Run</div>
1372
1457
  </div>
1373
1458
 
1374
- <script type="text/paperscript" canvas="canvas-11">
1459
+ <script type="text/paperscript" canvas="canvas-12">
1375
1460
  var path = new Path.Circle({
1376
1461
  center: [80, 50],
1377
1462
  radius: 35
@@ -1384,7 +1469,7 @@ group.addChild(path);
1384
1469
  // Access the path through the group's children array:
1385
1470
  group.children[0].fillColor = 'red';
1386
1471
  </script>
1387
- <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
1472
+ <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1388
1473
  </div>
1389
1474
 
1390
1475
 
@@ -1396,7 +1481,7 @@ group.children[0].fillColor = 'red';
1396
1481
  <div class="button run">Run</div>
1397
1482
  </div>
1398
1483
 
1399
- <script type="text/paperscript" canvas="canvas-12">
1484
+ <script type="text/paperscript" canvas="canvas-13">
1400
1485
  var path = new Path.Circle({
1401
1486
  center: [80, 50],
1402
1487
  radius: 35
@@ -1411,7 +1496,7 @@ group.addChild(path);
1411
1496
  // The path can be accessed by name:
1412
1497
  group.children['example'].fillColor = 'orange';
1413
1498
  </script>
1414
- <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1499
+ <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1415
1500
  </div>
1416
1501
 
1417
1502
 
@@ -1423,7 +1508,7 @@ group.children['example'].fillColor = 'orange';
1423
1508
  <div class="button run">Run</div>
1424
1509
  </div>
1425
1510
 
1426
- <script type="text/paperscript" canvas="canvas-13">
1511
+ <script type="text/paperscript" canvas="canvas-14">
1427
1512
  var path = new Path.Circle({
1428
1513
  center: [80, 50],
1429
1514
  radius: 35
@@ -1435,7 +1520,7 @@ group.children = [path];
1435
1520
  // The path is the first child of the group:
1436
1521
  group.firstChild.fillColor = 'green';
1437
1522
  </script>
1438
- <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1523
+ <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1439
1524
  </div>
1440
1525
 
1441
1526
 
@@ -1612,7 +1697,7 @@ group.firstChild.fillColor = 'green';
1612
1697
  <div class="button run">Run</div>
1613
1698
  </div>
1614
1699
 
1615
- <script type="text/paperscript" canvas="canvas-14">
1700
+ <script type="text/paperscript" canvas="canvas-15">
1616
1701
  // Create a circle shaped path at { x: 80, y: 50 }
1617
1702
  // with a radius of 35:
1618
1703
  var circle = new Path.Circle({
@@ -1623,7 +1708,7 @@ var circle = new Path.Circle({
1623
1708
  // Set its stroke color to RGB red:
1624
1709
  circle.strokeColor = new Color(1, 0, 0);
1625
1710
  </script>
1626
- <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1711
+ <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1627
1712
  </div>
1628
1713
 
1629
1714
 
@@ -1660,7 +1745,7 @@ circle.strokeColor = new Color(1, 0, 0);
1660
1745
  <div class="button run">Run</div>
1661
1746
  </div>
1662
1747
 
1663
- <script type="text/paperscript" canvas="canvas-15">
1748
+ <script type="text/paperscript" canvas="canvas-16">
1664
1749
  // Create a circle shaped path at { x: 80, y: 50 }
1665
1750
  // with a radius of 35:
1666
1751
  var circle = new Path.Circle({
@@ -1672,7 +1757,7 @@ var circle = new Path.Circle({
1672
1757
  // Set its stroke width to 10:
1673
1758
  circle.strokeWidth = 10;
1674
1759
  </script>
1675
- <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1760
+ <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
1676
1761
  </div>
1677
1762
 
1678
1763
 
@@ -1719,7 +1804,7 @@ circle.strokeWidth = 10;
1719
1804
  <div class="button run">Run</div>
1720
1805
  </div>
1721
1806
 
1722
- <script type="text/paperscript" canvas="canvas-16">
1807
+ <script type="text/paperscript" canvas="canvas-17">
1723
1808
  var line = new Path({
1724
1809
  segments: [[80, 50], [420, 50]],
1725
1810
  strokeColor: 'black',
@@ -1740,7 +1825,7 @@ var line2 = line.clone();
1740
1825
  line2.position.y += 100;
1741
1826
  line2.strokeCap = 'butt';
1742
1827
  </script>
1743
- <div class="canvas"><canvas width="516" height="200" id="canvas-16"></canvas></div>
1828
+ <div class="canvas"><canvas width="516" height="200" id="canvas-17"></canvas></div>
1744
1829
  </div>
1745
1830
 
1746
1831
 
@@ -1787,7 +1872,7 @@ line2.strokeCap = 'butt';
1787
1872
  <div class="button run">Run</div>
1788
1873
  </div>
1789
1874
 
1790
- <script type="text/paperscript" canvas="canvas-17">
1875
+ <script type="text/paperscript" canvas="canvas-18">
1791
1876
  var path = new Path({
1792
1877
  segments: [[80, 100], [120, 40], [160, 100]],
1793
1878
  strokeColor: 'black',
@@ -1804,7 +1889,7 @@ var path3 = path2.clone();
1804
1889
  path3.position.x += path3.bounds.width * 1.5;
1805
1890
  path3.strokeJoin = 'bevel';
1806
1891
  </script>
1807
- <div class="canvas"><canvas width="516" height="120" id="canvas-17"></canvas></div>
1892
+ <div class="canvas"><canvas width="516" height="120" id="canvas-18"></canvas></div>
1808
1893
  </div>
1809
1894
 
1810
1895
 
@@ -1908,7 +1993,7 @@ path3.strokeJoin = 'bevel';
1908
1993
  <div class="button run">Run</div>
1909
1994
  </div>
1910
1995
 
1911
- <script type="text/paperscript" canvas="canvas-18">
1996
+ <script type="text/paperscript" canvas="canvas-19">
1912
1997
  var path = new Path.Circle({
1913
1998
  center: [80, 50],
1914
1999
  radius: 40,
@@ -1919,7 +2004,7 @@ var path = new Path.Circle({
1919
2004
  // Set the dashed stroke to [10pt dash, 4pt gap]:
1920
2005
  path.dashArray = [10, 4];
1921
2006
  </script>
1922
- <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
2007
+ <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
1923
2008
  </div>
1924
2009
 
1925
2010
 
@@ -2025,7 +2110,7 @@ path.dashArray = [10, 4];
2025
2110
  <div class="button run">Run</div>
2026
2111
  </div>
2027
2112
 
2028
- <script type="text/paperscript" canvas="canvas-19">
2113
+ <script type="text/paperscript" canvas="canvas-20">
2029
2114
  // Create a circle shaped path at { x: 80, y: 50 }
2030
2115
  // with a radius of 35:
2031
2116
  var circle = new Path.Circle({
@@ -2036,7 +2121,7 @@ var circle = new Path.Circle({
2036
2121
  // Set the fill color of the circle to RGB red:
2037
2122
  circle.fillColor = new Color(1, 0, 0);
2038
2123
  </script>
2039
- <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
2124
+ <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
2040
2125
  </div>
2041
2126
 
2042
2127
 
@@ -2111,7 +2196,7 @@ circle.fillColor = new Color(1, 0, 0);
2111
2196
  <div class="button run">Run</div>
2112
2197
  </div>
2113
2198
 
2114
- <script type="text/paperscript" canvas="canvas-20">
2199
+ <script type="text/paperscript" canvas="canvas-21">
2115
2200
  var circle = new Path.Circle({
2116
2201
  center: [80, 50],
2117
2202
  radius: 35,
@@ -2124,7 +2209,7 @@ var circle = new Path.Circle({
2124
2209
  shadowOffset: new Point(5, 5)
2125
2210
  });
2126
2211
  </script>
2127
- <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
2212
+ <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2128
2213
  </div>
2129
2214
 
2130
2215
 
@@ -2265,7 +2350,7 @@ var circle = new Path.Circle({
2265
2350
  <div class="button run">Run</div>
2266
2351
  </div>
2267
2352
 
2268
- <script type="text/paperscript" canvas="canvas-21">
2353
+ <script type="text/paperscript" canvas="canvas-22">
2269
2354
  // Create a rectangle shaped path with its top left point at:
2270
2355
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
2271
2356
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -2276,7 +2361,7 @@ path.onFrame = function(event) {
2276
2361
  this.rotate(3);
2277
2362
  }
2278
2363
  </script>
2279
- <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
2364
+ <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2280
2365
  </div>
2281
2366
 
2282
2367
 
@@ -2320,7 +2405,7 @@ path.onFrame = function(event) {
2320
2405
  <div class="button run">Run</div>
2321
2406
  </div>
2322
2407
 
2323
- <script type="text/paperscript" canvas="canvas-22">
2408
+ <script type="text/paperscript" canvas="canvas-23">
2324
2409
  // Create a circle shaped path at the center of the view:
2325
2410
  var path = new Path.Circle({
2326
2411
  center: view.center,
@@ -2334,7 +2419,7 @@ path.onMouseDown = function(event) {
2334
2419
  this.fillColor = 'red';
2335
2420
  }
2336
2421
  </script>
2337
- <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2422
+ <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2338
2423
  </div>
2339
2424
 
2340
2425
 
@@ -2346,7 +2431,7 @@ path.onMouseDown = function(event) {
2346
2431
  <div class="button run">Run</div>
2347
2432
  </div>
2348
2433
 
2349
- <script type="text/paperscript" canvas="canvas-23">
2434
+ <script type="text/paperscript" canvas="canvas-24">
2350
2435
  // Loop 30 times:
2351
2436
  for (var i = 0; i < 30; i++) {
2352
2437
  // Create a circle shaped path at a random position
@@ -2364,7 +2449,7 @@ for (var i = 0; i < 30; i++) {
2364
2449
  }
2365
2450
  }
2366
2451
  </script>
2367
- <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2452
+ <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
2368
2453
  </div>
2369
2454
 
2370
2455
 
@@ -2408,7 +2493,7 @@ for (var i = 0; i < 30; i++) {
2408
2493
  <div class="button run">Run</div>
2409
2494
  </div>
2410
2495
 
2411
- <script type="text/paperscript" canvas="canvas-24">
2496
+ <script type="text/paperscript" canvas="canvas-25">
2412
2497
  // Create a circle shaped path at the center of the view:
2413
2498
  var path = new Path.Circle({
2414
2499
  center: view.center,
@@ -2421,7 +2506,7 @@ path.onMouseDrag = function(event) {
2421
2506
  path.position += event.delta;
2422
2507
  }
2423
2508
  </script>
2424
- <div class="canvas"><canvas width="516" height="240" id="canvas-24"></canvas></div>
2509
+ <div class="canvas"><canvas width="516" height="240" id="canvas-25"></canvas></div>
2425
2510
  </div>
2426
2511
 
2427
2512
 
@@ -2465,7 +2550,7 @@ path.onMouseDrag = function(event) {
2465
2550
  <div class="button run">Run</div>
2466
2551
  </div>
2467
2552
 
2468
- <script type="text/paperscript" canvas="canvas-25">
2553
+ <script type="text/paperscript" canvas="canvas-26">
2469
2554
  // Create a circle shaped path at the center of the view:
2470
2555
  var path = new Path.Circle({
2471
2556
  center: view.center,
@@ -2479,7 +2564,7 @@ path.onMouseUp = function(event) {
2479
2564
  this.fillColor = 'red';
2480
2565
  }
2481
2566
  </script>
2482
- <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
2567
+ <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
2483
2568
  </div>
2484
2569
 
2485
2570
 
@@ -2523,7 +2608,7 @@ path.onMouseUp = function(event) {
2523
2608
  <div class="button run">Run</div>
2524
2609
  </div>
2525
2610
 
2526
- <script type="text/paperscript" canvas="canvas-26">
2611
+ <script type="text/paperscript" canvas="canvas-27">
2527
2612
  // Create a circle shaped path at the center of the view:
2528
2613
  var path = new Path.Circle({
2529
2614
  center: view.center,
@@ -2537,7 +2622,7 @@ path.onClick = function(event) {
2537
2622
  this.fillColor = 'red';
2538
2623
  }
2539
2624
  </script>
2540
- <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
2625
+ <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
2541
2626
  </div>
2542
2627
 
2543
2628
 
@@ -2549,7 +2634,7 @@ path.onClick = function(event) {
2549
2634
  <div class="button run">Run</div>
2550
2635
  </div>
2551
2636
 
2552
- <script type="text/paperscript" canvas="canvas-27">
2637
+ <script type="text/paperscript" canvas="canvas-28">
2553
2638
  // Loop 30 times:
2554
2639
  for (var i = 0; i < 30; i++) {
2555
2640
  // Create a circle shaped path at a random position
@@ -2567,7 +2652,7 @@ for (var i = 0; i < 30; i++) {
2567
2652
  }
2568
2653
  }
2569
2654
  </script>
2570
- <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
2655
+ <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
2571
2656
  </div>
2572
2657
 
2573
2658
 
@@ -2611,7 +2696,7 @@ for (var i = 0; i < 30; i++) {
2611
2696
  <div class="button run">Run</div>
2612
2697
  </div>
2613
2698
 
2614
- <script type="text/paperscript" canvas="canvas-28">
2699
+ <script type="text/paperscript" canvas="canvas-29">
2615
2700
  // Create a circle shaped path at the center of the view:
2616
2701
  var path = new Path.Circle({
2617
2702
  center: view.center,
@@ -2625,7 +2710,7 @@ path.onDoubleClick = function(event) {
2625
2710
  this.fillColor = 'red';
2626
2711
  }
2627
2712
  </script>
2628
- <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
2713
+ <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
2629
2714
  </div>
2630
2715
 
2631
2716
 
@@ -2637,7 +2722,7 @@ path.onDoubleClick = function(event) {
2637
2722
  <div class="button run">Run</div>
2638
2723
  </div>
2639
2724
 
2640
- <script type="text/paperscript" canvas="canvas-29">
2725
+ <script type="text/paperscript" canvas="canvas-30">
2641
2726
  // Loop 30 times:
2642
2727
  for (var i = 0; i < 30; i++) {
2643
2728
  // Create a circle shaped path at a random position
@@ -2655,7 +2740,7 @@ for (var i = 0; i < 30; i++) {
2655
2740
  }
2656
2741
  }
2657
2742
  </script>
2658
- <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
2743
+ <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
2659
2744
  </div>
2660
2745
 
2661
2746
 
@@ -2699,7 +2784,7 @@ for (var i = 0; i < 30; i++) {
2699
2784
  <div class="button run">Run</div>
2700
2785
  </div>
2701
2786
 
2702
- <script type="text/paperscript" canvas="canvas-30">
2787
+ <script type="text/paperscript" canvas="canvas-31">
2703
2788
  // Create a circle shaped path at the center of the view:
2704
2789
  var path = new Path.Circle({
2705
2790
  center: view.center,
@@ -2707,180 +2792,567 @@ for (var i = 0; i < 30; i++) {
2707
2792
  fillColor: 'black'
2708
2793
  });
2709
2794
 
2710
- // When the mouse moves on top of the item, set its opacity
2711
- // to a random value between 0 and 1:
2712
- path.onMouseMove = function(event) {
2713
- this.opacity = Math.random();
2714
- }
2715
- </script>
2716
- <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
2717
- </div>
2795
+ // When the mouse moves on top of the item, set its opacity
2796
+ // to a random value between 0 and 1:
2797
+ path.onMouseMove = function(event) {
2798
+ this.opacity = Math.random();
2799
+ }
2800
+ </script>
2801
+ <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
2802
+ </div>
2803
+
2804
+
2805
+ </div>
2806
+
2807
+ </div>
2808
+ </div>
2809
+
2810
+
2811
+ <div id="onmouseenter" class="member">
2812
+ <div class="member-link">
2813
+ <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
2814
+ </div>
2815
+ <div class="member-description hidden">
2816
+
2817
+ <div class="member-text">
2818
+ <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>
2819
+
2820
+
2821
+
2822
+ <ul class="member-list">
2823
+ <h4>Type:</h4>
2824
+ <li>
2825
+ <tt>Function</tt>⟋<tt>null</tt>
2826
+ </li>
2827
+ </ul>
2828
+
2829
+
2830
+ <ul class="member-list">
2831
+ <h4>See also:</h4>
2832
+
2833
+ <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
2834
+
2835
+ </ul>
2836
+
2837
+ <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>
2838
+
2839
+ <div class="paperscript split">
2840
+
2841
+ <div class="buttons">
2842
+ <div class="button run">Run</div>
2843
+ </div>
2844
+
2845
+ <script type="text/paperscript" canvas="canvas-32">
2846
+ // Create a circle shaped path at the center of the view:
2847
+ var path = new Path.Circle({
2848
+ center: view.center,
2849
+ radius: 25,
2850
+ fillColor: 'black'
2851
+ });
2852
+
2853
+ // When the mouse enters the item, set its fill color to red:
2854
+ path.onMouseEnter = function(event) {
2855
+ this.fillColor = 'red';
2856
+ }
2857
+
2858
+ // When the mouse leaves the item, set its fill color to black:
2859
+ path.onMouseLeave = function(event) {
2860
+ this.fillColor = 'black';
2861
+ }
2862
+ </script>
2863
+ <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
2864
+ </div>
2865
+
2866
+
2867
+ <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>
2868
+
2869
+ <div class="paperscript split">
2870
+
2871
+ <div class="buttons">
2872
+ <div class="button run">Run</div>
2873
+ </div>
2874
+
2875
+ <script type="text/paperscript" canvas="canvas-33">
2876
+ function enter(event) {
2877
+ this.fillColor = 'red';
2878
+ }
2879
+
2880
+ function leave(event) {
2881
+ this.fillColor = 'black';
2882
+ }
2883
+
2884
+ // When the mouse is pressed:
2885
+ function onMouseDown(event) {
2886
+ // Create a circle shaped path at the position of the mouse:
2887
+ var path = new Path.Circle(event.point, 25);
2888
+ path.fillColor = 'black';
2889
+
2890
+ // When the mouse enters the item, set its fill color to red:
2891
+ path.onMouseEnter = enter;
2892
+
2893
+ // When the mouse leaves the item, set its fill color to black:
2894
+ path.onMouseLeave = leave;
2895
+ }
2896
+ </script>
2897
+ <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
2898
+ </div>
2899
+
2900
+
2901
+ </div>
2902
+
2903
+ </div>
2904
+ </div>
2905
+
2906
+
2907
+ <div id="onmouseleave" class="member">
2908
+ <div class="member-link">
2909
+ <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
2910
+ </div>
2911
+ <div class="member-description hidden">
2912
+
2913
+ <div class="member-text">
2914
+ <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>
2915
+
2916
+
2917
+
2918
+ <ul class="member-list">
2919
+ <h4>Type:</h4>
2920
+ <li>
2921
+ <tt>Function</tt>⟋<tt>null</tt>
2922
+ </li>
2923
+ </ul>
2924
+
2925
+
2926
+ <ul class="member-list">
2927
+ <h4>See also:</h4>
2928
+
2929
+ <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
2930
+
2931
+ </ul>
2932
+
2933
+ <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>
2934
+
2935
+ <div class="paperscript split">
2936
+
2937
+ <div class="buttons">
2938
+ <div class="button run">Run</div>
2939
+ </div>
2940
+
2941
+ <script type="text/paperscript" canvas="canvas-34">
2942
+ // Create a circle shaped path at the center of the view:
2943
+ var path = new Path.Circle({
2944
+ center: view.center,
2945
+ radius: 25,
2946
+ fillColor: 'black'
2947
+ });
2948
+
2949
+ // When the mouse leaves the item, set its fill color to red:
2950
+ path.onMouseLeave = function(event) {
2951
+ this.fillColor = 'red';
2952
+ }
2953
+ </script>
2954
+ <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
2955
+ </div>
2956
+
2957
+
2958
+ </div>
2959
+
2960
+ </div>
2961
+ </div>
2962
+
2963
+
2964
+ <div id="ondraw" class="member">
2965
+ <div class="member-link">
2966
+ <a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
2967
+ </div>
2968
+ <div class="member-description hidden">
2969
+
2970
+ <div class="member-text">
2971
+ <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>
2972
+
2973
+
2974
+
2975
+ <ul class="member-list">
2976
+ <h4>Type:</h4>
2977
+ <li>
2978
+ <tt>Function</tt>⟋<tt>null</tt>
2979
+ </li>
2980
+ </ul>
2981
+ <ul class="member-list">
2982
+ <h4>Options:</h4>
2983
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the item that is drawn</li>
2984
+ <li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> &mdash; the canvas context, transformed into the item&rsquo;s coordinates</li>
2985
+ <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>
2986
+ <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>
2987
+ <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>()
2988
+ 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>
2989
+ </ul>
2990
+
2991
+ <h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
2992
+
2993
+ <div class="paperscript split">
2994
+
2995
+ <div class="buttons">
2996
+ <div class="button run">Run</div>
2997
+ </div>
2998
+
2999
+ <script type="text/paperscript" canvas="canvas-35">
3000
+ var path = new Path.Circle({
3001
+ center: view.center,
3002
+ radius: 25,
3003
+ fillColor: 'rgba(255, 0, 0, 0.5)'
3004
+ });
3005
+
3006
+ path.onDraw = function(event) {
3007
+ var ctx = event.context,
3008
+ center = this.position,
3009
+ scale = event.matrix.scaling.x;
3010
+ ctx.beginPath();
3011
+ ctx.moveTo(center.x - 40, center.y);
3012
+ ctx.lineTo(center.x + 40, center.y);
3013
+ ctx.moveTo(center.x, center.y - 40);
3014
+ ctx.lineTo(center.x, center.y + 40);
3015
+ ctx.lineWidth = 1 / scale;
3016
+ ctx.stroke();
3017
+ }
3018
+ </script>
3019
+ <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3020
+ </div>
3021
+
3022
+
3023
+ </div>
3024
+
3025
+ </div>
3026
+ </div>
3027
+
3028
+
3029
+ <div id="ondrawselection" class="member">
3030
+ <div class="member-link">
3031
+ <a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
3032
+ </div>
3033
+ <div class="member-description hidden">
3034
+
3035
+ <div class="member-text">
3036
+ <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>
3037
+
3038
+
3039
+
3040
+ <ul class="member-list">
3041
+ <h4>Type:</h4>
3042
+ <li>
3043
+ <tt>Function</tt>⟋<tt>null</tt>
3044
+ </li>
3045
+ </ul>
3046
+ <ul class="member-list">
3047
+ <h4>Options:</h4>
3048
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the selected item</li>
3049
+ <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>
3050
+ <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>
3051
+ <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>
3052
+ <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>
3053
+ <li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> &mdash; the view drawn into
3054
+ What the handler draws isn&rsquo;t part of the item&rsquo;s hit testing, its bounds or its SVG export.</li>
3055
+ </ul>
3056
+
3057
+ <h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
3058
+
3059
+ <div class="paperscript split">
3060
+
3061
+ <div class="buttons">
3062
+ <div class="button run">Run</div>
3063
+ </div>
3064
+
3065
+ <script type="text/paperscript" canvas="canvas-36">
3066
+ var path = new Path.Star({
3067
+ center: view.center,
3068
+ points: 5,
3069
+ radius1: 20,
3070
+ radius2: 40,
3071
+ strokeColor: 'black',
3072
+ selected: true
3073
+ });
3074
+
3075
+ path.onDrawSelection = function(event) {
3076
+ var ctx = event.context;
3077
+ this.segments.forEach(function(segment) {
3078
+ var point = event.matrix.transform(segment.point);
3079
+ ctx.beginPath();
3080
+ ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
3081
+ ctx.fill();
3082
+ });
3083
+ return false;
3084
+ }
3085
+ </script>
3086
+ <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3087
+ </div>
3088
+
3089
+
3090
+ </div>
3091
+
3092
+ </div>
3093
+ </div>
3094
+
3095
+ </div>
3096
+
3097
+
3098
+ <!-- =========================== inherited methods ========================= -->
3099
+ <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3100
+
3101
+
3102
+ <div id="addeffect-effect" class="member">
3103
+ <div class="member-link">
3104
+ <a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
3105
+ </div>
3106
+ <div class="member-description hidden">
3107
+ <div class="member-text">
3108
+ <p>Adds an effect at the end of the item&rsquo;s effects.</p>
3109
+
3110
+
3111
+ <ul class="member-list">
3112
+ <h4>Parameters:</h4>
3113
+
3114
+ <li>
3115
+ <tt>effect:</tt>
3116
+ <tt>Object</tt>
3117
+ &mdash;&nbsp;the plain object describing the effect
3118
+
3119
+ </li>
3120
+
3121
+ </ul>
3122
+
3123
+
3124
+ <ul class="member-list">
3125
+ <h4>Returns:</h4>
3126
+
3127
+ <li>
3128
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the added instance
3129
+ </li>
3130
+
3131
+
3132
+ </ul>
3133
+
3134
+
3135
+
3136
+
3137
+
3138
+ </div>
3139
+ </div>
3140
+ </div>
3141
+
3142
+
3143
+ <div id="inserteffect-index-effect" class="member">
3144
+ <div class="member-link">
3145
+ <a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
3146
+ </div>
3147
+ <div class="member-description hidden">
3148
+ <div class="member-text">
3149
+ <p>Inserts an effect into the item&rsquo;s effects at the given index.</p>
3150
+
3151
+
3152
+ <ul class="member-list">
3153
+ <h4>Parameters:</h4>
3154
+
3155
+ <li>
3156
+ <tt>index:</tt>
3157
+ <tt>Number</tt>
3158
+ &mdash;&nbsp;the index at which to insert the effect
3159
+
3160
+ </li>
3161
+
3162
+ <li>
3163
+ <tt>effect:</tt>
3164
+ <tt>Object</tt>
3165
+ &mdash;&nbsp;the plain object describing the effect
3166
+
3167
+ </li>
3168
+
3169
+ </ul>
3170
+
3171
+
3172
+ <ul class="member-list">
3173
+ <h4>Returns:</h4>
3174
+
3175
+ <li>
3176
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted instance
3177
+ </li>
3178
+
3179
+
3180
+ </ul>
3181
+
3182
+
3183
+
3184
+
3185
+
3186
+ </div>
3187
+ </div>
3188
+ </div>
3189
+
3190
+
3191
+ <div id="inserteffects-index-effects" class="member">
3192
+ <div class="member-link">
3193
+ <a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
3194
+ </div>
3195
+ <div class="member-description hidden">
3196
+ <div class="member-text">
3197
+ <p>Inserts effects into the item&rsquo;s effects at the given index.</p>
3198
+
3199
+
3200
+ <ul class="member-list">
3201
+ <h4>Parameters:</h4>
3202
+
3203
+ <li>
3204
+ <tt>index:</tt>
3205
+ <tt>Number</tt>
3206
+ &mdash;&nbsp;the index at which to insert the effects
3207
+
3208
+ </li>
3209
+
3210
+ <li>
3211
+ <tt>effects:</tt>
3212
+ Array of <tt>Object</tt> objects
3213
+ &mdash;&nbsp;the plain objects describing the effects
3214
+
3215
+ </li>
3216
+
3217
+ </ul>
3218
+
3219
+
3220
+ <ul class="member-list">
3221
+ <h4>Returns:</h4>
3222
+
3223
+ <li>
3224
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the inserted instances
3225
+ </li>
3226
+
3227
+
3228
+ </ul>
2718
3229
 
2719
3230
 
2720
- </div>
2721
3231
 
3232
+
3233
+
3234
+ </div>
2722
3235
  </div>
2723
3236
  </div>
2724
3237
 
2725
3238
 
2726
- <div id="onmouseenter" class="member">
3239
+ <div id="removeeffect-index" class="member">
2727
3240
  <div class="member-link">
2728
- <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
3241
+ <a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
2729
3242
  </div>
2730
3243
  <div class="member-description hidden">
2731
-
2732
3244
  <div class="member-text">
2733
- <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>
3245
+ <p>Removes the effect at the given index from the item&rsquo;s effects.</p>
3246
+
2734
3247
 
3248
+ <ul class="member-list">
3249
+ <h4>Parameters:</h4>
2735
3250
 
3251
+ <li>
3252
+ <tt>index:</tt>
3253
+ <tt>Number</tt>
3254
+ &mdash;&nbsp;the index of the effect to remove
3255
+
3256
+ </li>
2736
3257
 
2737
- <ul class="member-list">
2738
- <h4>Type:</h4>
2739
- <li>
2740
- <tt>Function</tt>⟋<tt>null</tt>
2741
- </li>
2742
- </ul>
2743
-
3258
+ </ul>
3259
+
2744
3260
 
2745
3261
  <ul class="member-list">
2746
- <h4>See also:</h4>
3262
+ <h4>Returns:</h4>
2747
3263
 
2748
- <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
3264
+ <li>
3265
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the removed instance, or <code>null</code>
3266
+ </li>
3267
+
2749
3268
 
2750
3269
  </ul>
2751
3270
 
2752
- <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>
2753
3271
 
2754
- <div class="paperscript split">
2755
3272
 
2756
- <div class="buttons">
2757
- <div class="button run">Run</div>
3273
+
3274
+
2758
3275
  </div>
2759
-
2760
- <script type="text/paperscript" canvas="canvas-31">
2761
- // Create a circle shaped path at the center of the view:
2762
- var path = new Path.Circle({
2763
- center: view.center,
2764
- radius: 25,
2765
- fillColor: 'black'
2766
- });
2767
-
2768
- // When the mouse enters the item, set its fill color to red:
2769
- path.onMouseEnter = function(event) {
2770
- this.fillColor = 'red';
2771
- }
2772
-
2773
- // When the mouse leaves the item, set its fill color to black:
2774
- path.onMouseLeave = function(event) {
2775
- this.fillColor = 'black';
2776
- }
2777
- </script>
2778
- <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
2779
3276
  </div>
2780
-
2781
-
2782
- <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>
2783
-
2784
- <div class="paperscript split">
2785
-
2786
- <div class="buttons">
2787
- <div class="button run">Run</div>
2788
3277
  </div>
2789
3278
 
2790
- <script type="text/paperscript" canvas="canvas-32">
2791
- function enter(event) {
2792
- this.fillColor = 'red';
2793
- }
2794
-
2795
- function leave(event) {
2796
- this.fillColor = 'black';
2797
- }
3279
+
3280
+ <div id="removeeffects" class="member">
3281
+ <div class="member-link">
3282
+ <a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
3283
+ </div>
3284
+ <div class="member-description hidden">
3285
+ <div class="member-text">
3286
+ <p>Removes the effects from the start index to the end index from the item&rsquo;s effects, or all of them.</p>
3287
+
3288
+
3289
+ <ul class="member-list">
3290
+ <h4>Parameters:</h4>
3291
+
3292
+ <li>
3293
+ <tt>start:</tt>
3294
+ <tt>Number</tt>
3295
+ &mdash;&nbsp;the index of the first effect to remove
3296
+ &mdash;&nbsp;optional, default: <tt>0</tt>
3297
+ </li>
3298
+
3299
+ <li>
3300
+ <tt>end:</tt>
3301
+ <tt>Number</tt>
3302
+ &mdash;&nbsp;the index after the last one
3303
+ &mdash;&nbsp;optional, default: <tt>effects.length</tt>
3304
+ </li>
3305
+
3306
+ </ul>
2798
3307
 
2799
- // When the mouse is pressed:
2800
- function onMouseDown(event) {
2801
- // Create a circle shaped path at the position of the mouse:
2802
- var path = new Path.Circle(event.point, 25);
2803
- path.fillColor = 'black';
3308
+
3309
+ <ul class="member-list">
3310
+ <h4>Returns:</h4>
3311
+
3312
+ <li>
3313
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the removed instances
3314
+ </li>
2804
3315
 
2805
- // When the mouse enters the item, set its fill color to red:
2806
- path.onMouseEnter = enter;
3316
+
3317
+ </ul>
2807
3318
 
2808
- // When the mouse leaves the item, set its fill color to black:
2809
- path.onMouseLeave = leave;
2810
- }
2811
- </script>
2812
- <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
2813
- </div>
2814
3319
 
2815
3320
 
3321
+
3322
+
2816
3323
  </div>
2817
-
2818
3324
  </div>
2819
3325
  </div>
2820
3326
 
2821
3327
 
2822
- <div id="onmouseleave" class="member">
3328
+ <div id="geteffectoutput" class="member">
2823
3329
  <div class="member-link">
2824
- <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
3330
+ <a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
2825
3331
  </div>
2826
3332
  <div class="member-description hidden">
2827
-
2828
3333
  <div class="member-text">
2829
- <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>
2830
-
2831
-
2832
-
2833
- <ul class="member-list">
2834
- <h4>Type:</h4>
2835
- <li>
2836
- <tt>Function</tt>⟋<tt>null</tt>
2837
- </li>
2838
- </ul>
3334
+ <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>
2839
3335
 
2840
3336
 
3337
+
2841
3338
  <ul class="member-list">
2842
- <h4>See also:</h4>
3339
+ <h4>Returns:</h4>
2843
3340
 
2844
- <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
3341
+ <li>
3342
+ <tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt>&nbsp;&mdash;&nbsp;the output of the effects
3343
+ </li>
3344
+
2845
3345
 
2846
3346
  </ul>
2847
3347
 
2848
- <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>
2849
-
2850
- <div class="paperscript split">
2851
-
2852
- <div class="buttons">
2853
- <div class="button run">Run</div>
2854
- </div>
2855
-
2856
- <script type="text/paperscript" canvas="canvas-33">
2857
- // Create a circle shaped path at the center of the view:
2858
- var path = new Path.Circle({
2859
- center: view.center,
2860
- radius: 25,
2861
- fillColor: 'black'
2862
- });
2863
-
2864
- // When the mouse leaves the item, set its fill color to red:
2865
- path.onMouseLeave = function(event) {
2866
- this.fillColor = 'red';
2867
- }
2868
- </script>
2869
- <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
2870
- </div>
2871
-
2872
3348
 
2873
- </div>
2874
3349
 
3350
+
3351
+
2875
3352
  </div>
2876
3353
  </div>
2877
-
2878
3354
  </div>
2879
3355
 
2880
-
2881
- <!-- =========================== inherited methods ========================= -->
2882
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
2883
-
2884
3356
 
2885
3357
  <div id="set-props" class="member">
2886
3358
  <div class="member-link">
@@ -2925,7 +3397,7 @@ path.onMouseLeave = function(event) {
2925
3397
  <div class="button run">Run</div>
2926
3398
  </div>
2927
3399
 
2928
- <script type="text/paperscript" canvas="canvas-34">
3400
+ <script type="text/paperscript" canvas="canvas-37">
2929
3401
  var circle = new Path.Circle({
2930
3402
  center: [80, 50],
2931
3403
  radius: 35
@@ -2938,7 +3410,7 @@ circle.set({
2938
3410
  selected: true
2939
3411
  });
2940
3412
  </script>
2941
- <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
3413
+ <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
2942
3414
  </div>
2943
3415
 
2944
3416
 
@@ -2994,7 +3466,7 @@ circle.set({
2994
3466
  <div class="button run">Run</div>
2995
3467
  </div>
2996
3468
 
2997
- <script type="text/paperscript" canvas="canvas-35">
3469
+ <script type="text/paperscript" canvas="canvas-38">
2998
3470
  var circle = new Path.Circle({
2999
3471
  center: [50, 50],
3000
3472
  radius: 10,
@@ -3009,7 +3481,7 @@ for (var i = 0; i < 20; i++) {
3009
3481
  copy.position.x += i * copy.bounds.width;
3010
3482
  }
3011
3483
  </script>
3012
- <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3484
+ <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
3013
3485
  </div>
3014
3486
 
3015
3487
 
@@ -3135,7 +3607,7 @@ for (var i = 0; i < 20; i++) {
3135
3607
  <div class="button run">Run</div>
3136
3608
  </div>
3137
3609
 
3138
- <script type="text/paperscript" canvas="canvas-36">
3610
+ <script type="text/paperscript" canvas="canvas-39">
3139
3611
  var circle = new Path.Circle({
3140
3612
  center: [50, 50],
3141
3613
  radius: 5,
@@ -3152,7 +3624,7 @@ raster.position.x += 100;
3152
3624
  circle.scale(5);
3153
3625
  raster.scale(5);
3154
3626
  </script>
3155
- <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3627
+ <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
3156
3628
  </div>
3157
3629
 
3158
3630
 
@@ -3206,7 +3678,7 @@ raster.scale(5);
3206
3678
  <div class="button run">Run</div>
3207
3679
  </div>
3208
3680
 
3209
- <script type="text/paperscript" canvas="canvas-37">
3681
+ <script type="text/paperscript" canvas="canvas-40">
3210
3682
  var path = new Path.Star({
3211
3683
  center: [50, 50],
3212
3684
  points: 12,
@@ -3227,7 +3699,7 @@ function onMouseDown(event) {
3227
3699
  }
3228
3700
  }
3229
3701
  </script>
3230
- <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3702
+ <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
3231
3703
  </div>
3232
3704
 
3233
3705
 
@@ -3745,11 +4217,17 @@ function onMouseDown(event) {
3745
4217
  </div>
3746
4218
  <div class="member-description hidden">
3747
4219
  <div class="member-text">
3748
- <p>Exports the item with its content and child items as an SVG DOM.</p>
4220
+ <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>
3749
4221
  <ul class="member-list">
3750
4222
  <h4>Options:</h4>
3751
- <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>
3752
- <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>
4223
+ <li>[options.bounds] {String|Rectangle} the bounds of the area to
4224
+ export, either as a string ({@values 'view', content'}), or a
4225
+ {@link Rectangle} object: `'view'` uses the view bounds,
4226
+ `'content'` uses the stroke bounds of the item</li>
4227
+ <li>[options.matrix] {Matrix} the matrix with which to transform the
4228
+ exported content: If `options.bounds` is set to `'view'`,
4229
+ `paper.view.matrix` is used, for all other settings of
4230
+ `options.bounds` the identity matrix is used.</li>
3753
4231
  <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>
3754
4232
  <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>
3755
4233
  <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>
@@ -5103,7 +5581,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5103
5581
  <div class="button run">Run</div>
5104
5582
  </div>
5105
5583
 
5106
- <script type="text/paperscript" canvas="canvas-38">
5584
+ <script type="text/paperscript" canvas="canvas-41">
5107
5585
  // Create a rectangle shaped path with its top left
5108
5586
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
5109
5587
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -5112,7 +5590,7 @@ path.fillColor = 'black';
5112
5590
  // Rotate the path by 30 degrees:
5113
5591
  path.rotate(30);
5114
5592
  </script>
5115
- <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
5593
+ <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
5116
5594
  </div>
5117
5595
 
5118
5596
 
@@ -5124,7 +5602,7 @@ path.rotate(30);
5124
5602
  <div class="button run">Run</div>
5125
5603
  </div>
5126
5604
 
5127
- <script type="text/paperscript" canvas="canvas-39">
5605
+ <script type="text/paperscript" canvas="canvas-42">
5128
5606
  // Create a rectangle shaped path with its top left
5129
5607
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
5130
5608
  var topLeft = new Point(175, 50);
@@ -5146,7 +5624,7 @@ function onFrame(event) {
5146
5624
  path.rotate(3, view.center);
5147
5625
  }
5148
5626
  </script>
5149
- <div class="canvas"><canvas width="516" height="200" id="canvas-39"></canvas></div>
5627
+ <div class="canvas"><canvas width="516" height="200" id="canvas-42"></canvas></div>
5150
5628
  </div>
5151
5629
 
5152
5630
 
@@ -5195,7 +5673,7 @@ function onFrame(event) {
5195
5673
  <div class="button run">Run</div>
5196
5674
  </div>
5197
5675
 
5198
- <script type="text/paperscript" canvas="canvas-40">
5676
+ <script type="text/paperscript" canvas="canvas-43">
5199
5677
  // Create a circle shaped path at { x: 80, y: 50 }
5200
5678
  // with a radius of 20:
5201
5679
  var circle = new Path.Circle({
@@ -5207,7 +5685,7 @@ var circle = new Path.Circle({
5207
5685
  // Scale the path by 150% from its center point
5208
5686
  circle.scale(1.5);
5209
5687
  </script>
5210
- <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
5688
+ <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
5211
5689
  </div>
5212
5690
 
5213
5691
 
@@ -5219,7 +5697,7 @@ circle.scale(1.5);
5219
5697
  <div class="button run">Run</div>
5220
5698
  </div>
5221
5699
 
5222
- <script type="text/paperscript" canvas="canvas-41">
5700
+ <script type="text/paperscript" canvas="canvas-44">
5223
5701
  // Create a circle shaped path at { x: 80, y: 50 }
5224
5702
  // with a radius of 20:
5225
5703
  var circle = new Path.Circle({
@@ -5231,7 +5709,7 @@ var circle = new Path.Circle({
5231
5709
  // Scale the path 150% from its bottom left corner
5232
5710
  circle.scale(1.5, circle.bounds.bottomLeft);
5233
5711
  </script>
5234
- <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
5712
+ <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
5235
5713
  </div>
5236
5714
 
5237
5715
 
@@ -5287,7 +5765,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
5287
5765
  <div class="button run">Run</div>
5288
5766
  </div>
5289
5767
 
5290
- <script type="text/paperscript" canvas="canvas-42">
5768
+ <script type="text/paperscript" canvas="canvas-45">
5291
5769
  // Create a circle shaped path at { x: 100, y: 50 }
5292
5770
  // with a radius of 20:
5293
5771
  var circle = new Path.Circle({
@@ -5299,7 +5777,7 @@ var circle = new Path.Circle({
5299
5777
  // Scale the path horizontally by 300%
5300
5778
  circle.scale(3, 1);
5301
5779
  </script>
5302
- <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
5780
+ <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
5303
5781
  </div>
5304
5782
 
5305
5783
 
@@ -5737,7 +6215,7 @@ circle.scale(3, 1);
5737
6215
  <div class="button run">Run</div>
5738
6216
  </div>
5739
6217
 
5740
- <script type="text/paperscript" canvas="canvas-43">
6218
+ <script type="text/paperscript" canvas="canvas-46">
5741
6219
  // Create a rectangle shaped path with its top left corner
5742
6220
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
5743
6221
  var path = new Path.Rectangle({
@@ -5758,7 +6236,7 @@ var circlePath = new Path.Circle({
5758
6236
  // the rectangular path:
5759
6237
  circlePath.fitBounds(path.bounds);
5760
6238
  </script>
5761
- <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
6239
+ <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
5762
6240
  </div>
5763
6241
 
5764
6242
 
@@ -5770,7 +6248,7 @@ circlePath.fitBounds(path.bounds);
5770
6248
  <div class="button run">Run</div>
5771
6249
  </div>
5772
6250
 
5773
- <script type="text/paperscript" canvas="canvas-44">
6251
+ <script type="text/paperscript" canvas="canvas-47">
5774
6252
  // Create a rectangle shaped path with its top left corner
5775
6253
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
5776
6254
  var path = new Path.Rectangle({
@@ -5791,7 +6269,7 @@ var circlePath = new Path.Circle({
5791
6269
  // the rectangular path:
5792
6270
  circlePath.fitBounds(path.bounds, 'cover');
5793
6271
  </script>
5794
- <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
6272
+ <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
5795
6273
  </div>
5796
6274
 
5797
6275
 
@@ -5803,7 +6281,7 @@ circlePath.fitBounds(path.bounds, 'cover');
5803
6281
  <div class="button run">Run</div>
5804
6282
  </div>
5805
6283
 
5806
- <script type="text/paperscript" canvas="canvas-45">
6284
+ <script type="text/paperscript" canvas="canvas-48">
5807
6285
  var path = new Path.Circle({
5808
6286
  center: [80, 50],
5809
6287
  radius: 30,
@@ -5813,7 +6291,7 @@ var path = new Path.Circle({
5813
6291
  // Fit the path to the bounding rectangle of the view:
5814
6292
  path.fitBounds(view.bounds);
5815
6293
  </script>
5816
- <div class="canvas"><canvas width="516" height="200" id="canvas-45"></canvas></div>
6294
+ <div class="canvas"><canvas width="516" height="200" id="canvas-48"></canvas></div>
5817
6295
  </div>
5818
6296
 
5819
6297
 
@@ -5839,7 +6317,7 @@ path.fitBounds(view.bounds);
5839
6317
  <li>
5840
6318
  <tt>type:</tt>
5841
6319
  <tt>String</tt>
5842
- &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>
6320
+ &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>
5843
6321
 
5844
6322
  </li>
5845
6323
 
@@ -5874,7 +6352,7 @@ path.fitBounds(view.bounds);
5874
6352
  <div class="button run">Run</div>
5875
6353
  </div>
5876
6354
 
5877
- <script type="text/paperscript" canvas="canvas-46">
6355
+ <script type="text/paperscript" canvas="canvas-49">
5878
6356
  // Create a circle shaped path at the center of the view:
5879
6357
  var path = new Path.Circle({
5880
6358
  center: view.center,
@@ -5892,7 +6370,7 @@ path.on('mouseleave', function() {
5892
6370
  this.fillColor = 'black';
5893
6371
  });
5894
6372
  </script>
5895
- <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
6373
+ <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
5896
6374
  </div>
5897
6375
 
5898
6376
 
@@ -5916,7 +6394,7 @@ path.on('mouseleave', function() {
5916
6394
  <li>
5917
6395
  <tt>object:</tt>
5918
6396
  <tt>Object</tt>
5919
- &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>
6397
+ &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>
5920
6398
 
5921
6399
  </li>
5922
6400
 
@@ -5944,7 +6422,7 @@ path.on('mouseleave', function() {
5944
6422
  <div class="button run">Run</div>
5945
6423
  </div>
5946
6424
 
5947
- <script type="text/paperscript" canvas="canvas-47">
6425
+ <script type="text/paperscript" canvas="canvas-50">
5948
6426
  // Create a circle shaped path at the center of the view:
5949
6427
  var path = new Path.Circle({
5950
6428
  center: view.center,
@@ -5962,7 +6440,7 @@ path.on({
5962
6440
  }
5963
6441
  });
5964
6442
  </script>
5965
- <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
6443
+ <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
5966
6444
  </div>
5967
6445
 
5968
6446
 
@@ -5974,7 +6452,7 @@ path.on({
5974
6452
  <div class="button run">Run</div>
5975
6453
  </div>
5976
6454
 
5977
- <script type="text/paperscript" canvas="canvas-48">
6455
+ <script type="text/paperscript" canvas="canvas-51">
5978
6456
  var pathHandlers = {
5979
6457
  mouseenter: function(event) {
5980
6458
  this.fillColor = 'red';
@@ -5997,7 +6475,7 @@ function onMouseDown(event) {
5997
6475
  path.on(pathHandlers);
5998
6476
  }
5999
6477
  </script>
6000
- <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6478
+ <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
6001
6479
  </div>
6002
6480
 
6003
6481
 
@@ -6021,7 +6499,7 @@ function onMouseDown(event) {
6021
6499
  <li>
6022
6500
  <tt>type:</tt>
6023
6501
  <tt>String</tt>
6024
- &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>
6502
+ &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>
6025
6503
 
6026
6504
  </li>
6027
6505
 
@@ -6069,7 +6547,7 @@ function onMouseDown(event) {
6069
6547
  <li>
6070
6548
  <tt>object:</tt>
6071
6549
  <tt>Object</tt>
6072
- &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>
6550
+ &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>
6073
6551
 
6074
6552
  </li>
6075
6553
 
@@ -6110,7 +6588,7 @@ function onMouseDown(event) {
6110
6588
  <li>
6111
6589
  <tt>type:</tt>
6112
6590
  <tt>String</tt>
6113
- &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>
6591
+ &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>
6114
6592
 
6115
6593
  </li>
6116
6594
 
@@ -6158,7 +6636,7 @@ function onMouseDown(event) {
6158
6636
  <li>
6159
6637
  <tt>type:</tt>
6160
6638
  <tt>String</tt>
6161
- &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>
6639
+ &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>
6162
6640
 
6163
6641
  </li>
6164
6642
 
@@ -6225,7 +6703,7 @@ function onMouseDown(event) {
6225
6703
  <div class="button run">Run</div>
6226
6704
  </div>
6227
6705
 
6228
- <script type="text/paperscript" canvas="canvas-49">
6706
+ <script type="text/paperscript" canvas="canvas-52">
6229
6707
  function onMouseDrag(event) {
6230
6708
  // Create a circle shaped path at the mouse position,
6231
6709
  // with a radius of 10:
@@ -6242,7 +6720,7 @@ function onMouseDrag(event) {
6242
6720
  });
6243
6721
  }
6244
6722
  </script>
6245
- <div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
6723
+ <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
6246
6724
  </div>
6247
6725
 
6248
6726
 
@@ -6272,7 +6750,7 @@ function onMouseDrag(event) {
6272
6750
  <div class="button run">Run</div>
6273
6751
  </div>
6274
6752
 
6275
- <script type="text/paperscript" canvas="canvas-50">
6753
+ <script type="text/paperscript" canvas="canvas-53">
6276
6754
  function onMouseMove(event) {
6277
6755
  // Create a circle shaped path at the mouse position,
6278
6756
  // with a radius of 10:
@@ -6286,7 +6764,7 @@ function onMouseMove(event) {
6286
6764
  path.removeOnMove();
6287
6765
  }
6288
6766
  </script>
6289
- <div class="canvas"><canvas width="516" height="200" id="canvas-50"></canvas></div>
6767
+ <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
6290
6768
  </div>
6291
6769
 
6292
6770
 
@@ -6316,7 +6794,7 @@ function onMouseMove(event) {
6316
6794
  <div class="button run">Run</div>
6317
6795
  </div>
6318
6796
 
6319
- <script type="text/paperscript" canvas="canvas-51">
6797
+ <script type="text/paperscript" canvas="canvas-54">
6320
6798
  function onMouseDown(event) {
6321
6799
  // Create a circle shaped path at the mouse position,
6322
6800
  // with a radius of 10:
@@ -6330,7 +6808,7 @@ function onMouseDown(event) {
6330
6808
  path.removeOnDown();
6331
6809
  }
6332
6810
  </script>
6333
- <div class="canvas"><canvas width="516" height="200" id="canvas-51"></canvas></div>
6811
+ <div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
6334
6812
  </div>
6335
6813
 
6336
6814
 
@@ -6360,7 +6838,7 @@ function onMouseDown(event) {
6360
6838
  <div class="button run">Run</div>
6361
6839
  </div>
6362
6840
 
6363
- <script type="text/paperscript" canvas="canvas-52">
6841
+ <script type="text/paperscript" canvas="canvas-55">
6364
6842
  function onMouseDrag(event) {
6365
6843
  // Create a circle shaped path at the mouse position,
6366
6844
  // with a radius of 10:
@@ -6374,7 +6852,7 @@ function onMouseDrag(event) {
6374
6852
  path.removeOnDrag();
6375
6853
  }
6376
6854
  </script>
6377
- <div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
6855
+ <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
6378
6856
  </div>
6379
6857
 
6380
6858
 
@@ -6404,7 +6882,7 @@ function onMouseDrag(event) {
6404
6882
  <div class="button run">Run</div>
6405
6883
  </div>
6406
6884
 
6407
- <script type="text/paperscript" canvas="canvas-53">
6885
+ <script type="text/paperscript" canvas="canvas-56">
6408
6886
  function onMouseDown(event) {
6409
6887
  // Create a circle shaped path at the mouse position,
6410
6888
  // with a radius of 10:
@@ -6418,7 +6896,7 @@ function onMouseDown(event) {
6418
6896
  path.removeOnUp();
6419
6897
  }
6420
6898
  </script>
6421
- <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
6899
+ <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
6422
6900
  </div>
6423
6901
 
6424
6902
 
@@ -6491,7 +6969,7 @@ function onMouseDown(event) {
6491
6969
  <div class="button run">Run</div>
6492
6970
  </div>
6493
6971
 
6494
- <script type="text/paperscript" canvas="canvas-54">
6972
+ <script type="text/paperscript" canvas="canvas-57">
6495
6973
  var path = new Path.Circle({
6496
6974
  radius: view.bounds.height * 0.4,
6497
6975
  center: view.center
@@ -6502,7 +6980,7 @@ path.tween(
6502
6980
  3000
6503
6981
  );
6504
6982
  </script>
6505
- <div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
6983
+ <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
6506
6984
  </div>
6507
6985
 
6508
6986
 
@@ -6514,7 +6992,7 @@ path.tween(
6514
6992
  <div class="button run">Run</div>
6515
6993
  </div>
6516
6994
 
6517
- <script type="text/paperscript" canvas="canvas-55">
6995
+ <script type="text/paperscript" canvas="canvas-58">
6518
6996
  var path = new Shape.Rectangle({
6519
6997
  fillColor: 'red',
6520
6998
  center: [50, view.center.y],
@@ -6529,7 +7007,7 @@ path.tween({
6529
7007
  duration: 2000
6530
7008
  });
6531
7009
  </script>
6532
- <div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
7010
+ <div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
6533
7011
  </div>
6534
7012
 
6535
7013
 
@@ -6595,7 +7073,7 @@ path.tween({
6595
7073
  <div class="button run">Run</div>
6596
7074
  </div>
6597
7075
 
6598
- <script type="text/paperscript" canvas="canvas-56">
7076
+ <script type="text/paperscript" canvas="canvas-59">
6599
7077
  var path = new Path.Rectangle({
6600
7078
  size: [100, 100],
6601
7079
  position: view.center,
@@ -6609,7 +7087,7 @@ path.tween({
6609
7087
  'segments[2].point.x': '-= 50'
6610
7088
  }, 3000);
6611
7089
  </script>
6612
- <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
7090
+ <div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
6613
7091
  </div>
6614
7092
 
6615
7093
 
@@ -6668,7 +7146,7 @@ path.tween({
6668
7146
  <div class="button run">Run</div>
6669
7147
  </div>
6670
7148
 
6671
- <script type="text/paperscript" canvas="canvas-57">
7149
+ <script type="text/paperscript" canvas="canvas-60">
6672
7150
  var path = new Path.Circle({
6673
7151
  fillColor: 'blue',
6674
7152
  radius: view.bounds.height * 0.4,
@@ -6684,7 +7162,7 @@ path.tween(2000).onUpdate = function(event) {
6684
7162
  path.interpolate(pathFrom, pathTo, event.factor)
6685
7163
  };
6686
7164
  </script>
6687
- <div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
7165
+ <div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
6688
7166
  </div>
6689
7167
 
6690
7168
 
@@ -6805,7 +7283,7 @@ path.tween(2000).onUpdate = function(event) {
6805
7283
  <div class="button run">Run</div>
6806
7284
  </div>
6807
7285
 
6808
- <script type="text/paperscript" canvas="canvas-58">
7286
+ <script type="text/paperscript" canvas="canvas-61">
6809
7287
  var path = new Path.Circle({
6810
7288
  fillColor: 'blue',
6811
7289
  radius: view.bounds.height * 0.4,
@@ -6813,7 +7291,7 @@ var path = new Path.Circle({
6813
7291
  });
6814
7292
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
6815
7293
  </script>
6816
- <div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
7294
+ <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
6817
7295
  </div>
6818
7296
 
6819
7297
 
@@ -6827,7 +7305,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
6827
7305
 
6828
7306
  <!-- =========================== copyright notice ========================== -->
6829
7307
  <p class="footer">
6830
- Paper.js v0.16.0<br>
7308
+ Paper.js v0.17.0<br>
6831
7309
  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>
6832
7310
  <div class="content-end"></div>
6833
7311