paper 0.15.0 → 0.17.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (64) hide show
  1. package/CHANGELOG.md +158 -0
  2. package/README.md +24 -16
  3. package/dist/docs/assets/js/paper.js +4811 -808
  4. package/dist/docs/classes/AreaText.html +771 -243
  5. package/dist/docs/classes/ChangeFlag.html +1 -1
  6. package/dist/docs/classes/Color.html +218 -21
  7. package/dist/docs/classes/CompoundPath.html +1174 -274
  8. package/dist/docs/classes/Curve.html +2 -2
  9. package/dist/docs/classes/CurveLocation.html +1 -1
  10. package/dist/docs/classes/DrawEvent.html +69 -0
  11. package/dist/docs/classes/Effect.html +434 -0
  12. package/dist/docs/classes/EffectInstance.html +304 -0
  13. package/dist/docs/classes/Event.html +1 -1
  14. package/dist/docs/classes/Gradient.html +1 -1
  15. package/dist/docs/classes/GradientStop.html +1 -1
  16. package/dist/docs/classes/Group.html +842 -243
  17. package/dist/docs/classes/HitResult.html +1 -1
  18. package/dist/docs/classes/HostItem.html +770 -242
  19. package/dist/docs/classes/Item.html +827 -242
  20. package/dist/docs/classes/Key.html +1 -1
  21. package/dist/docs/classes/KeyEvent.html +1 -1
  22. package/dist/docs/classes/Layer.html +784 -185
  23. package/dist/docs/classes/Matrix.html +1 -1
  24. package/dist/docs/classes/MouseEvent.html +1 -1
  25. package/dist/docs/classes/PaperScope.html +1 -1
  26. package/dist/docs/classes/PaperScript.html +4 -2
  27. package/dist/docs/classes/Path.html +1366 -352
  28. package/dist/docs/classes/PathItem.html +1198 -298
  29. package/dist/docs/classes/PathText.html +772 -244
  30. package/dist/docs/classes/PatternDefinition.html +367 -0
  31. package/dist/docs/classes/Point.html +33 -5
  32. package/dist/docs/classes/PointText.html +771 -243
  33. package/dist/docs/classes/Project.html +251 -9
  34. package/dist/docs/classes/Raster.html +770 -242
  35. package/dist/docs/classes/Rectangle.html +50 -8
  36. package/dist/docs/classes/Segment.html +79 -2
  37. package/dist/docs/classes/Shape.html +770 -242
  38. package/dist/docs/classes/Size.html +31 -3
  39. package/dist/docs/classes/StrokeProfileStop.html +346 -0
  40. package/dist/docs/classes/Style.html +67 -6
  41. package/dist/docs/classes/SymbolDefinition.html +28 -2
  42. package/dist/docs/classes/SymbolItem.html +807 -242
  43. package/dist/docs/classes/TextItem.html +771 -243
  44. package/dist/docs/classes/TextRange.html +1 -1
  45. package/dist/docs/classes/TextStory.html +1 -1
  46. package/dist/docs/classes/Tool.html +2 -2
  47. package/dist/docs/classes/ToolEvent.html +1 -1
  48. package/dist/docs/classes/Tween.html +1 -1
  49. package/dist/docs/classes/View.html +2 -2
  50. package/dist/docs/classes/global.html +1 -1
  51. package/dist/docs/classes/index.html +2 -2
  52. package/dist/docs/index.html +1 -1
  53. package/dist/node/browser.js +15 -0
  54. package/dist/paper-core.js +4701 -728
  55. package/dist/paper-core.min.js +3 -3
  56. package/dist/paper-full.js +4811 -808
  57. package/dist/paper-full.min.js +3 -3
  58. package/dist/paper-hosted.js +5389 -892
  59. package/dist/paper.d.ts +1058 -69
  60. package/examples/Paperjs.org/LiveEffects.html +366 -0
  61. package/examples/Paperjs.org/Offsetting.html +379 -0
  62. package/examples/Paperjs.org/StrokeProfiles.html +706 -0
  63. package/examples/Scripts/Patterns.html +57 -0
  64. package/package.json +21 -11
@@ -267,7 +267,7 @@ function onFrame(event) {
267
267
  <div class="member-description hidden">
268
268
 
269
269
  <div class="member-text">
270
- <p>Specifies whether the group is isolated, drawn through a temporary canvas, so that the blend modes of its children only apply within it, like CSS&rsquo;s <code>isolation: isolate</code>. Without it, a compositing mode such as <code>&#39;destination-out&#39;</code> affects everything drawn below the group, also in other layers. Groups with an <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> below 1 or a <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a> are isolated anyway.</p>
270
+ <p>Specifies whether the group is isolated, drawn through a temporary canvas, so that the blend modes of its children only apply within it, like CSS&rsquo;s <code>isolation: isolate</code>. Without it, a compositing mode such as <code>&#39;destination-out&#39;</code> affects everything drawn below the group, also in other layers. Groups with an <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> below 1 or a <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a> are isolated anyway, and buffered groups always, see <a href="../classes/Group.html#buffered"><tt>buffered</tt></a>.</p>
271
271
 
272
272
 
273
273
 
@@ -285,6 +285,77 @@ function onFrame(event) {
285
285
 
286
286
 
287
287
 
288
+ </div>
289
+
290
+ </div>
291
+ </div>
292
+
293
+
294
+ <div id="buffered" class="member">
295
+ <div class="member-link">
296
+ <a name="buffered" href="#buffered"><tt><b>buffered</b></tt></a>
297
+ </div>
298
+ <div class="member-description hidden">
299
+
300
+ <div class="member-text">
301
+ <p>Specifies whether the group is buffered: when a view draws it, it draws its content into a canvas of its own, which it keeps, and only draws into it again when something in the group changes, or the part of it that the view shows does, e.g. after zooming or panning. Otherwise, the view only composites the buffer, with the group&rsquo;s <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> and <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a>. This pays off for large groups and layers that rarely change, such as a complex background below animated items.</p>
302
+ <p>It doesn&rsquo;t pay off when the buffer is drawn again on every frame: while the view pans or zooms on every frame, while the group itself is moved or transformed, or when an item inside it is animated. Put animated items into another group or layer instead.</p>
303
+ <p>The buffer costs memory: it covers the part of the group that the view shows, at up to <code>width × height × 4 × pixelRatio²</code> bytes for a group that fills the whole view.</p>
304
+ <p>Buffered groups are always <a href="../classes/Group.html#isolated"><tt>isolated</tt></a>: the blend modes of their children only apply within them, not to the items below them, also in other layers.</p>
305
+ <p>Hit-testing, SVG export, <a href="../classes/Item.html#rasterize"><tt>item.rasterize</tt></a>() and drawing into other canvases than the view&rsquo;s don&rsquo;t use the buffer.</p>
306
+ <p>A buffered group keeps one buffer, so inside a <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> that is placed several times, it draws into it again for each placement. Changes to any symbol definition make all buffers stale, as do forced updates through <code>view.update(true)</code>.</p>
307
+
308
+
309
+
310
+ <ul class="member-list">
311
+ <h4>Default:</h4>
312
+ <li><tt>false</tt></li>
313
+ </ul>
314
+
315
+ <ul class="member-list">
316
+ <h4>Type:</h4>
317
+ <li>
318
+ <tt>Boolean</tt>
319
+ </li>
320
+ </ul>
321
+
322
+
323
+ <h4>Example:<span class="description">Draw many circles into a buffered layer, which is drawn once, while the circle in the layer above moves on every frame:</span></h4>
324
+
325
+ <div class="paperscript split">
326
+
327
+ <div class="buttons">
328
+ <div class="button run">Run</div>
329
+ </div>
330
+
331
+ <script type="text/paperscript" canvas="canvas-4">
332
+ var background = project.activeLayer;
333
+ background.buffered = true;
334
+ for (var i = 0; i < 2000; i++) {
335
+ new Path.Circle({
336
+ center: Point.random() * view.size,
337
+ radius: 5 + Math.random() * 10,
338
+ fillColor: { hue: Math.random() * 360, saturation: 0.5,
339
+ brightness: 1 },
340
+ opacity: 0.5
341
+ });
342
+ }
343
+
344
+ var circle = new Path.Circle({
345
+ center: view.center,
346
+ radius: 20,
347
+ fillColor: 'black'
348
+ });
349
+ new Layer([circle]);
350
+
351
+ function onFrame(event) {
352
+ circle.position.x = view.center.x + Math.sin(event.time) * 100;
353
+ }
354
+ </script>
355
+ <div class="canvas"><canvas width="516" height="200" id="canvas-4"></canvas></div>
356
+ </div>
357
+
358
+
288
359
  </div>
289
360
 
290
361
  </div>
@@ -340,6 +411,91 @@ function onFrame(event) {
340
411
  <div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
341
412
 
342
413
 
414
+ <div id="effects" class="member">
415
+ <div class="member-link">
416
+ <a name="effects" href="#effects"><tt><b>effects</b></tt></a>
417
+ </div>
418
+ <div class="member-description hidden">
419
+
420
+ <div class="member-text">
421
+ <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,
422
+ 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>
423
+ <p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
424
+ <ul>
425
+ <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>
426
+ <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>
427
+ </ul>
428
+
429
+
430
+
431
+ <ul class="member-list">
432
+ <h4>Type:</h4>
433
+ <li>
434
+ Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
435
+ </li>
436
+ </ul>
437
+
438
+
439
+ <h4>Example:</h4>
440
+
441
+ <div class="paperscript split">
442
+
443
+ <div class="buttons">
444
+ <div class="button run">Run</div>
445
+ </div>
446
+
447
+ <script type="text/paperscript" canvas="canvas-5">
448
+ var path = new Path.Star({
449
+ center: view.center,
450
+ points: 5,
451
+ radius1: 20,
452
+ radius2: 40,
453
+ strokeColor: 'black',
454
+ strokeWidth: 8
455
+ });
456
+ path.effects = [
457
+ { type: 'offset', parameters: { distance: 10, join: 'round' } },
458
+ { type: 'outline' }
459
+ ];
460
+ </script>
461
+ <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
462
+ </div>
463
+
464
+
465
+ </div>
466
+
467
+ </div>
468
+ </div>
469
+
470
+
471
+ <div id="previewbounds-matrix" class="member">
472
+ <div class="member-link">
473
+ <a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
474
+ </div>
475
+ <div class="member-description hidden">
476
+
477
+ <div class="member-text">
478
+ <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>
479
+
480
+ <p>Read only.</p>
481
+
482
+
483
+
484
+ <ul class="member-list">
485
+ <h4>Type:</h4>
486
+ <li>
487
+ <a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
488
+ </li>
489
+ </ul>
490
+
491
+
492
+
493
+ </div>
494
+
495
+ </div>
496
+ </div>
497
+
498
+
343
499
  <div id="key" class="member">
344
500
  <div class="member-link">
345
501
  <a name="key" href="#key"><tt><b>key</b></tt></a>
@@ -452,7 +608,7 @@ function onFrame(event) {
452
608
  <div class="button run">Run</div>
453
609
  </div>
454
610
 
455
- <script type="text/paperscript" canvas="canvas-4">
611
+ <script type="text/paperscript" canvas="canvas-6">
456
612
  var path = new Path.Circle({
457
613
  center: [80, 50],
458
614
  radius: 35
@@ -467,7 +623,7 @@ group.addChild(path);
467
623
  // The path can be accessed by name:
468
624
  group.children['example'].fillColor = 'red';
469
625
  </script>
470
- <div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
626
+ <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
471
627
  </div>
472
628
 
473
629
 
@@ -505,7 +661,7 @@ group.children['example'].fillColor = 'red';
505
661
  <div class="button run">Run</div>
506
662
  </div>
507
663
 
508
- <script type="text/paperscript" canvas="canvas-5">
664
+ <script type="text/paperscript" canvas="canvas-7">
509
665
  var circle = new Path.Circle({
510
666
  center: [80, 50],
511
667
  radius: 30
@@ -516,7 +672,7 @@ circle.style = {
516
672
  strokeWidth: 5
517
673
  };
518
674
  </script>
519
- <div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
675
+ <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
520
676
  </div>
521
677
 
522
678
 
@@ -528,7 +684,7 @@ circle.style = {
528
684
  <div class="button run">Run</div>
529
685
  </div>
530
686
 
531
- <script type="text/paperscript" canvas="canvas-6">
687
+ <script type="text/paperscript" canvas="canvas-8">
532
688
  var path = new Path.Circle({
533
689
  center: [50, 50],
534
690
  radius: 30,
@@ -543,7 +699,7 @@ var path2 = new Path.Circle({
543
699
  // Copy the path style of path:
544
700
  path2.style = path.style;
545
701
  </script>
546
- <div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
702
+ <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
547
703
  </div>
548
704
 
549
705
 
@@ -555,7 +711,7 @@ path2.style = path.style;
555
711
  <div class="button run">Run</div>
556
712
  </div>
557
713
 
558
- <script type="text/paperscript" canvas="canvas-7">
714
+ <script type="text/paperscript" canvas="canvas-9">
559
715
  var myStyle = {
560
716
  fillColor: 'red',
561
717
  strokeColor: 'blue',
@@ -574,7 +730,7 @@ var path2 = new Path.Circle({
574
730
  });
575
731
  path2.style = myStyle;
576
732
  </script>
577
- <div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
733
+ <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
578
734
  </div>
579
735
 
580
736
 
@@ -616,7 +772,7 @@ path2.style = myStyle;
616
772
  <div class="button run">Run</div>
617
773
  </div>
618
774
 
619
- <script type="text/paperscript" canvas="canvas-8">
775
+ <script type="text/paperscript" canvas="canvas-10">
620
776
  var unlockedItem = new Path.Circle({
621
777
  center: view.center - [35, 0],
622
778
  radius: 30,
@@ -643,7 +799,7 @@ new PointText({
643
799
  justification: 'center'
644
800
  });
645
801
  </script>
646
- <div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
802
+ <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
647
803
  </div>
648
804
 
649
805
 
@@ -685,7 +841,7 @@ new PointText({
685
841
  <div class="button run">Run</div>
686
842
  </div>
687
843
 
688
- <script type="text/paperscript" canvas="canvas-9">
844
+ <script type="text/paperscript" canvas="canvas-11">
689
845
  var path = new Path.Circle({
690
846
  center: [50, 50],
691
847
  radius: 20,
@@ -695,7 +851,7 @@ var path = new Path.Circle({
695
851
  // Hide the path:
696
852
  path.visible = false;
697
853
  </script>
698
- <div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
854
+ <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
699
855
  </div>
700
856
 
701
857
 
@@ -743,7 +899,7 @@ path.visible = false;
743
899
  <div class="button run">Run</div>
744
900
  </div>
745
901
 
746
- <script type="text/paperscript" canvas="canvas-10">
902
+ <script type="text/paperscript" canvas="canvas-12">
747
903
  // Create a white rectangle in the background
748
904
  // with the same dimensions as the view:
749
905
  var background = new Path.Rectangle(view.bounds);
@@ -764,7 +920,7 @@ var circle2 = new Path.Circle({
764
920
  // Set the blend mode of circle2:
765
921
  circle2.blendMode = 'multiply';
766
922
  </script>
767
- <div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
923
+ <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
768
924
  </div>
769
925
 
770
926
 
@@ -806,7 +962,7 @@ circle2.blendMode = 'multiply';
806
962
  <div class="button run">Run</div>
807
963
  </div>
808
964
 
809
- <script type="text/paperscript" canvas="canvas-11">
965
+ <script type="text/paperscript" canvas="canvas-13">
810
966
  var circle = new Path.Circle({
811
967
  center: [80, 50],
812
968
  radius: 35,
@@ -824,7 +980,7 @@ var circle2 = new Path.Circle({
824
980
  // Make circle2 50% transparent:
825
981
  circle2.opacity = 0.5;
826
982
  </script>
827
- <div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
983
+ <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
828
984
  </div>
829
985
 
830
986
 
@@ -947,14 +1103,14 @@ circle.textWrap = { offset: 10 };</code></pre>
947
1103
  <div class="button run">Run</div>
948
1104
  </div>
949
1105
 
950
- <script type="text/paperscript" canvas="canvas-12">
1106
+ <script type="text/paperscript" canvas="canvas-14">
951
1107
  var path = new Path.Circle({
952
1108
  center: [80, 50],
953
1109
  radius: 35
954
1110
  });
955
1111
  path.selected = true; // Select the path
956
1112
  </script>
957
- <div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
1113
+ <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
958
1114
  </div>
959
1115
 
960
1116
 
@@ -1111,7 +1267,7 @@ console.log(path.data.pets.length); // 1</code></pre>
1111
1267
  <div class="button run">Run</div>
1112
1268
  </div>
1113
1269
 
1114
- <script type="text/paperscript" canvas="canvas-13">
1270
+ <script type="text/paperscript" canvas="canvas-15">
1115
1271
  // Create a circle at position { x: 10, y: 10 }
1116
1272
  var circle = new Path.Circle({
1117
1273
  center: new Point(10, 10),
@@ -1125,7 +1281,7 @@ circle.position = new Point(20, 20);
1125
1281
  // Move the circle 100 points to the right and 50 points down
1126
1282
  circle.position += new Point(100, 50);
1127
1283
  </script>
1128
- <div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
1284
+ <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1129
1285
  </div>
1130
1286
 
1131
1287
 
@@ -1137,7 +1293,7 @@ circle.position += new Point(100, 50);
1137
1293
  <div class="button run">Run</div>
1138
1294
  </div>
1139
1295
 
1140
- <script type="text/paperscript" canvas="canvas-14">
1296
+ <script type="text/paperscript" canvas="canvas-16">
1141
1297
  // Create a circle at position { x: 20, y: 20 }
1142
1298
  var circle = new Path.Circle({
1143
1299
  center: new Point(20, 20),
@@ -1148,7 +1304,7 @@ var circle = new Path.Circle({
1148
1304
  // Move the circle 100 points to the right
1149
1305
  circle.position.x += 100;
1150
1306
  </script>
1151
- <div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
1307
+ <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
1152
1308
  </div>
1153
1309
 
1154
1310
 
@@ -1674,7 +1830,7 @@ console.log(group.children[0] == path); // true</code></pre>
1674
1830
  <div class="button run">Run</div>
1675
1831
  </div>
1676
1832
 
1677
- <script type="text/paperscript" canvas="canvas-15">
1833
+ <script type="text/paperscript" canvas="canvas-17">
1678
1834
  var path = new Path.Circle({
1679
1835
  center: [80, 50],
1680
1836
  radius: 35
@@ -1687,7 +1843,7 @@ group.addChild(path);
1687
1843
  // Access the path through the group's children array:
1688
1844
  group.children[0].fillColor = 'red';
1689
1845
  </script>
1690
- <div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
1846
+ <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
1691
1847
  </div>
1692
1848
 
1693
1849
 
@@ -1699,7 +1855,7 @@ group.children[0].fillColor = 'red';
1699
1855
  <div class="button run">Run</div>
1700
1856
  </div>
1701
1857
 
1702
- <script type="text/paperscript" canvas="canvas-16">
1858
+ <script type="text/paperscript" canvas="canvas-18">
1703
1859
  var path = new Path.Circle({
1704
1860
  center: [80, 50],
1705
1861
  radius: 35
@@ -1714,7 +1870,7 @@ group.addChild(path);
1714
1870
  // The path can be accessed by name:
1715
1871
  group.children['example'].fillColor = 'orange';
1716
1872
  </script>
1717
- <div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
1873
+ <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
1718
1874
  </div>
1719
1875
 
1720
1876
 
@@ -1726,7 +1882,7 @@ group.children['example'].fillColor = 'orange';
1726
1882
  <div class="button run">Run</div>
1727
1883
  </div>
1728
1884
 
1729
- <script type="text/paperscript" canvas="canvas-17">
1885
+ <script type="text/paperscript" canvas="canvas-19">
1730
1886
  var path = new Path.Circle({
1731
1887
  center: [80, 50],
1732
1888
  radius: 35
@@ -1738,7 +1894,7 @@ group.children = [path];
1738
1894
  // The path is the first child of the group:
1739
1895
  group.firstChild.fillColor = 'green';
1740
1896
  </script>
1741
- <div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
1897
+ <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
1742
1898
  </div>
1743
1899
 
1744
1900
 
@@ -1915,7 +2071,7 @@ group.firstChild.fillColor = 'green';
1915
2071
  <div class="button run">Run</div>
1916
2072
  </div>
1917
2073
 
1918
- <script type="text/paperscript" canvas="canvas-18">
2074
+ <script type="text/paperscript" canvas="canvas-20">
1919
2075
  // Create a circle shaped path at { x: 80, y: 50 }
1920
2076
  // with a radius of 35:
1921
2077
  var circle = new Path.Circle({
@@ -1926,7 +2082,7 @@ var circle = new Path.Circle({
1926
2082
  // Set its stroke color to RGB red:
1927
2083
  circle.strokeColor = new Color(1, 0, 0);
1928
2084
  </script>
1929
- <div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
2085
+ <div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
1930
2086
  </div>
1931
2087
 
1932
2088
 
@@ -1963,7 +2119,7 @@ circle.strokeColor = new Color(1, 0, 0);
1963
2119
  <div class="button run">Run</div>
1964
2120
  </div>
1965
2121
 
1966
- <script type="text/paperscript" canvas="canvas-19">
2122
+ <script type="text/paperscript" canvas="canvas-21">
1967
2123
  // Create a circle shaped path at { x: 80, y: 50 }
1968
2124
  // with a radius of 35:
1969
2125
  var circle = new Path.Circle({
@@ -1975,7 +2131,7 @@ var circle = new Path.Circle({
1975
2131
  // Set its stroke width to 10:
1976
2132
  circle.strokeWidth = 10;
1977
2133
  </script>
1978
- <div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
2134
+ <div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
1979
2135
  </div>
1980
2136
 
1981
2137
 
@@ -2022,7 +2178,7 @@ circle.strokeWidth = 10;
2022
2178
  <div class="button run">Run</div>
2023
2179
  </div>
2024
2180
 
2025
- <script type="text/paperscript" canvas="canvas-20">
2181
+ <script type="text/paperscript" canvas="canvas-22">
2026
2182
  var line = new Path({
2027
2183
  segments: [[80, 50], [420, 50]],
2028
2184
  strokeColor: 'black',
@@ -2043,7 +2199,7 @@ var line2 = line.clone();
2043
2199
  line2.position.y += 100;
2044
2200
  line2.strokeCap = 'butt';
2045
2201
  </script>
2046
- <div class="canvas"><canvas width="516" height="200" id="canvas-20"></canvas></div>
2202
+ <div class="canvas"><canvas width="516" height="200" id="canvas-22"></canvas></div>
2047
2203
  </div>
2048
2204
 
2049
2205
 
@@ -2090,7 +2246,7 @@ line2.strokeCap = 'butt';
2090
2246
  <div class="button run">Run</div>
2091
2247
  </div>
2092
2248
 
2093
- <script type="text/paperscript" canvas="canvas-21">
2249
+ <script type="text/paperscript" canvas="canvas-23">
2094
2250
  var path = new Path({
2095
2251
  segments: [[80, 100], [120, 40], [160, 100]],
2096
2252
  strokeColor: 'black',
@@ -2107,7 +2263,7 @@ var path3 = path2.clone();
2107
2263
  path3.position.x += path3.bounds.width * 1.5;
2108
2264
  path3.strokeJoin = 'bevel';
2109
2265
  </script>
2110
- <div class="canvas"><canvas width="516" height="120" id="canvas-21"></canvas></div>
2266
+ <div class="canvas"><canvas width="516" height="120" id="canvas-23"></canvas></div>
2111
2267
  </div>
2112
2268
 
2113
2269
 
@@ -2211,7 +2367,7 @@ path3.strokeJoin = 'bevel';
2211
2367
  <div class="button run">Run</div>
2212
2368
  </div>
2213
2369
 
2214
- <script type="text/paperscript" canvas="canvas-22">
2370
+ <script type="text/paperscript" canvas="canvas-24">
2215
2371
  var path = new Path.Circle({
2216
2372
  center: [80, 50],
2217
2373
  radius: 40,
@@ -2222,7 +2378,7 @@ var path = new Path.Circle({
2222
2378
  // Set the dashed stroke to [10pt dash, 4pt gap]:
2223
2379
  path.dashArray = [10, 4];
2224
2380
  </script>
2225
- <div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
2381
+ <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
2226
2382
  </div>
2227
2383
 
2228
2384
 
@@ -2257,6 +2413,42 @@ path.dashArray = [10, 4];
2257
2413
 
2258
2414
 
2259
2415
 
2416
+ </div>
2417
+
2418
+ </div>
2419
+ </div>
2420
+
2421
+
2422
+ <div id="paintorder" class="member">
2423
+ <div class="member-link">
2424
+ <a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
2425
+ </div>
2426
+ <div class="member-description hidden">
2427
+
2428
+ <div class="member-text">
2429
+ <p>The order in which the fill and the stroke are painted, as in SVG&rsquo;s <code>paint-order</code>, named after what is painted first: <code>&#39;fill&#39;</code> paints the fill first, <code>&#39;stroke&#39;</code> paints the stroke first, so the fill covers its inner half.</p>
2430
+
2431
+
2432
+ <ul class="member-list">
2433
+ <h4>Values:</h4>
2434
+ <li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
2435
+ </ul>
2436
+
2437
+
2438
+ <ul class="member-list">
2439
+ <h4>Default:</h4>
2440
+ <li><tt>'fill'</tt></li>
2441
+ </ul>
2442
+
2443
+ <ul class="member-list">
2444
+ <h4>Type:</h4>
2445
+ <li>
2446
+ <tt>String</tt>
2447
+ </li>
2448
+ </ul>
2449
+
2450
+
2451
+
2260
2452
  </div>
2261
2453
 
2262
2454
  </div>
@@ -2292,7 +2484,7 @@ path.dashArray = [10, 4];
2292
2484
  <div class="button run">Run</div>
2293
2485
  </div>
2294
2486
 
2295
- <script type="text/paperscript" canvas="canvas-23">
2487
+ <script type="text/paperscript" canvas="canvas-25">
2296
2488
  // Create a circle shaped path at { x: 80, y: 50 }
2297
2489
  // with a radius of 35:
2298
2490
  var circle = new Path.Circle({
@@ -2303,7 +2495,7 @@ var circle = new Path.Circle({
2303
2495
  // Set the fill color of the circle to RGB red:
2304
2496
  circle.fillColor = new Color(1, 0, 0);
2305
2497
  </script>
2306
- <div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
2498
+ <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
2307
2499
  </div>
2308
2500
 
2309
2501
 
@@ -2378,7 +2570,7 @@ circle.fillColor = new Color(1, 0, 0);
2378
2570
  <div class="button run">Run</div>
2379
2571
  </div>
2380
2572
 
2381
- <script type="text/paperscript" canvas="canvas-24">
2573
+ <script type="text/paperscript" canvas="canvas-26">
2382
2574
  var circle = new Path.Circle({
2383
2575
  center: [80, 50],
2384
2576
  radius: 35,
@@ -2391,7 +2583,7 @@ var circle = new Path.Circle({
2391
2583
  shadowOffset: new Point(5, 5)
2392
2584
  });
2393
2585
  </script>
2394
- <div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
2586
+ <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
2395
2587
  </div>
2396
2588
 
2397
2589
 
@@ -2532,7 +2724,7 @@ var circle = new Path.Circle({
2532
2724
  <div class="button run">Run</div>
2533
2725
  </div>
2534
2726
 
2535
- <script type="text/paperscript" canvas="canvas-25">
2727
+ <script type="text/paperscript" canvas="canvas-27">
2536
2728
  // Create a rectangle shaped path with its top left point at:
2537
2729
  // {x: 50, y: 25} and a size of {width: 50, height: 50}
2538
2730
  var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
@@ -2543,7 +2735,7 @@ path.onFrame = function(event) {
2543
2735
  this.rotate(3);
2544
2736
  }
2545
2737
  </script>
2546
- <div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
2738
+ <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
2547
2739
  </div>
2548
2740
 
2549
2741
 
@@ -2587,7 +2779,7 @@ path.onFrame = function(event) {
2587
2779
  <div class="button run">Run</div>
2588
2780
  </div>
2589
2781
 
2590
- <script type="text/paperscript" canvas="canvas-26">
2782
+ <script type="text/paperscript" canvas="canvas-28">
2591
2783
  // Create a circle shaped path at the center of the view:
2592
2784
  var path = new Path.Circle({
2593
2785
  center: view.center,
@@ -2601,7 +2793,7 @@ path.onMouseDown = function(event) {
2601
2793
  this.fillColor = 'red';
2602
2794
  }
2603
2795
  </script>
2604
- <div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
2796
+ <div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
2605
2797
  </div>
2606
2798
 
2607
2799
 
@@ -2613,7 +2805,7 @@ path.onMouseDown = function(event) {
2613
2805
  <div class="button run">Run</div>
2614
2806
  </div>
2615
2807
 
2616
- <script type="text/paperscript" canvas="canvas-27">
2808
+ <script type="text/paperscript" canvas="canvas-29">
2617
2809
  // Loop 30 times:
2618
2810
  for (var i = 0; i < 30; i++) {
2619
2811
  // Create a circle shaped path at a random position
@@ -2631,7 +2823,7 @@ for (var i = 0; i < 30; i++) {
2631
2823
  }
2632
2824
  }
2633
2825
  </script>
2634
- <div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
2826
+ <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
2635
2827
  </div>
2636
2828
 
2637
2829
 
@@ -2675,7 +2867,7 @@ for (var i = 0; i < 30; i++) {
2675
2867
  <div class="button run">Run</div>
2676
2868
  </div>
2677
2869
 
2678
- <script type="text/paperscript" canvas="canvas-28">
2870
+ <script type="text/paperscript" canvas="canvas-30">
2679
2871
  // Create a circle shaped path at the center of the view:
2680
2872
  var path = new Path.Circle({
2681
2873
  center: view.center,
@@ -2688,7 +2880,7 @@ path.onMouseDrag = function(event) {
2688
2880
  path.position += event.delta;
2689
2881
  }
2690
2882
  </script>
2691
- <div class="canvas"><canvas width="516" height="240" id="canvas-28"></canvas></div>
2883
+ <div class="canvas"><canvas width="516" height="240" id="canvas-30"></canvas></div>
2692
2884
  </div>
2693
2885
 
2694
2886
 
@@ -2732,7 +2924,7 @@ path.onMouseDrag = function(event) {
2732
2924
  <div class="button run">Run</div>
2733
2925
  </div>
2734
2926
 
2735
- <script type="text/paperscript" canvas="canvas-29">
2927
+ <script type="text/paperscript" canvas="canvas-31">
2736
2928
  // Create a circle shaped path at the center of the view:
2737
2929
  var path = new Path.Circle({
2738
2930
  center: view.center,
@@ -2746,7 +2938,7 @@ path.onMouseUp = function(event) {
2746
2938
  this.fillColor = 'red';
2747
2939
  }
2748
2940
  </script>
2749
- <div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
2941
+ <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
2750
2942
  </div>
2751
2943
 
2752
2944
 
@@ -2790,7 +2982,7 @@ path.onMouseUp = function(event) {
2790
2982
  <div class="button run">Run</div>
2791
2983
  </div>
2792
2984
 
2793
- <script type="text/paperscript" canvas="canvas-30">
2985
+ <script type="text/paperscript" canvas="canvas-32">
2794
2986
  // Create a circle shaped path at the center of the view:
2795
2987
  var path = new Path.Circle({
2796
2988
  center: view.center,
@@ -2804,7 +2996,7 @@ path.onClick = function(event) {
2804
2996
  this.fillColor = 'red';
2805
2997
  }
2806
2998
  </script>
2807
- <div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
2999
+ <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
2808
3000
  </div>
2809
3001
 
2810
3002
 
@@ -2816,7 +3008,7 @@ path.onClick = function(event) {
2816
3008
  <div class="button run">Run</div>
2817
3009
  </div>
2818
3010
 
2819
- <script type="text/paperscript" canvas="canvas-31">
3011
+ <script type="text/paperscript" canvas="canvas-33">
2820
3012
  // Loop 30 times:
2821
3013
  for (var i = 0; i < 30; i++) {
2822
3014
  // Create a circle shaped path at a random position
@@ -2834,7 +3026,7 @@ for (var i = 0; i < 30; i++) {
2834
3026
  }
2835
3027
  }
2836
3028
  </script>
2837
- <div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
3029
+ <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
2838
3030
  </div>
2839
3031
 
2840
3032
 
@@ -2878,7 +3070,7 @@ for (var i = 0; i < 30; i++) {
2878
3070
  <div class="button run">Run</div>
2879
3071
  </div>
2880
3072
 
2881
- <script type="text/paperscript" canvas="canvas-32">
3073
+ <script type="text/paperscript" canvas="canvas-34">
2882
3074
  // Create a circle shaped path at the center of the view:
2883
3075
  var path = new Path.Circle({
2884
3076
  center: view.center,
@@ -2892,7 +3084,7 @@ path.onDoubleClick = function(event) {
2892
3084
  this.fillColor = 'red';
2893
3085
  }
2894
3086
  </script>
2895
- <div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
3087
+ <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
2896
3088
  </div>
2897
3089
 
2898
3090
 
@@ -2904,7 +3096,7 @@ path.onDoubleClick = function(event) {
2904
3096
  <div class="button run">Run</div>
2905
3097
  </div>
2906
3098
 
2907
- <script type="text/paperscript" canvas="canvas-33">
3099
+ <script type="text/paperscript" canvas="canvas-35">
2908
3100
  // Loop 30 times:
2909
3101
  for (var i = 0; i < 30; i++) {
2910
3102
  // Create a circle shaped path at a random position
@@ -2922,7 +3114,7 @@ for (var i = 0; i < 30; i++) {
2922
3114
  }
2923
3115
  }
2924
3116
  </script>
2925
- <div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
3117
+ <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
2926
3118
  </div>
2927
3119
 
2928
3120
 
@@ -2966,7 +3158,7 @@ for (var i = 0; i < 30; i++) {
2966
3158
  <div class="button run">Run</div>
2967
3159
  </div>
2968
3160
 
2969
- <script type="text/paperscript" canvas="canvas-34">
3161
+ <script type="text/paperscript" canvas="canvas-36">
2970
3162
  // Create a circle shaped path at the center of the view:
2971
3163
  var path = new Path.Circle({
2972
3164
  center: view.center,
@@ -2974,180 +3166,567 @@ for (var i = 0; i < 30; i++) {
2974
3166
  fillColor: 'black'
2975
3167
  });
2976
3168
 
2977
- // When the mouse moves on top of the item, set its opacity
2978
- // to a random value between 0 and 1:
2979
- path.onMouseMove = function(event) {
2980
- this.opacity = Math.random();
2981
- }
2982
- </script>
2983
- <div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
2984
- </div>
3169
+ // When the mouse moves on top of the item, set its opacity
3170
+ // to a random value between 0 and 1:
3171
+ path.onMouseMove = function(event) {
3172
+ this.opacity = Math.random();
3173
+ }
3174
+ </script>
3175
+ <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3176
+ </div>
3177
+
3178
+
3179
+ </div>
3180
+
3181
+ </div>
3182
+ </div>
3183
+
3184
+
3185
+ <div id="onmouseenter" class="member">
3186
+ <div class="member-link">
3187
+ <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
3188
+ </div>
3189
+ <div class="member-description hidden">
3190
+
3191
+ <div class="member-text">
3192
+ <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>
3193
+
3194
+
3195
+
3196
+ <ul class="member-list">
3197
+ <h4>Type:</h4>
3198
+ <li>
3199
+ <tt>Function</tt>⟋<tt>null</tt>
3200
+ </li>
3201
+ </ul>
3202
+
3203
+
3204
+ <ul class="member-list">
3205
+ <h4>See also:</h4>
3206
+
3207
+ <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
3208
+
3209
+ </ul>
3210
+
3211
+ <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>
3212
+
3213
+ <div class="paperscript split">
3214
+
3215
+ <div class="buttons">
3216
+ <div class="button run">Run</div>
3217
+ </div>
3218
+
3219
+ <script type="text/paperscript" canvas="canvas-37">
3220
+ // Create a circle shaped path at the center of the view:
3221
+ var path = new Path.Circle({
3222
+ center: view.center,
3223
+ radius: 25,
3224
+ fillColor: 'black'
3225
+ });
3226
+
3227
+ // When the mouse enters the item, set its fill color to red:
3228
+ path.onMouseEnter = function(event) {
3229
+ this.fillColor = 'red';
3230
+ }
3231
+
3232
+ // When the mouse leaves the item, set its fill color to black:
3233
+ path.onMouseLeave = function(event) {
3234
+ this.fillColor = 'black';
3235
+ }
3236
+ </script>
3237
+ <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3238
+ </div>
3239
+
3240
+
3241
+ <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>
3242
+
3243
+ <div class="paperscript split">
3244
+
3245
+ <div class="buttons">
3246
+ <div class="button run">Run</div>
3247
+ </div>
3248
+
3249
+ <script type="text/paperscript" canvas="canvas-38">
3250
+ function enter(event) {
3251
+ this.fillColor = 'red';
3252
+ }
3253
+
3254
+ function leave(event) {
3255
+ this.fillColor = 'black';
3256
+ }
3257
+
3258
+ // When the mouse is pressed:
3259
+ function onMouseDown(event) {
3260
+ // Create a circle shaped path at the position of the mouse:
3261
+ var path = new Path.Circle(event.point, 25);
3262
+ path.fillColor = 'black';
3263
+
3264
+ // When the mouse enters the item, set its fill color to red:
3265
+ path.onMouseEnter = enter;
3266
+
3267
+ // When the mouse leaves the item, set its fill color to black:
3268
+ path.onMouseLeave = leave;
3269
+ }
3270
+ </script>
3271
+ <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
3272
+ </div>
3273
+
3274
+
3275
+ </div>
3276
+
3277
+ </div>
3278
+ </div>
3279
+
3280
+
3281
+ <div id="onmouseleave" class="member">
3282
+ <div class="member-link">
3283
+ <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
3284
+ </div>
3285
+ <div class="member-description hidden">
3286
+
3287
+ <div class="member-text">
3288
+ <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>
3289
+
3290
+
3291
+
3292
+ <ul class="member-list">
3293
+ <h4>Type:</h4>
3294
+ <li>
3295
+ <tt>Function</tt>⟋<tt>null</tt>
3296
+ </li>
3297
+ </ul>
3298
+
3299
+
3300
+ <ul class="member-list">
3301
+ <h4>See also:</h4>
3302
+
3303
+ <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
3304
+
3305
+ </ul>
3306
+
3307
+ <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>
3308
+
3309
+ <div class="paperscript split">
3310
+
3311
+ <div class="buttons">
3312
+ <div class="button run">Run</div>
3313
+ </div>
3314
+
3315
+ <script type="text/paperscript" canvas="canvas-39">
3316
+ // Create a circle shaped path at the center of the view:
3317
+ var path = new Path.Circle({
3318
+ center: view.center,
3319
+ radius: 25,
3320
+ fillColor: 'black'
3321
+ });
3322
+
3323
+ // When the mouse leaves the item, set its fill color to red:
3324
+ path.onMouseLeave = function(event) {
3325
+ this.fillColor = 'red';
3326
+ }
3327
+ </script>
3328
+ <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
3329
+ </div>
3330
+
3331
+
3332
+ </div>
3333
+
3334
+ </div>
3335
+ </div>
3336
+
3337
+
3338
+ <div id="ondraw" class="member">
3339
+ <div class="member-link">
3340
+ <a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
3341
+ </div>
3342
+ <div class="member-description hidden">
3343
+
3344
+ <div class="member-text">
3345
+ <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>
3346
+
3347
+
3348
+
3349
+ <ul class="member-list">
3350
+ <h4>Type:</h4>
3351
+ <li>
3352
+ <tt>Function</tt>⟋<tt>null</tt>
3353
+ </li>
3354
+ </ul>
3355
+ <ul class="member-list">
3356
+ <h4>Options:</h4>
3357
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the item that is drawn</li>
3358
+ <li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> &mdash; the canvas context, transformed into the item&rsquo;s coordinates</li>
3359
+ <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>
3360
+ <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>
3361
+ <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>()
3362
+ 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>
3363
+ </ul>
3364
+
3365
+ <h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
3366
+
3367
+ <div class="paperscript split">
3368
+
3369
+ <div class="buttons">
3370
+ <div class="button run">Run</div>
3371
+ </div>
3372
+
3373
+ <script type="text/paperscript" canvas="canvas-40">
3374
+ var path = new Path.Circle({
3375
+ center: view.center,
3376
+ radius: 25,
3377
+ fillColor: 'rgba(255, 0, 0, 0.5)'
3378
+ });
3379
+
3380
+ path.onDraw = function(event) {
3381
+ var ctx = event.context,
3382
+ center = this.position,
3383
+ scale = event.matrix.scaling.x;
3384
+ ctx.beginPath();
3385
+ ctx.moveTo(center.x - 40, center.y);
3386
+ ctx.lineTo(center.x + 40, center.y);
3387
+ ctx.moveTo(center.x, center.y - 40);
3388
+ ctx.lineTo(center.x, center.y + 40);
3389
+ ctx.lineWidth = 1 / scale;
3390
+ ctx.stroke();
3391
+ }
3392
+ </script>
3393
+ <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
3394
+ </div>
3395
+
3396
+
3397
+ </div>
3398
+
3399
+ </div>
3400
+ </div>
3401
+
3402
+
3403
+ <div id="ondrawselection" class="member">
3404
+ <div class="member-link">
3405
+ <a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
3406
+ </div>
3407
+ <div class="member-description hidden">
3408
+
3409
+ <div class="member-text">
3410
+ <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>
3411
+
3412
+
3413
+
3414
+ <ul class="member-list">
3415
+ <h4>Type:</h4>
3416
+ <li>
3417
+ <tt>Function</tt>⟋<tt>null</tt>
3418
+ </li>
3419
+ </ul>
3420
+ <ul class="member-list">
3421
+ <h4>Options:</h4>
3422
+ <li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> &mdash; the selected item</li>
3423
+ <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>
3424
+ <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>
3425
+ <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>
3426
+ <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>
3427
+ <li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> &mdash; the view drawn into
3428
+ What the handler draws isn&rsquo;t part of the item&rsquo;s hit testing, its bounds or its SVG export.</li>
3429
+ </ul>
3430
+
3431
+ <h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
3432
+
3433
+ <div class="paperscript split">
3434
+
3435
+ <div class="buttons">
3436
+ <div class="button run">Run</div>
3437
+ </div>
3438
+
3439
+ <script type="text/paperscript" canvas="canvas-41">
3440
+ var path = new Path.Star({
3441
+ center: view.center,
3442
+ points: 5,
3443
+ radius1: 20,
3444
+ radius2: 40,
3445
+ strokeColor: 'black',
3446
+ selected: true
3447
+ });
3448
+
3449
+ path.onDrawSelection = function(event) {
3450
+ var ctx = event.context;
3451
+ this.segments.forEach(function(segment) {
3452
+ var point = event.matrix.transform(segment.point);
3453
+ ctx.beginPath();
3454
+ ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
3455
+ ctx.fill();
3456
+ });
3457
+ return false;
3458
+ }
3459
+ </script>
3460
+ <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
3461
+ </div>
3462
+
3463
+
3464
+ </div>
3465
+
3466
+ </div>
3467
+ </div>
3468
+
3469
+ </div>
3470
+
3471
+
3472
+ <!-- =========================== inherited methods ========================= -->
3473
+ <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3474
+
3475
+
3476
+ <div id="addeffect-effect" class="member">
3477
+ <div class="member-link">
3478
+ <a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
3479
+ </div>
3480
+ <div class="member-description hidden">
3481
+ <div class="member-text">
3482
+ <p>Adds an effect at the end of the item&rsquo;s effects.</p>
3483
+
3484
+
3485
+ <ul class="member-list">
3486
+ <h4>Parameters:</h4>
3487
+
3488
+ <li>
3489
+ <tt>effect:</tt>
3490
+ <tt>Object</tt>
3491
+ &mdash;&nbsp;the plain object describing the effect
3492
+
3493
+ </li>
3494
+
3495
+ </ul>
3496
+
3497
+
3498
+ <ul class="member-list">
3499
+ <h4>Returns:</h4>
3500
+
3501
+ <li>
3502
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the added instance
3503
+ </li>
3504
+
3505
+
3506
+ </ul>
3507
+
3508
+
3509
+
3510
+
3511
+
3512
+ </div>
3513
+ </div>
3514
+ </div>
3515
+
3516
+
3517
+ <div id="inserteffect-index-effect" class="member">
3518
+ <div class="member-link">
3519
+ <a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
3520
+ </div>
3521
+ <div class="member-description hidden">
3522
+ <div class="member-text">
3523
+ <p>Inserts an effect into the item&rsquo;s effects at the given index.</p>
3524
+
3525
+
3526
+ <ul class="member-list">
3527
+ <h4>Parameters:</h4>
3528
+
3529
+ <li>
3530
+ <tt>index:</tt>
3531
+ <tt>Number</tt>
3532
+ &mdash;&nbsp;the index at which to insert the effect
3533
+
3534
+ </li>
3535
+
3536
+ <li>
3537
+ <tt>effect:</tt>
3538
+ <tt>Object</tt>
3539
+ &mdash;&nbsp;the plain object describing the effect
3540
+
3541
+ </li>
3542
+
3543
+ </ul>
3544
+
3545
+
3546
+ <ul class="member-list">
3547
+ <h4>Returns:</h4>
3548
+
3549
+ <li>
3550
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the inserted instance
3551
+ </li>
3552
+
3553
+
3554
+ </ul>
3555
+
3556
+
3557
+
3558
+
3559
+
3560
+ </div>
3561
+ </div>
3562
+ </div>
3563
+
3564
+
3565
+ <div id="inserteffects-index-effects" class="member">
3566
+ <div class="member-link">
3567
+ <a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
3568
+ </div>
3569
+ <div class="member-description hidden">
3570
+ <div class="member-text">
3571
+ <p>Inserts effects into the item&rsquo;s effects at the given index.</p>
3572
+
3573
+
3574
+ <ul class="member-list">
3575
+ <h4>Parameters:</h4>
3576
+
3577
+ <li>
3578
+ <tt>index:</tt>
3579
+ <tt>Number</tt>
3580
+ &mdash;&nbsp;the index at which to insert the effects
3581
+
3582
+ </li>
3583
+
3584
+ <li>
3585
+ <tt>effects:</tt>
3586
+ Array of <tt>Object</tt> objects
3587
+ &mdash;&nbsp;the plain objects describing the effects
3588
+
3589
+ </li>
3590
+
3591
+ </ul>
3592
+
3593
+
3594
+ <ul class="member-list">
3595
+ <h4>Returns:</h4>
3596
+
3597
+ <li>
3598
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the inserted instances
3599
+ </li>
3600
+
3601
+
3602
+ </ul>
2985
3603
 
2986
3604
 
2987
- </div>
2988
3605
 
3606
+
3607
+
3608
+ </div>
2989
3609
  </div>
2990
3610
  </div>
2991
3611
 
2992
3612
 
2993
- <div id="onmouseenter" class="member">
3613
+ <div id="removeeffect-index" class="member">
2994
3614
  <div class="member-link">
2995
- <a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
3615
+ <a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
2996
3616
  </div>
2997
3617
  <div class="member-description hidden">
2998
-
2999
3618
  <div class="member-text">
3000
- <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>
3619
+ <p>Removes the effect at the given index from the item&rsquo;s effects.</p>
3620
+
3001
3621
 
3622
+ <ul class="member-list">
3623
+ <h4>Parameters:</h4>
3002
3624
 
3625
+ <li>
3626
+ <tt>index:</tt>
3627
+ <tt>Number</tt>
3628
+ &mdash;&nbsp;the index of the effect to remove
3629
+
3630
+ </li>
3003
3631
 
3004
- <ul class="member-list">
3005
- <h4>Type:</h4>
3006
- <li>
3007
- <tt>Function</tt>⟋<tt>null</tt>
3008
- </li>
3009
- </ul>
3010
-
3632
+ </ul>
3633
+
3011
3634
 
3012
3635
  <ul class="member-list">
3013
- <h4>See also:</h4>
3636
+ <h4>Returns:</h4>
3014
3637
 
3015
- <li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
3638
+ <li>
3639
+ <tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt>&nbsp;&mdash;&nbsp;the removed instance, or <code>null</code>
3640
+ </li>
3641
+
3016
3642
 
3017
3643
  </ul>
3018
3644
 
3019
- <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>
3020
3645
 
3021
- <div class="paperscript split">
3022
3646
 
3023
- <div class="buttons">
3024
- <div class="button run">Run</div>
3647
+
3648
+
3025
3649
  </div>
3026
-
3027
- <script type="text/paperscript" canvas="canvas-35">
3028
- // Create a circle shaped path at the center of the view:
3029
- var path = new Path.Circle({
3030
- center: view.center,
3031
- radius: 25,
3032
- fillColor: 'black'
3033
- });
3034
-
3035
- // When the mouse enters the item, set its fill color to red:
3036
- path.onMouseEnter = function(event) {
3037
- this.fillColor = 'red';
3038
- }
3039
-
3040
- // When the mouse leaves the item, set its fill color to black:
3041
- path.onMouseLeave = function(event) {
3042
- this.fillColor = 'black';
3043
- }
3044
- </script>
3045
- <div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
3046
3650
  </div>
3047
-
3048
-
3049
- <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>
3050
-
3051
- <div class="paperscript split">
3052
-
3053
- <div class="buttons">
3054
- <div class="button run">Run</div>
3055
3651
  </div>
3056
3652
 
3057
- <script type="text/paperscript" canvas="canvas-36">
3058
- function enter(event) {
3059
- this.fillColor = 'red';
3060
- }
3061
-
3062
- function leave(event) {
3063
- this.fillColor = 'black';
3064
- }
3653
+
3654
+ <div id="removeeffects" class="member">
3655
+ <div class="member-link">
3656
+ <a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
3657
+ </div>
3658
+ <div class="member-description hidden">
3659
+ <div class="member-text">
3660
+ <p>Removes the effects from the start index to the end index from the item&rsquo;s effects, or all of them.</p>
3661
+
3662
+
3663
+ <ul class="member-list">
3664
+ <h4>Parameters:</h4>
3665
+
3666
+ <li>
3667
+ <tt>start:</tt>
3668
+ <tt>Number</tt>
3669
+ &mdash;&nbsp;the index of the first effect to remove
3670
+ &mdash;&nbsp;optional, default: <tt>0</tt>
3671
+ </li>
3672
+
3673
+ <li>
3674
+ <tt>end:</tt>
3675
+ <tt>Number</tt>
3676
+ &mdash;&nbsp;the index after the last one
3677
+ &mdash;&nbsp;optional, default: <tt>effects.length</tt>
3678
+ </li>
3679
+
3680
+ </ul>
3065
3681
 
3066
- // When the mouse is pressed:
3067
- function onMouseDown(event) {
3068
- // Create a circle shaped path at the position of the mouse:
3069
- var path = new Path.Circle(event.point, 25);
3070
- path.fillColor = 'black';
3682
+
3683
+ <ul class="member-list">
3684
+ <h4>Returns:</h4>
3685
+
3686
+ <li>
3687
+ <tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt>&nbsp;&mdash;&nbsp;the removed instances
3688
+ </li>
3071
3689
 
3072
- // When the mouse enters the item, set its fill color to red:
3073
- path.onMouseEnter = enter;
3690
+
3691
+ </ul>
3074
3692
 
3075
- // When the mouse leaves the item, set its fill color to black:
3076
- path.onMouseLeave = leave;
3077
- }
3078
- </script>
3079
- <div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
3080
- </div>
3081
3693
 
3082
3694
 
3695
+
3696
+
3083
3697
  </div>
3084
-
3085
3698
  </div>
3086
3699
  </div>
3087
3700
 
3088
3701
 
3089
- <div id="onmouseleave" class="member">
3702
+ <div id="geteffectoutput" class="member">
3090
3703
  <div class="member-link">
3091
- <a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
3704
+ <a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
3092
3705
  </div>
3093
3706
  <div class="member-description hidden">
3094
-
3095
3707
  <div class="member-text">
3096
- <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>
3097
-
3098
-
3099
-
3100
- <ul class="member-list">
3101
- <h4>Type:</h4>
3102
- <li>
3103
- <tt>Function</tt>⟋<tt>null</tt>
3104
- </li>
3105
- </ul>
3708
+ <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>
3106
3709
 
3107
3710
 
3711
+
3108
3712
  <ul class="member-list">
3109
- <h4>See also:</h4>
3713
+ <h4>Returns:</h4>
3110
3714
 
3111
- <li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
3715
+ <li>
3716
+ <tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt>&nbsp;&mdash;&nbsp;the output of the effects
3717
+ </li>
3718
+
3112
3719
 
3113
3720
  </ul>
3114
3721
 
3115
- <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>
3116
-
3117
- <div class="paperscript split">
3118
-
3119
- <div class="buttons">
3120
- <div class="button run">Run</div>
3121
- </div>
3122
-
3123
- <script type="text/paperscript" canvas="canvas-37">
3124
- // Create a circle shaped path at the center of the view:
3125
- var path = new Path.Circle({
3126
- center: view.center,
3127
- radius: 25,
3128
- fillColor: 'black'
3129
- });
3130
-
3131
- // When the mouse leaves the item, set its fill color to red:
3132
- path.onMouseLeave = function(event) {
3133
- this.fillColor = 'red';
3134
- }
3135
- </script>
3136
- <div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
3137
- </div>
3138
-
3139
3722
 
3140
- </div>
3141
3723
 
3724
+
3725
+
3142
3726
  </div>
3143
3727
  </div>
3144
-
3145
3728
  </div>
3146
3729
 
3147
-
3148
- <!-- =========================== inherited methods ========================= -->
3149
- <div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
3150
-
3151
3730
 
3152
3731
  <div id="set-props" class="member">
3153
3732
  <div class="member-link">
@@ -3192,7 +3771,7 @@ path.onMouseLeave = function(event) {
3192
3771
  <div class="button run">Run</div>
3193
3772
  </div>
3194
3773
 
3195
- <script type="text/paperscript" canvas="canvas-38">
3774
+ <script type="text/paperscript" canvas="canvas-42">
3196
3775
  var circle = new Path.Circle({
3197
3776
  center: [80, 50],
3198
3777
  radius: 35
@@ -3205,7 +3784,7 @@ circle.set({
3205
3784
  selected: true
3206
3785
  });
3207
3786
  </script>
3208
- <div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
3787
+ <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
3209
3788
  </div>
3210
3789
 
3211
3790
 
@@ -3261,7 +3840,7 @@ circle.set({
3261
3840
  <div class="button run">Run</div>
3262
3841
  </div>
3263
3842
 
3264
- <script type="text/paperscript" canvas="canvas-39">
3843
+ <script type="text/paperscript" canvas="canvas-43">
3265
3844
  var circle = new Path.Circle({
3266
3845
  center: [50, 50],
3267
3846
  radius: 10,
@@ -3276,7 +3855,7 @@ for (var i = 0; i < 20; i++) {
3276
3855
  copy.position.x += i * copy.bounds.width;
3277
3856
  }
3278
3857
  </script>
3279
- <div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
3858
+ <div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
3280
3859
  </div>
3281
3860
 
3282
3861
 
@@ -3402,7 +3981,7 @@ for (var i = 0; i < 20; i++) {
3402
3981
  <div class="button run">Run</div>
3403
3982
  </div>
3404
3983
 
3405
- <script type="text/paperscript" canvas="canvas-40">
3984
+ <script type="text/paperscript" canvas="canvas-44">
3406
3985
  var circle = new Path.Circle({
3407
3986
  center: [50, 50],
3408
3987
  radius: 5,
@@ -3419,7 +3998,7 @@ raster.position.x += 100;
3419
3998
  circle.scale(5);
3420
3999
  raster.scale(5);
3421
4000
  </script>
3422
- <div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
4001
+ <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
3423
4002
  </div>
3424
4003
 
3425
4004
 
@@ -3473,7 +4052,7 @@ raster.scale(5);
3473
4052
  <div class="button run">Run</div>
3474
4053
  </div>
3475
4054
 
3476
- <script type="text/paperscript" canvas="canvas-41">
4055
+ <script type="text/paperscript" canvas="canvas-45">
3477
4056
  var path = new Path.Star({
3478
4057
  center: [50, 50],
3479
4058
  points: 12,
@@ -3494,7 +4073,7 @@ function onMouseDown(event) {
3494
4073
  }
3495
4074
  }
3496
4075
  </script>
3497
- <div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
4076
+ <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
3498
4077
  </div>
3499
4078
 
3500
4079
 
@@ -4012,11 +4591,17 @@ function onMouseDown(event) {
4012
4591
  </div>
4013
4592
  <div class="member-description hidden">
4014
4593
  <div class="member-text">
4015
- <p>Exports the item with its content and child items as an SVG DOM.</p>
4594
+ <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>
4016
4595
  <ul class="member-list">
4017
4596
  <h4>Options:</h4>
4018
- <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>
4019
- <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>
4597
+ <li>[options.bounds] {String|Rectangle} the bounds of the area to
4598
+ export, either as a string ({@values 'view', content'}), or a
4599
+ {@link Rectangle} object: `'view'` uses the view bounds,
4600
+ `'content'` uses the stroke bounds of the item</li>
4601
+ <li>[options.matrix] {Matrix} the matrix with which to transform the
4602
+ exported content: If `options.bounds` is set to `'view'`,
4603
+ `paper.view.matrix` is used, for all other settings of
4604
+ `options.bounds` the identity matrix is used.</li>
4020
4605
  <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>
4021
4606
  <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>
4022
4607
  <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>
@@ -4024,6 +4609,12 @@ function onMouseDown(event) {
4024
4609
  <li><tt>options.reuseImages: <tt>Boolean</tt></tt> &mdash; whether raster images with the same content should only be exported once into the <code>&lt;defs&gt;</code> element, and placed through <code>&lt;use&gt;</code> elements referencing it &mdash;&nbsp;default: <tt>false</tt></li>
4025
4610
  <li><tt>options.idPrefix: <tt>String</tt></tt> &mdash; a prefix for the ids generated for definitions such as gradients, clip paths and symbols, to keep them unique when several exported SVGs are placed in one document &mdash;&nbsp;default: <tt>&rsquo;&rsquo;</tt></li>
4026
4611
  <li><tt>options.reduceAttributes: <tt>Boolean</tt></tt> &mdash; wether to only include style attributes in the SVG output that differ from their parents, or to always include them (much faster but leading to redundancies). &mdash;&nbsp;default: <tt>true</tt></li>
4612
+ <li>[options.processNode] {Function} the function to process the
4613
+ SVG node made for each exported item, receiving an object with the
4614
+ `item` and its `node`: It can change the node, e.g. to add attributes
4615
+ that Paper.js doesn't export, or return a node to replace it with. It
4616
+ is called before the item's name, style, visibility and data are set
4617
+ on the node, which replace attributes of the same names.</li>
4027
4618
  </ul>
4028
4619
 
4029
4620
  <ul class="member-list">
@@ -4066,6 +4657,7 @@ function onMouseDown(event) {
4066
4657
  <div class="member-text">
4067
4658
  <p>Converts the provided SVG content into Paper.js items and adds them to the this item&rsquo;s children list. Note that the item is not cleared first. You can call <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>() to do so.</p>
4068
4659
  <p><code>&lt;symbol&gt;</code> elements are imported as <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> items, and the <code>&lt;use&gt;</code> elements that place them as <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> items. The styles that <code>&lt;use&gt;</code> elements inherit don&rsquo;t reach the symbols&rsquo; content.</p>
4660
+ <p>The layers in SVG content that Paper.js exported come back as <a href="../classes/Layer.html"><tt>Layer</tt></a> items inside the imported group. To make the layers of a project&rsquo;s SVG the layers of a project again, add them to it with <code>item.children.slice().forEach(project.addLayer, project)</code>.</p>
4069
4661
  <p>URLs are fetched as they are, so validate URLs that come from untrusted sources first, especially on servers, where they could reach internal addresses.</p>
4070
4662
  <ul class="member-list">
4071
4663
  <h4>Options:</h4>
@@ -4077,6 +4669,13 @@ function onMouseDown(event) {
4077
4669
  <li><tt>options.onError: <tt>Function</tt></tt> &mdash; the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
4078
4670
  <li><tt>options.insert: <tt>Boolean</tt></tt> &mdash; whether the imported items should be added to the item that <code>importSVG()</code> is called on &mdash;&nbsp;default: <tt>true</tt></li>
4079
4671
  <li><tt>options.applyMatrix: <tt>Boolean</tt></tt> &mdash; whether the imported items should have their transformation matrices applied to their contents or not &mdash;&nbsp;default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.applyMatrix</tt></li>
4672
+ <li>[options.processItem] {Function} the function to process the
4673
+ item made for each imported SVG element, receiving an object with
4674
+ the `item` and its `node`: It can read attributes that Paper.js
4675
+ doesn't import, or return an item to replace it with. It is called
4676
+ after the element's attributes and data are applied to the item, so
4677
+ it can extend `item.data`. A replacement item doesn't receive them:
4678
+ copy them over from `item` as needed.</li>
4080
4679
  </ul>
4081
4680
 
4082
4681
  <ul class="member-list">
@@ -5356,7 +5955,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
5356
5955
  <div class="button run">Run</div>
5357
5956
  </div>
5358
5957
 
5359
- <script type="text/paperscript" canvas="canvas-42">
5958
+ <script type="text/paperscript" canvas="canvas-46">
5360
5959
  // Create a rectangle shaped path with its top left
5361
5960
  // point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
5362
5961
  var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
@@ -5365,7 +5964,7 @@ path.fillColor = 'black';
5365
5964
  // Rotate the path by 30 degrees:
5366
5965
  path.rotate(30);
5367
5966
  </script>
5368
- <div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
5967
+ <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
5369
5968
  </div>
5370
5969
 
5371
5970
 
@@ -5377,7 +5976,7 @@ path.rotate(30);
5377
5976
  <div class="button run">Run</div>
5378
5977
  </div>
5379
5978
 
5380
- <script type="text/paperscript" canvas="canvas-43">
5979
+ <script type="text/paperscript" canvas="canvas-47">
5381
5980
  // Create a rectangle shaped path with its top left
5382
5981
  // point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
5383
5982
  var topLeft = new Point(175, 50);
@@ -5399,7 +5998,7 @@ function onFrame(event) {
5399
5998
  path.rotate(3, view.center);
5400
5999
  }
5401
6000
  </script>
5402
- <div class="canvas"><canvas width="516" height="200" id="canvas-43"></canvas></div>
6001
+ <div class="canvas"><canvas width="516" height="200" id="canvas-47"></canvas></div>
5403
6002
  </div>
5404
6003
 
5405
6004
 
@@ -5448,7 +6047,7 @@ function onFrame(event) {
5448
6047
  <div class="button run">Run</div>
5449
6048
  </div>
5450
6049
 
5451
- <script type="text/paperscript" canvas="canvas-44">
6050
+ <script type="text/paperscript" canvas="canvas-48">
5452
6051
  // Create a circle shaped path at { x: 80, y: 50 }
5453
6052
  // with a radius of 20:
5454
6053
  var circle = new Path.Circle({
@@ -5460,7 +6059,7 @@ var circle = new Path.Circle({
5460
6059
  // Scale the path by 150% from its center point
5461
6060
  circle.scale(1.5);
5462
6061
  </script>
5463
- <div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
6062
+ <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
5464
6063
  </div>
5465
6064
 
5466
6065
 
@@ -5472,7 +6071,7 @@ circle.scale(1.5);
5472
6071
  <div class="button run">Run</div>
5473
6072
  </div>
5474
6073
 
5475
- <script type="text/paperscript" canvas="canvas-45">
6074
+ <script type="text/paperscript" canvas="canvas-49">
5476
6075
  // Create a circle shaped path at { x: 80, y: 50 }
5477
6076
  // with a radius of 20:
5478
6077
  var circle = new Path.Circle({
@@ -5484,7 +6083,7 @@ var circle = new Path.Circle({
5484
6083
  // Scale the path 150% from its bottom left corner
5485
6084
  circle.scale(1.5, circle.bounds.bottomLeft);
5486
6085
  </script>
5487
- <div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
6086
+ <div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
5488
6087
  </div>
5489
6088
 
5490
6089
 
@@ -5540,7 +6139,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
5540
6139
  <div class="button run">Run</div>
5541
6140
  </div>
5542
6141
 
5543
- <script type="text/paperscript" canvas="canvas-46">
6142
+ <script type="text/paperscript" canvas="canvas-50">
5544
6143
  // Create a circle shaped path at { x: 100, y: 50 }
5545
6144
  // with a radius of 20:
5546
6145
  var circle = new Path.Circle({
@@ -5552,7 +6151,7 @@ var circle = new Path.Circle({
5552
6151
  // Scale the path horizontally by 300%
5553
6152
  circle.scale(3, 1);
5554
6153
  </script>
5555
- <div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
6154
+ <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
5556
6155
  </div>
5557
6156
 
5558
6157
 
@@ -5990,7 +6589,7 @@ circle.scale(3, 1);
5990
6589
  <div class="button run">Run</div>
5991
6590
  </div>
5992
6591
 
5993
- <script type="text/paperscript" canvas="canvas-47">
6592
+ <script type="text/paperscript" canvas="canvas-51">
5994
6593
  // Create a rectangle shaped path with its top left corner
5995
6594
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
5996
6595
  var path = new Path.Rectangle({
@@ -6011,7 +6610,7 @@ var circlePath = new Path.Circle({
6011
6610
  // the rectangular path:
6012
6611
  circlePath.fitBounds(path.bounds);
6013
6612
  </script>
6014
- <div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
6613
+ <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
6015
6614
  </div>
6016
6615
 
6017
6616
 
@@ -6023,7 +6622,7 @@ circlePath.fitBounds(path.bounds);
6023
6622
  <div class="button run">Run</div>
6024
6623
  </div>
6025
6624
 
6026
- <script type="text/paperscript" canvas="canvas-48">
6625
+ <script type="text/paperscript" canvas="canvas-52">
6027
6626
  // Create a rectangle shaped path with its top left corner
6028
6627
  // at {x: 80, y: 25} and a size of {width: 75, height: 50}:
6029
6628
  var path = new Path.Rectangle({
@@ -6044,7 +6643,7 @@ var circlePath = new Path.Circle({
6044
6643
  // the rectangular path:
6045
6644
  circlePath.fitBounds(path.bounds, 'cover');
6046
6645
  </script>
6047
- <div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
6646
+ <div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
6048
6647
  </div>
6049
6648
 
6050
6649
 
@@ -6056,7 +6655,7 @@ circlePath.fitBounds(path.bounds, 'cover');
6056
6655
  <div class="button run">Run</div>
6057
6656
  </div>
6058
6657
 
6059
- <script type="text/paperscript" canvas="canvas-49">
6658
+ <script type="text/paperscript" canvas="canvas-53">
6060
6659
  var path = new Path.Circle({
6061
6660
  center: [80, 50],
6062
6661
  radius: 30,
@@ -6066,7 +6665,7 @@ var path = new Path.Circle({
6066
6665
  // Fit the path to the bounding rectangle of the view:
6067
6666
  path.fitBounds(view.bounds);
6068
6667
  </script>
6069
- <div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
6668
+ <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
6070
6669
  </div>
6071
6670
 
6072
6671
 
@@ -6092,7 +6691,7 @@ path.fitBounds(view.bounds);
6092
6691
  <li>
6093
6692
  <tt>type:</tt>
6094
6693
  <tt>String</tt>
6095
- &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>
6694
+ &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>
6096
6695
 
6097
6696
  </li>
6098
6697
 
@@ -6127,7 +6726,7 @@ path.fitBounds(view.bounds);
6127
6726
  <div class="button run">Run</div>
6128
6727
  </div>
6129
6728
 
6130
- <script type="text/paperscript" canvas="canvas-50">
6729
+ <script type="text/paperscript" canvas="canvas-54">
6131
6730
  // Create a circle shaped path at the center of the view:
6132
6731
  var path = new Path.Circle({
6133
6732
  center: view.center,
@@ -6145,7 +6744,7 @@ path.on('mouseleave', function() {
6145
6744
  this.fillColor = 'black';
6146
6745
  });
6147
6746
  </script>
6148
- <div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
6747
+ <div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
6149
6748
  </div>
6150
6749
 
6151
6750
 
@@ -6169,7 +6768,7 @@ path.on('mouseleave', function() {
6169
6768
  <li>
6170
6769
  <tt>object:</tt>
6171
6770
  <tt>Object</tt>
6172
- &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>
6771
+ &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>
6173
6772
 
6174
6773
  </li>
6175
6774
 
@@ -6197,7 +6796,7 @@ path.on('mouseleave', function() {
6197
6796
  <div class="button run">Run</div>
6198
6797
  </div>
6199
6798
 
6200
- <script type="text/paperscript" canvas="canvas-51">
6799
+ <script type="text/paperscript" canvas="canvas-55">
6201
6800
  // Create a circle shaped path at the center of the view:
6202
6801
  var path = new Path.Circle({
6203
6802
  center: view.center,
@@ -6215,7 +6814,7 @@ path.on({
6215
6814
  }
6216
6815
  });
6217
6816
  </script>
6218
- <div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
6817
+ <div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
6219
6818
  </div>
6220
6819
 
6221
6820
 
@@ -6227,7 +6826,7 @@ path.on({
6227
6826
  <div class="button run">Run</div>
6228
6827
  </div>
6229
6828
 
6230
- <script type="text/paperscript" canvas="canvas-52">
6829
+ <script type="text/paperscript" canvas="canvas-56">
6231
6830
  var pathHandlers = {
6232
6831
  mouseenter: function(event) {
6233
6832
  this.fillColor = 'red';
@@ -6250,7 +6849,7 @@ function onMouseDown(event) {
6250
6849
  path.on(pathHandlers);
6251
6850
  }
6252
6851
  </script>
6253
- <div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
6852
+ <div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
6254
6853
  </div>
6255
6854
 
6256
6855
 
@@ -6274,7 +6873,7 @@ function onMouseDown(event) {
6274
6873
  <li>
6275
6874
  <tt>type:</tt>
6276
6875
  <tt>String</tt>
6277
- &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>
6876
+ &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>
6278
6877
 
6279
6878
  </li>
6280
6879
 
@@ -6322,7 +6921,7 @@ function onMouseDown(event) {
6322
6921
  <li>
6323
6922
  <tt>object:</tt>
6324
6923
  <tt>Object</tt>
6325
- &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>
6924
+ &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>
6326
6925
 
6327
6926
  </li>
6328
6927
 
@@ -6363,7 +6962,7 @@ function onMouseDown(event) {
6363
6962
  <li>
6364
6963
  <tt>type:</tt>
6365
6964
  <tt>String</tt>
6366
- &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>
6965
+ &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>
6367
6966
 
6368
6967
  </li>
6369
6968
 
@@ -6411,7 +7010,7 @@ function onMouseDown(event) {
6411
7010
  <li>
6412
7011
  <tt>type:</tt>
6413
7012
  <tt>String</tt>
6414
- &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>
7013
+ &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>
6415
7014
 
6416
7015
  </li>
6417
7016
 
@@ -6478,7 +7077,7 @@ function onMouseDown(event) {
6478
7077
  <div class="button run">Run</div>
6479
7078
  </div>
6480
7079
 
6481
- <script type="text/paperscript" canvas="canvas-53">
7080
+ <script type="text/paperscript" canvas="canvas-57">
6482
7081
  function onMouseDrag(event) {
6483
7082
  // Create a circle shaped path at the mouse position,
6484
7083
  // with a radius of 10:
@@ -6495,7 +7094,7 @@ function onMouseDrag(event) {
6495
7094
  });
6496
7095
  }
6497
7096
  </script>
6498
- <div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
7097
+ <div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
6499
7098
  </div>
6500
7099
 
6501
7100
 
@@ -6525,7 +7124,7 @@ function onMouseDrag(event) {
6525
7124
  <div class="button run">Run</div>
6526
7125
  </div>
6527
7126
 
6528
- <script type="text/paperscript" canvas="canvas-54">
7127
+ <script type="text/paperscript" canvas="canvas-58">
6529
7128
  function onMouseMove(event) {
6530
7129
  // Create a circle shaped path at the mouse position,
6531
7130
  // with a radius of 10:
@@ -6539,7 +7138,7 @@ function onMouseMove(event) {
6539
7138
  path.removeOnMove();
6540
7139
  }
6541
7140
  </script>
6542
- <div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
7141
+ <div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
6543
7142
  </div>
6544
7143
 
6545
7144
 
@@ -6569,7 +7168,7 @@ function onMouseMove(event) {
6569
7168
  <div class="button run">Run</div>
6570
7169
  </div>
6571
7170
 
6572
- <script type="text/paperscript" canvas="canvas-55">
7171
+ <script type="text/paperscript" canvas="canvas-59">
6573
7172
  function onMouseDown(event) {
6574
7173
  // Create a circle shaped path at the mouse position,
6575
7174
  // with a radius of 10:
@@ -6583,7 +7182,7 @@ function onMouseDown(event) {
6583
7182
  path.removeOnDown();
6584
7183
  }
6585
7184
  </script>
6586
- <div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
7185
+ <div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
6587
7186
  </div>
6588
7187
 
6589
7188
 
@@ -6613,7 +7212,7 @@ function onMouseDown(event) {
6613
7212
  <div class="button run">Run</div>
6614
7213
  </div>
6615
7214
 
6616
- <script type="text/paperscript" canvas="canvas-56">
7215
+ <script type="text/paperscript" canvas="canvas-60">
6617
7216
  function onMouseDrag(event) {
6618
7217
  // Create a circle shaped path at the mouse position,
6619
7218
  // with a radius of 10:
@@ -6627,7 +7226,7 @@ function onMouseDrag(event) {
6627
7226
  path.removeOnDrag();
6628
7227
  }
6629
7228
  </script>
6630
- <div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
7229
+ <div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
6631
7230
  </div>
6632
7231
 
6633
7232
 
@@ -6657,7 +7256,7 @@ function onMouseDrag(event) {
6657
7256
  <div class="button run">Run</div>
6658
7257
  </div>
6659
7258
 
6660
- <script type="text/paperscript" canvas="canvas-57">
7259
+ <script type="text/paperscript" canvas="canvas-61">
6661
7260
  function onMouseDown(event) {
6662
7261
  // Create a circle shaped path at the mouse position,
6663
7262
  // with a radius of 10:
@@ -6671,7 +7270,7 @@ function onMouseDown(event) {
6671
7270
  path.removeOnUp();
6672
7271
  }
6673
7272
  </script>
6674
- <div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
7273
+ <div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
6675
7274
  </div>
6676
7275
 
6677
7276
 
@@ -6744,7 +7343,7 @@ function onMouseDown(event) {
6744
7343
  <div class="button run">Run</div>
6745
7344
  </div>
6746
7345
 
6747
- <script type="text/paperscript" canvas="canvas-58">
7346
+ <script type="text/paperscript" canvas="canvas-62">
6748
7347
  var path = new Path.Circle({
6749
7348
  radius: view.bounds.height * 0.4,
6750
7349
  center: view.center
@@ -6755,7 +7354,7 @@ path.tween(
6755
7354
  3000
6756
7355
  );
6757
7356
  </script>
6758
- <div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
7357
+ <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
6759
7358
  </div>
6760
7359
 
6761
7360
 
@@ -6767,7 +7366,7 @@ path.tween(
6767
7366
  <div class="button run">Run</div>
6768
7367
  </div>
6769
7368
 
6770
- <script type="text/paperscript" canvas="canvas-59">
7369
+ <script type="text/paperscript" canvas="canvas-63">
6771
7370
  var path = new Shape.Rectangle({
6772
7371
  fillColor: 'red',
6773
7372
  center: [50, view.center.y],
@@ -6782,7 +7381,7 @@ path.tween({
6782
7381
  duration: 2000
6783
7382
  });
6784
7383
  </script>
6785
- <div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
7384
+ <div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
6786
7385
  </div>
6787
7386
 
6788
7387
 
@@ -6848,7 +7447,7 @@ path.tween({
6848
7447
  <div class="button run">Run</div>
6849
7448
  </div>
6850
7449
 
6851
- <script type="text/paperscript" canvas="canvas-60">
7450
+ <script type="text/paperscript" canvas="canvas-64">
6852
7451
  var path = new Path.Rectangle({
6853
7452
  size: [100, 100],
6854
7453
  position: view.center,
@@ -6862,7 +7461,7 @@ path.tween({
6862
7461
  'segments[2].point.x': '-= 50'
6863
7462
  }, 3000);
6864
7463
  </script>
6865
- <div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
7464
+ <div class="canvas"><canvas width="516" height="200" id="canvas-64"></canvas></div>
6866
7465
  </div>
6867
7466
 
6868
7467
 
@@ -6921,7 +7520,7 @@ path.tween({
6921
7520
  <div class="button run">Run</div>
6922
7521
  </div>
6923
7522
 
6924
- <script type="text/paperscript" canvas="canvas-61">
7523
+ <script type="text/paperscript" canvas="canvas-65">
6925
7524
  var path = new Path.Circle({
6926
7525
  fillColor: 'blue',
6927
7526
  radius: view.bounds.height * 0.4,
@@ -6937,7 +7536,7 @@ path.tween(2000).onUpdate = function(event) {
6937
7536
  path.interpolate(pathFrom, pathTo, event.factor)
6938
7537
  };
6939
7538
  </script>
6940
- <div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
7539
+ <div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
6941
7540
  </div>
6942
7541
 
6943
7542
 
@@ -7058,7 +7657,7 @@ path.tween(2000).onUpdate = function(event) {
7058
7657
  <div class="button run">Run</div>
7059
7658
  </div>
7060
7659
 
7061
- <script type="text/paperscript" canvas="canvas-62">
7660
+ <script type="text/paperscript" canvas="canvas-66">
7062
7661
  var path = new Path.Circle({
7063
7662
  fillColor: 'blue',
7064
7663
  radius: view.bounds.height * 0.4,
@@ -7066,7 +7665,7 @@ var path = new Path.Circle({
7066
7665
  });
7067
7666
  path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7068
7667
  </script>
7069
- <div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
7668
+ <div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
7070
7669
  </div>
7071
7670
 
7072
7671
 
@@ -7080,7 +7679,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
7080
7679
 
7081
7680
  <!-- =========================== copyright notice ========================== -->
7082
7681
  <p class="footer">
7083
- Paper.js v0.15.0<br>
7682
+ Paper.js v0.17.0<br>
7084
7683
  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>
7085
7684
  <div class="content-end"></div>
7086
7685