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.
- package/CHANGELOG.md +158 -0
- package/README.md +24 -16
- package/dist/docs/assets/js/paper.js +4811 -808
- package/dist/docs/classes/AreaText.html +771 -243
- package/dist/docs/classes/ChangeFlag.html +1 -1
- package/dist/docs/classes/Color.html +218 -21
- package/dist/docs/classes/CompoundPath.html +1174 -274
- package/dist/docs/classes/Curve.html +2 -2
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/DrawEvent.html +69 -0
- package/dist/docs/classes/Effect.html +434 -0
- package/dist/docs/classes/EffectInstance.html +304 -0
- package/dist/docs/classes/Event.html +1 -1
- package/dist/docs/classes/Gradient.html +1 -1
- package/dist/docs/classes/GradientStop.html +1 -1
- package/dist/docs/classes/Group.html +842 -243
- package/dist/docs/classes/HitResult.html +1 -1
- package/dist/docs/classes/HostItem.html +770 -242
- package/dist/docs/classes/Item.html +827 -242
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +784 -185
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +1 -1
- package/dist/docs/classes/PaperScript.html +4 -2
- package/dist/docs/classes/Path.html +1366 -352
- package/dist/docs/classes/PathItem.html +1198 -298
- package/dist/docs/classes/PathText.html +772 -244
- package/dist/docs/classes/PatternDefinition.html +367 -0
- package/dist/docs/classes/Point.html +33 -5
- package/dist/docs/classes/PointText.html +771 -243
- package/dist/docs/classes/Project.html +251 -9
- package/dist/docs/classes/Raster.html +770 -242
- package/dist/docs/classes/Rectangle.html +50 -8
- package/dist/docs/classes/Segment.html +79 -2
- package/dist/docs/classes/Shape.html +770 -242
- package/dist/docs/classes/Size.html +31 -3
- package/dist/docs/classes/StrokeProfileStop.html +346 -0
- package/dist/docs/classes/Style.html +67 -6
- package/dist/docs/classes/SymbolDefinition.html +28 -2
- package/dist/docs/classes/SymbolItem.html +807 -242
- package/dist/docs/classes/TextItem.html +771 -243
- package/dist/docs/classes/TextRange.html +1 -1
- package/dist/docs/classes/TextStory.html +1 -1
- package/dist/docs/classes/Tool.html +2 -2
- package/dist/docs/classes/ToolEvent.html +1 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +2 -2
- package/dist/docs/classes/global.html +1 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/node/browser.js +15 -0
- package/dist/paper-core.js +4701 -728
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +4811 -808
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +5389 -892
- package/dist/paper.d.ts +1058 -69
- package/examples/Paperjs.org/LiveEffects.html +366 -0
- package/examples/Paperjs.org/Offsetting.html +379 -0
- package/examples/Paperjs.org/StrokeProfiles.html +706 -0
- package/examples/Scripts/Patterns.html +57 -0
- package/package.json +21 -11
|
@@ -414,6 +414,91 @@ text.fitHeight();
|
|
|
414
414
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
415
415
|
|
|
416
416
|
|
|
417
|
+
<div id="effects" class="member">
|
|
418
|
+
<div class="member-link">
|
|
419
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
420
|
+
</div>
|
|
421
|
+
<div class="member-description hidden">
|
|
422
|
+
|
|
423
|
+
<div class="member-text">
|
|
424
|
+
<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,
|
|
425
|
+
parameters, visible }</code>, with the <code>type</code> of the effect. Changing the returned array directly isn’t tracked, as with <a href="../classes/Path.html#segments"><tt>path.segments</tt></a>.</p>
|
|
426
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
427
|
+
<ul>
|
|
428
|
+
<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>'miter'</code>) and <code>miterLimit</code> (<code>10</code>).</li>
|
|
429
|
+
<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>
|
|
430
|
+
</ul>
|
|
431
|
+
|
|
432
|
+
|
|
433
|
+
|
|
434
|
+
<ul class="member-list">
|
|
435
|
+
<h4>Type:</h4>
|
|
436
|
+
<li>
|
|
437
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
438
|
+
</li>
|
|
439
|
+
</ul>
|
|
440
|
+
|
|
441
|
+
|
|
442
|
+
<h4>Example:</h4>
|
|
443
|
+
|
|
444
|
+
<div class="paperscript split">
|
|
445
|
+
|
|
446
|
+
<div class="buttons">
|
|
447
|
+
<div class="button run">Run</div>
|
|
448
|
+
</div>
|
|
449
|
+
|
|
450
|
+
<script type="text/paperscript" canvas="canvas-2">
|
|
451
|
+
var path = new Path.Star({
|
|
452
|
+
center: view.center,
|
|
453
|
+
points: 5,
|
|
454
|
+
radius1: 20,
|
|
455
|
+
radius2: 40,
|
|
456
|
+
strokeColor: 'black',
|
|
457
|
+
strokeWidth: 8
|
|
458
|
+
});
|
|
459
|
+
path.effects = [
|
|
460
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
461
|
+
{ type: 'outline' }
|
|
462
|
+
];
|
|
463
|
+
</script>
|
|
464
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
|
|
465
|
+
</div>
|
|
466
|
+
|
|
467
|
+
|
|
468
|
+
</div>
|
|
469
|
+
|
|
470
|
+
</div>
|
|
471
|
+
</div>
|
|
472
|
+
|
|
473
|
+
|
|
474
|
+
<div id="previewbounds-matrix" class="member">
|
|
475
|
+
<div class="member-link">
|
|
476
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
477
|
+
</div>
|
|
478
|
+
<div class="member-description hidden">
|
|
479
|
+
|
|
480
|
+
<div class="member-text">
|
|
481
|
+
<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’s with their effects, and its <a href="../classes/Item.html#strokebounds"><tt>strokeBounds</tt></a> without them, as Illustrator’s “Use Preview Bounds”.</p>
|
|
482
|
+
|
|
483
|
+
<p>Read only.</p>
|
|
484
|
+
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
<ul class="member-list">
|
|
488
|
+
<h4>Type:</h4>
|
|
489
|
+
<li>
|
|
490
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
491
|
+
</li>
|
|
492
|
+
</ul>
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
|
|
496
|
+
</div>
|
|
497
|
+
|
|
498
|
+
</div>
|
|
499
|
+
</div>
|
|
500
|
+
|
|
501
|
+
|
|
417
502
|
<div id="key" class="member">
|
|
418
503
|
<div class="member-link">
|
|
419
504
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -526,7 +611,7 @@ text.fitHeight();
|
|
|
526
611
|
<div class="button run">Run</div>
|
|
527
612
|
</div>
|
|
528
613
|
|
|
529
|
-
<script type="text/paperscript" canvas="canvas-
|
|
614
|
+
<script type="text/paperscript" canvas="canvas-3">
|
|
530
615
|
var path = new Path.Circle({
|
|
531
616
|
center: [80, 50],
|
|
532
617
|
radius: 35
|
|
@@ -541,7 +626,7 @@ group.addChild(path);
|
|
|
541
626
|
// The path can be accessed by name:
|
|
542
627
|
group.children['example'].fillColor = 'red';
|
|
543
628
|
</script>
|
|
544
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
629
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
|
|
545
630
|
</div>
|
|
546
631
|
|
|
547
632
|
|
|
@@ -579,7 +664,7 @@ group.children['example'].fillColor = 'red';
|
|
|
579
664
|
<div class="button run">Run</div>
|
|
580
665
|
</div>
|
|
581
666
|
|
|
582
|
-
<script type="text/paperscript" canvas="canvas-
|
|
667
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
583
668
|
var circle = new Path.Circle({
|
|
584
669
|
center: [80, 50],
|
|
585
670
|
radius: 30
|
|
@@ -590,7 +675,7 @@ circle.style = {
|
|
|
590
675
|
strokeWidth: 5
|
|
591
676
|
};
|
|
592
677
|
</script>
|
|
593
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
678
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
|
|
594
679
|
</div>
|
|
595
680
|
|
|
596
681
|
|
|
@@ -602,7 +687,7 @@ circle.style = {
|
|
|
602
687
|
<div class="button run">Run</div>
|
|
603
688
|
</div>
|
|
604
689
|
|
|
605
|
-
<script type="text/paperscript" canvas="canvas-
|
|
690
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
606
691
|
var path = new Path.Circle({
|
|
607
692
|
center: [50, 50],
|
|
608
693
|
radius: 30,
|
|
@@ -617,7 +702,7 @@ var path2 = new Path.Circle({
|
|
|
617
702
|
// Copy the path style of path:
|
|
618
703
|
path2.style = path.style;
|
|
619
704
|
</script>
|
|
620
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
705
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
621
706
|
</div>
|
|
622
707
|
|
|
623
708
|
|
|
@@ -629,7 +714,7 @@ path2.style = path.style;
|
|
|
629
714
|
<div class="button run">Run</div>
|
|
630
715
|
</div>
|
|
631
716
|
|
|
632
|
-
<script type="text/paperscript" canvas="canvas-
|
|
717
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
633
718
|
var myStyle = {
|
|
634
719
|
fillColor: 'red',
|
|
635
720
|
strokeColor: 'blue',
|
|
@@ -648,7 +733,7 @@ var path2 = new Path.Circle({
|
|
|
648
733
|
});
|
|
649
734
|
path2.style = myStyle;
|
|
650
735
|
</script>
|
|
651
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
736
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
652
737
|
</div>
|
|
653
738
|
|
|
654
739
|
|
|
@@ -690,7 +775,7 @@ path2.style = myStyle;
|
|
|
690
775
|
<div class="button run">Run</div>
|
|
691
776
|
</div>
|
|
692
777
|
|
|
693
|
-
<script type="text/paperscript" canvas="canvas-
|
|
778
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
694
779
|
var unlockedItem = new Path.Circle({
|
|
695
780
|
center: view.center - [35, 0],
|
|
696
781
|
radius: 30,
|
|
@@ -717,7 +802,7 @@ new PointText({
|
|
|
717
802
|
justification: 'center'
|
|
718
803
|
});
|
|
719
804
|
</script>
|
|
720
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
805
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
721
806
|
</div>
|
|
722
807
|
|
|
723
808
|
|
|
@@ -759,7 +844,7 @@ new PointText({
|
|
|
759
844
|
<div class="button run">Run</div>
|
|
760
845
|
</div>
|
|
761
846
|
|
|
762
|
-
<script type="text/paperscript" canvas="canvas-
|
|
847
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
763
848
|
var path = new Path.Circle({
|
|
764
849
|
center: [50, 50],
|
|
765
850
|
radius: 20,
|
|
@@ -769,7 +854,7 @@ var path = new Path.Circle({
|
|
|
769
854
|
// Hide the path:
|
|
770
855
|
path.visible = false;
|
|
771
856
|
</script>
|
|
772
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
857
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
773
858
|
</div>
|
|
774
859
|
|
|
775
860
|
|
|
@@ -817,7 +902,7 @@ path.visible = false;
|
|
|
817
902
|
<div class="button run">Run</div>
|
|
818
903
|
</div>
|
|
819
904
|
|
|
820
|
-
<script type="text/paperscript" canvas="canvas-
|
|
905
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
821
906
|
// Create a white rectangle in the background
|
|
822
907
|
// with the same dimensions as the view:
|
|
823
908
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -838,7 +923,7 @@ var circle2 = new Path.Circle({
|
|
|
838
923
|
// Set the blend mode of circle2:
|
|
839
924
|
circle2.blendMode = 'multiply';
|
|
840
925
|
</script>
|
|
841
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
926
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
842
927
|
</div>
|
|
843
928
|
|
|
844
929
|
|
|
@@ -880,7 +965,7 @@ circle2.blendMode = 'multiply';
|
|
|
880
965
|
<div class="button run">Run</div>
|
|
881
966
|
</div>
|
|
882
967
|
|
|
883
|
-
<script type="text/paperscript" canvas="canvas-
|
|
968
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
884
969
|
var circle = new Path.Circle({
|
|
885
970
|
center: [80, 50],
|
|
886
971
|
radius: 35,
|
|
@@ -898,7 +983,7 @@ var circle2 = new Path.Circle({
|
|
|
898
983
|
// Make circle2 50% transparent:
|
|
899
984
|
circle2.opacity = 0.5;
|
|
900
985
|
</script>
|
|
901
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
986
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
902
987
|
</div>
|
|
903
988
|
|
|
904
989
|
|
|
@@ -1021,14 +1106,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
1021
1106
|
<div class="button run">Run</div>
|
|
1022
1107
|
</div>
|
|
1023
1108
|
|
|
1024
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1109
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
1025
1110
|
var path = new Path.Circle({
|
|
1026
1111
|
center: [80, 50],
|
|
1027
1112
|
radius: 35
|
|
1028
1113
|
});
|
|
1029
1114
|
path.selected = true; // Select the path
|
|
1030
1115
|
</script>
|
|
1031
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1116
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
1032
1117
|
</div>
|
|
1033
1118
|
|
|
1034
1119
|
|
|
@@ -1185,7 +1270,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
1185
1270
|
<div class="button run">Run</div>
|
|
1186
1271
|
</div>
|
|
1187
1272
|
|
|
1188
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1273
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
1189
1274
|
// Create a circle at position { x: 10, y: 10 }
|
|
1190
1275
|
var circle = new Path.Circle({
|
|
1191
1276
|
center: new Point(10, 10),
|
|
@@ -1199,7 +1284,7 @@ circle.position = new Point(20, 20);
|
|
|
1199
1284
|
// Move the circle 100 points to the right and 50 points down
|
|
1200
1285
|
circle.position += new Point(100, 50);
|
|
1201
1286
|
</script>
|
|
1202
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1287
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
1203
1288
|
</div>
|
|
1204
1289
|
|
|
1205
1290
|
|
|
@@ -1211,7 +1296,7 @@ circle.position += new Point(100, 50);
|
|
|
1211
1296
|
<div class="button run">Run</div>
|
|
1212
1297
|
</div>
|
|
1213
1298
|
|
|
1214
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1299
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1215
1300
|
// Create a circle at position { x: 20, y: 20 }
|
|
1216
1301
|
var circle = new Path.Circle({
|
|
1217
1302
|
center: new Point(20, 20),
|
|
@@ -1222,7 +1307,7 @@ var circle = new Path.Circle({
|
|
|
1222
1307
|
// Move the circle 100 points to the right
|
|
1223
1308
|
circle.position.x += 100;
|
|
1224
1309
|
</script>
|
|
1225
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1310
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1226
1311
|
</div>
|
|
1227
1312
|
|
|
1228
1313
|
|
|
@@ -1748,7 +1833,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1748
1833
|
<div class="button run">Run</div>
|
|
1749
1834
|
</div>
|
|
1750
1835
|
|
|
1751
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1836
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1752
1837
|
var path = new Path.Circle({
|
|
1753
1838
|
center: [80, 50],
|
|
1754
1839
|
radius: 35
|
|
@@ -1761,7 +1846,7 @@ group.addChild(path);
|
|
|
1761
1846
|
// Access the path through the group's children array:
|
|
1762
1847
|
group.children[0].fillColor = 'red';
|
|
1763
1848
|
</script>
|
|
1764
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1849
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1765
1850
|
</div>
|
|
1766
1851
|
|
|
1767
1852
|
|
|
@@ -1773,7 +1858,7 @@ group.children[0].fillColor = 'red';
|
|
|
1773
1858
|
<div class="button run">Run</div>
|
|
1774
1859
|
</div>
|
|
1775
1860
|
|
|
1776
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1861
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1777
1862
|
var path = new Path.Circle({
|
|
1778
1863
|
center: [80, 50],
|
|
1779
1864
|
radius: 35
|
|
@@ -1788,7 +1873,7 @@ group.addChild(path);
|
|
|
1788
1873
|
// The path can be accessed by name:
|
|
1789
1874
|
group.children['example'].fillColor = 'orange';
|
|
1790
1875
|
</script>
|
|
1791
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1876
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1792
1877
|
</div>
|
|
1793
1878
|
|
|
1794
1879
|
|
|
@@ -1800,7 +1885,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1800
1885
|
<div class="button run">Run</div>
|
|
1801
1886
|
</div>
|
|
1802
1887
|
|
|
1803
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1888
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1804
1889
|
var path = new Path.Circle({
|
|
1805
1890
|
center: [80, 50],
|
|
1806
1891
|
radius: 35
|
|
@@ -1812,7 +1897,7 @@ group.children = [path];
|
|
|
1812
1897
|
// The path is the first child of the group:
|
|
1813
1898
|
group.firstChild.fillColor = 'green';
|
|
1814
1899
|
</script>
|
|
1815
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1900
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1816
1901
|
</div>
|
|
1817
1902
|
|
|
1818
1903
|
|
|
@@ -1989,7 +2074,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1989
2074
|
<div class="button run">Run</div>
|
|
1990
2075
|
</div>
|
|
1991
2076
|
|
|
1992
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2077
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1993
2078
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1994
2079
|
// with a radius of 35:
|
|
1995
2080
|
var circle = new Path.Circle({
|
|
@@ -2000,7 +2085,7 @@ var circle = new Path.Circle({
|
|
|
2000
2085
|
// Set its stroke color to RGB red:
|
|
2001
2086
|
circle.strokeColor = new Color(1, 0, 0);
|
|
2002
2087
|
</script>
|
|
2003
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2088
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
2004
2089
|
</div>
|
|
2005
2090
|
|
|
2006
2091
|
|
|
@@ -2037,7 +2122,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
2037
2122
|
<div class="button run">Run</div>
|
|
2038
2123
|
</div>
|
|
2039
2124
|
|
|
2040
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2125
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
2041
2126
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2042
2127
|
// with a radius of 35:
|
|
2043
2128
|
var circle = new Path.Circle({
|
|
@@ -2049,7 +2134,7 @@ var circle = new Path.Circle({
|
|
|
2049
2134
|
// Set its stroke width to 10:
|
|
2050
2135
|
circle.strokeWidth = 10;
|
|
2051
2136
|
</script>
|
|
2052
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2137
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
|
|
2053
2138
|
</div>
|
|
2054
2139
|
|
|
2055
2140
|
|
|
@@ -2096,7 +2181,7 @@ circle.strokeWidth = 10;
|
|
|
2096
2181
|
<div class="button run">Run</div>
|
|
2097
2182
|
</div>
|
|
2098
2183
|
|
|
2099
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2184
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
2100
2185
|
var line = new Path({
|
|
2101
2186
|
segments: [[80, 50], [420, 50]],
|
|
2102
2187
|
strokeColor: 'black',
|
|
@@ -2117,7 +2202,7 @@ var line2 = line.clone();
|
|
|
2117
2202
|
line2.position.y += 100;
|
|
2118
2203
|
line2.strokeCap = 'butt';
|
|
2119
2204
|
</script>
|
|
2120
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
2205
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-19"></canvas></div>
|
|
2121
2206
|
</div>
|
|
2122
2207
|
|
|
2123
2208
|
|
|
@@ -2164,7 +2249,7 @@ line2.strokeCap = 'butt';
|
|
|
2164
2249
|
<div class="button run">Run</div>
|
|
2165
2250
|
</div>
|
|
2166
2251
|
|
|
2167
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2252
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
2168
2253
|
var path = new Path({
|
|
2169
2254
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
2170
2255
|
strokeColor: 'black',
|
|
@@ -2181,7 +2266,7 @@ var path3 = path2.clone();
|
|
|
2181
2266
|
path3.position.x += path3.bounds.width * 1.5;
|
|
2182
2267
|
path3.strokeJoin = 'bevel';
|
|
2183
2268
|
</script>
|
|
2184
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
2269
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-20"></canvas></div>
|
|
2185
2270
|
</div>
|
|
2186
2271
|
|
|
2187
2272
|
|
|
@@ -2285,7 +2370,7 @@ path3.strokeJoin = 'bevel';
|
|
|
2285
2370
|
<div class="button run">Run</div>
|
|
2286
2371
|
</div>
|
|
2287
2372
|
|
|
2288
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2373
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2289
2374
|
var path = new Path.Circle({
|
|
2290
2375
|
center: [80, 50],
|
|
2291
2376
|
radius: 40,
|
|
@@ -2296,7 +2381,7 @@ var path = new Path.Circle({
|
|
|
2296
2381
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
2297
2382
|
path.dashArray = [10, 4];
|
|
2298
2383
|
</script>
|
|
2299
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2384
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2300
2385
|
</div>
|
|
2301
2386
|
|
|
2302
2387
|
|
|
@@ -2331,6 +2416,42 @@ path.dashArray = [10, 4];
|
|
|
2331
2416
|
|
|
2332
2417
|
|
|
2333
2418
|
|
|
2419
|
+
</div>
|
|
2420
|
+
|
|
2421
|
+
</div>
|
|
2422
|
+
</div>
|
|
2423
|
+
|
|
2424
|
+
|
|
2425
|
+
<div id="paintorder" class="member">
|
|
2426
|
+
<div class="member-link">
|
|
2427
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
2428
|
+
</div>
|
|
2429
|
+
<div class="member-description hidden">
|
|
2430
|
+
|
|
2431
|
+
<div class="member-text">
|
|
2432
|
+
<p>The order in which the fill and the stroke are painted, as in SVG’s <code>paint-order</code>, named after what is painted first: <code>'fill'</code> paints the fill first, <code>'stroke'</code> paints the stroke first, so the fill covers its inner half.</p>
|
|
2433
|
+
|
|
2434
|
+
|
|
2435
|
+
<ul class="member-list">
|
|
2436
|
+
<h4>Values:</h4>
|
|
2437
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
2438
|
+
</ul>
|
|
2439
|
+
|
|
2440
|
+
|
|
2441
|
+
<ul class="member-list">
|
|
2442
|
+
<h4>Default:</h4>
|
|
2443
|
+
<li><tt>'fill'</tt></li>
|
|
2444
|
+
</ul>
|
|
2445
|
+
|
|
2446
|
+
<ul class="member-list">
|
|
2447
|
+
<h4>Type:</h4>
|
|
2448
|
+
<li>
|
|
2449
|
+
<tt>String</tt>
|
|
2450
|
+
</li>
|
|
2451
|
+
</ul>
|
|
2452
|
+
|
|
2453
|
+
|
|
2454
|
+
|
|
2334
2455
|
</div>
|
|
2335
2456
|
|
|
2336
2457
|
</div>
|
|
@@ -2366,7 +2487,7 @@ path.dashArray = [10, 4];
|
|
|
2366
2487
|
<div class="button run">Run</div>
|
|
2367
2488
|
</div>
|
|
2368
2489
|
|
|
2369
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2490
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2370
2491
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2371
2492
|
// with a radius of 35:
|
|
2372
2493
|
var circle = new Path.Circle({
|
|
@@ -2377,7 +2498,7 @@ var circle = new Path.Circle({
|
|
|
2377
2498
|
// Set the fill color of the circle to RGB red:
|
|
2378
2499
|
circle.fillColor = new Color(1, 0, 0);
|
|
2379
2500
|
</script>
|
|
2380
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2501
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2381
2502
|
</div>
|
|
2382
2503
|
|
|
2383
2504
|
|
|
@@ -2452,7 +2573,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2452
2573
|
<div class="button run">Run</div>
|
|
2453
2574
|
</div>
|
|
2454
2575
|
|
|
2455
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2576
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2456
2577
|
var circle = new Path.Circle({
|
|
2457
2578
|
center: [80, 50],
|
|
2458
2579
|
radius: 35,
|
|
@@ -2465,7 +2586,7 @@ var circle = new Path.Circle({
|
|
|
2465
2586
|
shadowOffset: new Point(5, 5)
|
|
2466
2587
|
});
|
|
2467
2588
|
</script>
|
|
2468
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2589
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2469
2590
|
</div>
|
|
2470
2591
|
|
|
2471
2592
|
|
|
@@ -2606,7 +2727,7 @@ var circle = new Path.Circle({
|
|
|
2606
2727
|
<div class="button run">Run</div>
|
|
2607
2728
|
</div>
|
|
2608
2729
|
|
|
2609
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2730
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2610
2731
|
// Create a rectangle shaped path with its top left point at:
|
|
2611
2732
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2612
2733
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2617,7 +2738,7 @@ path.onFrame = function(event) {
|
|
|
2617
2738
|
this.rotate(3);
|
|
2618
2739
|
}
|
|
2619
2740
|
</script>
|
|
2620
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2741
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2621
2742
|
</div>
|
|
2622
2743
|
|
|
2623
2744
|
|
|
@@ -2661,7 +2782,7 @@ path.onFrame = function(event) {
|
|
|
2661
2782
|
<div class="button run">Run</div>
|
|
2662
2783
|
</div>
|
|
2663
2784
|
|
|
2664
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2785
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2665
2786
|
// Create a circle shaped path at the center of the view:
|
|
2666
2787
|
var path = new Path.Circle({
|
|
2667
2788
|
center: view.center,
|
|
@@ -2675,7 +2796,7 @@ path.onMouseDown = function(event) {
|
|
|
2675
2796
|
this.fillColor = 'red';
|
|
2676
2797
|
}
|
|
2677
2798
|
</script>
|
|
2678
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2799
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2679
2800
|
</div>
|
|
2680
2801
|
|
|
2681
2802
|
|
|
@@ -2687,7 +2808,7 @@ path.onMouseDown = function(event) {
|
|
|
2687
2808
|
<div class="button run">Run</div>
|
|
2688
2809
|
</div>
|
|
2689
2810
|
|
|
2690
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2811
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2691
2812
|
// Loop 30 times:
|
|
2692
2813
|
for (var i = 0; i < 30; i++) {
|
|
2693
2814
|
// Create a circle shaped path at a random position
|
|
@@ -2705,7 +2826,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2705
2826
|
}
|
|
2706
2827
|
}
|
|
2707
2828
|
</script>
|
|
2708
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2829
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
2709
2830
|
</div>
|
|
2710
2831
|
|
|
2711
2832
|
|
|
@@ -2749,7 +2870,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2749
2870
|
<div class="button run">Run</div>
|
|
2750
2871
|
</div>
|
|
2751
2872
|
|
|
2752
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2873
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2753
2874
|
// Create a circle shaped path at the center of the view:
|
|
2754
2875
|
var path = new Path.Circle({
|
|
2755
2876
|
center: view.center,
|
|
@@ -2762,7 +2883,7 @@ path.onMouseDrag = function(event) {
|
|
|
2762
2883
|
path.position += event.delta;
|
|
2763
2884
|
}
|
|
2764
2885
|
</script>
|
|
2765
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2886
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-27"></canvas></div>
|
|
2766
2887
|
</div>
|
|
2767
2888
|
|
|
2768
2889
|
|
|
@@ -2806,7 +2927,7 @@ path.onMouseDrag = function(event) {
|
|
|
2806
2927
|
<div class="button run">Run</div>
|
|
2807
2928
|
</div>
|
|
2808
2929
|
|
|
2809
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2930
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2810
2931
|
// Create a circle shaped path at the center of the view:
|
|
2811
2932
|
var path = new Path.Circle({
|
|
2812
2933
|
center: view.center,
|
|
@@ -2820,7 +2941,7 @@ path.onMouseUp = function(event) {
|
|
|
2820
2941
|
this.fillColor = 'red';
|
|
2821
2942
|
}
|
|
2822
2943
|
</script>
|
|
2823
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2944
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2824
2945
|
</div>
|
|
2825
2946
|
|
|
2826
2947
|
|
|
@@ -2864,7 +2985,7 @@ path.onMouseUp = function(event) {
|
|
|
2864
2985
|
<div class="button run">Run</div>
|
|
2865
2986
|
</div>
|
|
2866
2987
|
|
|
2867
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2988
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2868
2989
|
// Create a circle shaped path at the center of the view:
|
|
2869
2990
|
var path = new Path.Circle({
|
|
2870
2991
|
center: view.center,
|
|
@@ -2878,7 +2999,7 @@ path.onClick = function(event) {
|
|
|
2878
2999
|
this.fillColor = 'red';
|
|
2879
3000
|
}
|
|
2880
3001
|
</script>
|
|
2881
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3002
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2882
3003
|
</div>
|
|
2883
3004
|
|
|
2884
3005
|
|
|
@@ -2890,7 +3011,7 @@ path.onClick = function(event) {
|
|
|
2890
3011
|
<div class="button run">Run</div>
|
|
2891
3012
|
</div>
|
|
2892
3013
|
|
|
2893
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3014
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2894
3015
|
// Loop 30 times:
|
|
2895
3016
|
for (var i = 0; i < 30; i++) {
|
|
2896
3017
|
// Create a circle shaped path at a random position
|
|
@@ -2908,7 +3029,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2908
3029
|
}
|
|
2909
3030
|
}
|
|
2910
3031
|
</script>
|
|
2911
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3032
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2912
3033
|
</div>
|
|
2913
3034
|
|
|
2914
3035
|
|
|
@@ -2952,7 +3073,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2952
3073
|
<div class="button run">Run</div>
|
|
2953
3074
|
</div>
|
|
2954
3075
|
|
|
2955
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3076
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2956
3077
|
// Create a circle shaped path at the center of the view:
|
|
2957
3078
|
var path = new Path.Circle({
|
|
2958
3079
|
center: view.center,
|
|
@@ -2966,7 +3087,7 @@ path.onDoubleClick = function(event) {
|
|
|
2966
3087
|
this.fillColor = 'red';
|
|
2967
3088
|
}
|
|
2968
3089
|
</script>
|
|
2969
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3090
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2970
3091
|
</div>
|
|
2971
3092
|
|
|
2972
3093
|
|
|
@@ -2978,7 +3099,7 @@ path.onDoubleClick = function(event) {
|
|
|
2978
3099
|
<div class="button run">Run</div>
|
|
2979
3100
|
</div>
|
|
2980
3101
|
|
|
2981
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3102
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2982
3103
|
// Loop 30 times:
|
|
2983
3104
|
for (var i = 0; i < 30; i++) {
|
|
2984
3105
|
// Create a circle shaped path at a random position
|
|
@@ -2996,7 +3117,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2996
3117
|
}
|
|
2997
3118
|
}
|
|
2998
3119
|
</script>
|
|
2999
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3120
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
3000
3121
|
</div>
|
|
3001
3122
|
|
|
3002
3123
|
|
|
@@ -3040,7 +3161,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3040
3161
|
<div class="button run">Run</div>
|
|
3041
3162
|
</div>
|
|
3042
3163
|
|
|
3043
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3164
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
3044
3165
|
// Create a circle shaped path at the center of the view:
|
|
3045
3166
|
var path = new Path.Circle({
|
|
3046
3167
|
center: view.center,
|
|
@@ -3048,180 +3169,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
3048
3169
|
fillColor: 'black'
|
|
3049
3170
|
});
|
|
3050
3171
|
|
|
3051
|
-
// When the mouse moves on top of the item, set its opacity
|
|
3052
|
-
// to a random value between 0 and 1:
|
|
3053
|
-
path.onMouseMove = function(event) {
|
|
3054
|
-
this.opacity = Math.random();
|
|
3055
|
-
}
|
|
3056
|
-
</script>
|
|
3057
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3058
|
-
</div>
|
|
3172
|
+
// When the mouse moves on top of the item, set its opacity
|
|
3173
|
+
// to a random value between 0 and 1:
|
|
3174
|
+
path.onMouseMove = function(event) {
|
|
3175
|
+
this.opacity = Math.random();
|
|
3176
|
+
}
|
|
3177
|
+
</script>
|
|
3178
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
3179
|
+
</div>
|
|
3180
|
+
|
|
3181
|
+
|
|
3182
|
+
</div>
|
|
3183
|
+
|
|
3184
|
+
</div>
|
|
3185
|
+
</div>
|
|
3186
|
+
|
|
3187
|
+
|
|
3188
|
+
<div id="onmouseenter" class="member">
|
|
3189
|
+
<div class="member-link">
|
|
3190
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
3191
|
+
</div>
|
|
3192
|
+
<div class="member-description hidden">
|
|
3193
|
+
|
|
3194
|
+
<div class="member-text">
|
|
3195
|
+
<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>
|
|
3196
|
+
|
|
3197
|
+
|
|
3198
|
+
|
|
3199
|
+
<ul class="member-list">
|
|
3200
|
+
<h4>Type:</h4>
|
|
3201
|
+
<li>
|
|
3202
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3203
|
+
</li>
|
|
3204
|
+
</ul>
|
|
3205
|
+
|
|
3206
|
+
|
|
3207
|
+
<ul class="member-list">
|
|
3208
|
+
<h4>See also:</h4>
|
|
3209
|
+
|
|
3210
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
3211
|
+
|
|
3212
|
+
</ul>
|
|
3213
|
+
|
|
3214
|
+
<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>
|
|
3215
|
+
|
|
3216
|
+
<div class="paperscript split">
|
|
3217
|
+
|
|
3218
|
+
<div class="buttons">
|
|
3219
|
+
<div class="button run">Run</div>
|
|
3220
|
+
</div>
|
|
3221
|
+
|
|
3222
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
3223
|
+
// Create a circle shaped path at the center of the view:
|
|
3224
|
+
var path = new Path.Circle({
|
|
3225
|
+
center: view.center,
|
|
3226
|
+
radius: 25,
|
|
3227
|
+
fillColor: 'black'
|
|
3228
|
+
});
|
|
3229
|
+
|
|
3230
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3231
|
+
path.onMouseEnter = function(event) {
|
|
3232
|
+
this.fillColor = 'red';
|
|
3233
|
+
}
|
|
3234
|
+
|
|
3235
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3236
|
+
path.onMouseLeave = function(event) {
|
|
3237
|
+
this.fillColor = 'black';
|
|
3238
|
+
}
|
|
3239
|
+
</script>
|
|
3240
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3241
|
+
</div>
|
|
3242
|
+
|
|
3243
|
+
|
|
3244
|
+
<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>
|
|
3245
|
+
|
|
3246
|
+
<div class="paperscript split">
|
|
3247
|
+
|
|
3248
|
+
<div class="buttons">
|
|
3249
|
+
<div class="button run">Run</div>
|
|
3250
|
+
</div>
|
|
3251
|
+
|
|
3252
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
3253
|
+
function enter(event) {
|
|
3254
|
+
this.fillColor = 'red';
|
|
3255
|
+
}
|
|
3256
|
+
|
|
3257
|
+
function leave(event) {
|
|
3258
|
+
this.fillColor = 'black';
|
|
3259
|
+
}
|
|
3260
|
+
|
|
3261
|
+
// When the mouse is pressed:
|
|
3262
|
+
function onMouseDown(event) {
|
|
3263
|
+
// Create a circle shaped path at the position of the mouse:
|
|
3264
|
+
var path = new Path.Circle(event.point, 25);
|
|
3265
|
+
path.fillColor = 'black';
|
|
3266
|
+
|
|
3267
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3268
|
+
path.onMouseEnter = enter;
|
|
3269
|
+
|
|
3270
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3271
|
+
path.onMouseLeave = leave;
|
|
3272
|
+
}
|
|
3273
|
+
</script>
|
|
3274
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3275
|
+
</div>
|
|
3276
|
+
|
|
3277
|
+
|
|
3278
|
+
</div>
|
|
3279
|
+
|
|
3280
|
+
</div>
|
|
3281
|
+
</div>
|
|
3282
|
+
|
|
3283
|
+
|
|
3284
|
+
<div id="onmouseleave" class="member">
|
|
3285
|
+
<div class="member-link">
|
|
3286
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
3287
|
+
</div>
|
|
3288
|
+
<div class="member-description hidden">
|
|
3289
|
+
|
|
3290
|
+
<div class="member-text">
|
|
3291
|
+
<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>
|
|
3292
|
+
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
<ul class="member-list">
|
|
3296
|
+
<h4>Type:</h4>
|
|
3297
|
+
<li>
|
|
3298
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3299
|
+
</li>
|
|
3300
|
+
</ul>
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
<ul class="member-list">
|
|
3304
|
+
<h4>See also:</h4>
|
|
3305
|
+
|
|
3306
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
3307
|
+
|
|
3308
|
+
</ul>
|
|
3309
|
+
|
|
3310
|
+
<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>
|
|
3311
|
+
|
|
3312
|
+
<div class="paperscript split">
|
|
3313
|
+
|
|
3314
|
+
<div class="buttons">
|
|
3315
|
+
<div class="button run">Run</div>
|
|
3316
|
+
</div>
|
|
3317
|
+
|
|
3318
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3319
|
+
// Create a circle shaped path at the center of the view:
|
|
3320
|
+
var path = new Path.Circle({
|
|
3321
|
+
center: view.center,
|
|
3322
|
+
radius: 25,
|
|
3323
|
+
fillColor: 'black'
|
|
3324
|
+
});
|
|
3325
|
+
|
|
3326
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
3327
|
+
path.onMouseLeave = function(event) {
|
|
3328
|
+
this.fillColor = 'red';
|
|
3329
|
+
}
|
|
3330
|
+
</script>
|
|
3331
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3332
|
+
</div>
|
|
3333
|
+
|
|
3334
|
+
|
|
3335
|
+
</div>
|
|
3336
|
+
|
|
3337
|
+
</div>
|
|
3338
|
+
</div>
|
|
3339
|
+
|
|
3340
|
+
|
|
3341
|
+
<div id="ondraw" class="member">
|
|
3342
|
+
<div class="member-link">
|
|
3343
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
3344
|
+
</div>
|
|
3345
|
+
<div class="member-description hidden">
|
|
3346
|
+
|
|
3347
|
+
<div class="member-text">
|
|
3348
|
+
<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’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>
|
|
3349
|
+
|
|
3350
|
+
|
|
3351
|
+
|
|
3352
|
+
<ul class="member-list">
|
|
3353
|
+
<h4>Type:</h4>
|
|
3354
|
+
<li>
|
|
3355
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3356
|
+
</li>
|
|
3357
|
+
</ul>
|
|
3358
|
+
<ul class="member-list">
|
|
3359
|
+
<h4>Options:</h4>
|
|
3360
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
3361
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
3362
|
+
<li><tt>event.matrix: <a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt> — the matrix from the item’s coordinates to the pixels of the view, without its pixel ratio, for drawing things at a size in pixels</li>
|
|
3363
|
+
<li><tt>event.pixelRatio: <tt>Number</tt></tt> — the device pixels per pixel: the view’s pixel ratio, or the resolution divided by 72 in <a href="../classes/Item.html#rasterize"><tt>rasterize</tt></a>()</li>
|
|
3364
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into, or <code>null</code> in <a href="../classes/Item.html#rasterize"><tt>rasterize</tt></a>()
|
|
3365
|
+
What the handler draws isn’t part of the item’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>
|
|
3366
|
+
</ul>
|
|
3367
|
+
|
|
3368
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
3369
|
+
|
|
3370
|
+
<div class="paperscript split">
|
|
3371
|
+
|
|
3372
|
+
<div class="buttons">
|
|
3373
|
+
<div class="button run">Run</div>
|
|
3374
|
+
</div>
|
|
3375
|
+
|
|
3376
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3377
|
+
var path = new Path.Circle({
|
|
3378
|
+
center: view.center,
|
|
3379
|
+
radius: 25,
|
|
3380
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3381
|
+
});
|
|
3382
|
+
|
|
3383
|
+
path.onDraw = function(event) {
|
|
3384
|
+
var ctx = event.context,
|
|
3385
|
+
center = this.position,
|
|
3386
|
+
scale = event.matrix.scaling.x;
|
|
3387
|
+
ctx.beginPath();
|
|
3388
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3389
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3390
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3391
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3392
|
+
ctx.lineWidth = 1 / scale;
|
|
3393
|
+
ctx.stroke();
|
|
3394
|
+
}
|
|
3395
|
+
</script>
|
|
3396
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3397
|
+
</div>
|
|
3398
|
+
|
|
3399
|
+
|
|
3400
|
+
</div>
|
|
3401
|
+
|
|
3402
|
+
</div>
|
|
3403
|
+
</div>
|
|
3404
|
+
|
|
3405
|
+
|
|
3406
|
+
<div id="ondrawselection" class="member">
|
|
3407
|
+
<div class="member-link">
|
|
3408
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3409
|
+
</div>
|
|
3410
|
+
<div class="member-description hidden">
|
|
3411
|
+
|
|
3412
|
+
<div class="member-text">
|
|
3413
|
+
<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’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>
|
|
3414
|
+
|
|
3415
|
+
|
|
3416
|
+
|
|
3417
|
+
<ul class="member-list">
|
|
3418
|
+
<h4>Type:</h4>
|
|
3419
|
+
<li>
|
|
3420
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3421
|
+
</li>
|
|
3422
|
+
</ul>
|
|
3423
|
+
<ul class="member-list">
|
|
3424
|
+
<h4>Options:</h4>
|
|
3425
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3426
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — 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>
|
|
3427
|
+
<li><tt>event.matrix: <a href="../classes/Matrix.html"><tt>Matrix</tt></a></tt> — the matrix from the item’s coordinates to the pixels of the view</li>
|
|
3428
|
+
<li><tt>event.size: <tt>Number</tt></tt> — the size of the handles, see <a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a></li>
|
|
3429
|
+
<li><tt>event.color: <a href="../classes/Color.html"><tt>Color</tt></a></tt> — the selection color, see <a href="../classes/Item.html#selectedcolor"><tt>selectedColor</tt></a></li>
|
|
3430
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3431
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3432
|
+
</ul>
|
|
3433
|
+
|
|
3434
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3435
|
+
|
|
3436
|
+
<div class="paperscript split">
|
|
3437
|
+
|
|
3438
|
+
<div class="buttons">
|
|
3439
|
+
<div class="button run">Run</div>
|
|
3440
|
+
</div>
|
|
3441
|
+
|
|
3442
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3443
|
+
var path = new Path.Star({
|
|
3444
|
+
center: view.center,
|
|
3445
|
+
points: 5,
|
|
3446
|
+
radius1: 20,
|
|
3447
|
+
radius2: 40,
|
|
3448
|
+
strokeColor: 'black',
|
|
3449
|
+
selected: true
|
|
3450
|
+
});
|
|
3451
|
+
|
|
3452
|
+
path.onDrawSelection = function(event) {
|
|
3453
|
+
var ctx = event.context;
|
|
3454
|
+
this.segments.forEach(function(segment) {
|
|
3455
|
+
var point = event.matrix.transform(segment.point);
|
|
3456
|
+
ctx.beginPath();
|
|
3457
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3458
|
+
ctx.fill();
|
|
3459
|
+
});
|
|
3460
|
+
return false;
|
|
3461
|
+
}
|
|
3462
|
+
</script>
|
|
3463
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3464
|
+
</div>
|
|
3465
|
+
|
|
3466
|
+
|
|
3467
|
+
</div>
|
|
3468
|
+
|
|
3469
|
+
</div>
|
|
3470
|
+
</div>
|
|
3471
|
+
|
|
3472
|
+
</div>
|
|
3473
|
+
|
|
3474
|
+
|
|
3475
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3476
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
<div id="addeffect-effect" class="member">
|
|
3480
|
+
<div class="member-link">
|
|
3481
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3482
|
+
</div>
|
|
3483
|
+
<div class="member-description hidden">
|
|
3484
|
+
<div class="member-text">
|
|
3485
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3486
|
+
|
|
3487
|
+
|
|
3488
|
+
<ul class="member-list">
|
|
3489
|
+
<h4>Parameters:</h4>
|
|
3490
|
+
|
|
3491
|
+
<li>
|
|
3492
|
+
<tt>effect:</tt>
|
|
3493
|
+
<tt>Object</tt>
|
|
3494
|
+
— the plain object describing the effect
|
|
3495
|
+
|
|
3496
|
+
</li>
|
|
3497
|
+
|
|
3498
|
+
</ul>
|
|
3499
|
+
|
|
3500
|
+
|
|
3501
|
+
<ul class="member-list">
|
|
3502
|
+
<h4>Returns:</h4>
|
|
3503
|
+
|
|
3504
|
+
<li>
|
|
3505
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3506
|
+
</li>
|
|
3507
|
+
|
|
3508
|
+
|
|
3509
|
+
</ul>
|
|
3510
|
+
|
|
3511
|
+
|
|
3512
|
+
|
|
3513
|
+
|
|
3514
|
+
|
|
3515
|
+
</div>
|
|
3516
|
+
</div>
|
|
3517
|
+
</div>
|
|
3518
|
+
|
|
3519
|
+
|
|
3520
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3521
|
+
<div class="member-link">
|
|
3522
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3523
|
+
</div>
|
|
3524
|
+
<div class="member-description hidden">
|
|
3525
|
+
<div class="member-text">
|
|
3526
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3527
|
+
|
|
3528
|
+
|
|
3529
|
+
<ul class="member-list">
|
|
3530
|
+
<h4>Parameters:</h4>
|
|
3531
|
+
|
|
3532
|
+
<li>
|
|
3533
|
+
<tt>index:</tt>
|
|
3534
|
+
<tt>Number</tt>
|
|
3535
|
+
— the index at which to insert the effect
|
|
3536
|
+
|
|
3537
|
+
</li>
|
|
3538
|
+
|
|
3539
|
+
<li>
|
|
3540
|
+
<tt>effect:</tt>
|
|
3541
|
+
<tt>Object</tt>
|
|
3542
|
+
— the plain object describing the effect
|
|
3543
|
+
|
|
3544
|
+
</li>
|
|
3545
|
+
|
|
3546
|
+
</ul>
|
|
3547
|
+
|
|
3548
|
+
|
|
3549
|
+
<ul class="member-list">
|
|
3550
|
+
<h4>Returns:</h4>
|
|
3551
|
+
|
|
3552
|
+
<li>
|
|
3553
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3554
|
+
</li>
|
|
3555
|
+
|
|
3556
|
+
|
|
3557
|
+
</ul>
|
|
3558
|
+
|
|
3559
|
+
|
|
3560
|
+
|
|
3561
|
+
|
|
3562
|
+
|
|
3563
|
+
</div>
|
|
3564
|
+
</div>
|
|
3565
|
+
</div>
|
|
3566
|
+
|
|
3567
|
+
|
|
3568
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3569
|
+
<div class="member-link">
|
|
3570
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3571
|
+
</div>
|
|
3572
|
+
<div class="member-description hidden">
|
|
3573
|
+
<div class="member-text">
|
|
3574
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3575
|
+
|
|
3576
|
+
|
|
3577
|
+
<ul class="member-list">
|
|
3578
|
+
<h4>Parameters:</h4>
|
|
3579
|
+
|
|
3580
|
+
<li>
|
|
3581
|
+
<tt>index:</tt>
|
|
3582
|
+
<tt>Number</tt>
|
|
3583
|
+
— the index at which to insert the effects
|
|
3584
|
+
|
|
3585
|
+
</li>
|
|
3586
|
+
|
|
3587
|
+
<li>
|
|
3588
|
+
<tt>effects:</tt>
|
|
3589
|
+
Array of <tt>Object</tt> objects
|
|
3590
|
+
— the plain objects describing the effects
|
|
3591
|
+
|
|
3592
|
+
</li>
|
|
3593
|
+
|
|
3594
|
+
</ul>
|
|
3595
|
+
|
|
3596
|
+
|
|
3597
|
+
<ul class="member-list">
|
|
3598
|
+
<h4>Returns:</h4>
|
|
3599
|
+
|
|
3600
|
+
<li>
|
|
3601
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3602
|
+
</li>
|
|
3603
|
+
|
|
3604
|
+
|
|
3605
|
+
</ul>
|
|
3059
3606
|
|
|
3060
3607
|
|
|
3061
|
-
</div>
|
|
3062
3608
|
|
|
3609
|
+
|
|
3610
|
+
|
|
3611
|
+
</div>
|
|
3063
3612
|
</div>
|
|
3064
3613
|
</div>
|
|
3065
3614
|
|
|
3066
3615
|
|
|
3067
|
-
<div id="
|
|
3616
|
+
<div id="removeeffect-index" class="member">
|
|
3068
3617
|
<div class="member-link">
|
|
3069
|
-
<a name="
|
|
3618
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
3070
3619
|
</div>
|
|
3071
3620
|
<div class="member-description hidden">
|
|
3072
|
-
|
|
3073
3621
|
<div class="member-text">
|
|
3074
|
-
<p>
|
|
3622
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3623
|
+
|
|
3075
3624
|
|
|
3625
|
+
<ul class="member-list">
|
|
3626
|
+
<h4>Parameters:</h4>
|
|
3076
3627
|
|
|
3628
|
+
<li>
|
|
3629
|
+
<tt>index:</tt>
|
|
3630
|
+
<tt>Number</tt>
|
|
3631
|
+
— the index of the effect to remove
|
|
3632
|
+
|
|
3633
|
+
</li>
|
|
3077
3634
|
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
<li>
|
|
3081
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3082
|
-
</li>
|
|
3083
|
-
</ul>
|
|
3084
|
-
|
|
3635
|
+
</ul>
|
|
3636
|
+
|
|
3085
3637
|
|
|
3086
3638
|
<ul class="member-list">
|
|
3087
|
-
<h4>
|
|
3639
|
+
<h4>Returns:</h4>
|
|
3088
3640
|
|
|
3089
|
-
<li
|
|
3641
|
+
<li>
|
|
3642
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3643
|
+
</li>
|
|
3644
|
+
|
|
3090
3645
|
|
|
3091
3646
|
</ul>
|
|
3092
3647
|
|
|
3093
|
-
<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>
|
|
3094
3648
|
|
|
3095
|
-
<div class="paperscript split">
|
|
3096
3649
|
|
|
3097
|
-
|
|
3098
|
-
|
|
3650
|
+
|
|
3651
|
+
|
|
3099
3652
|
</div>
|
|
3100
|
-
|
|
3101
|
-
<script type="text/paperscript" canvas="canvas-33">
|
|
3102
|
-
// Create a circle shaped path at the center of the view:
|
|
3103
|
-
var path = new Path.Circle({
|
|
3104
|
-
center: view.center,
|
|
3105
|
-
radius: 25,
|
|
3106
|
-
fillColor: 'black'
|
|
3107
|
-
});
|
|
3108
|
-
|
|
3109
|
-
// When the mouse enters the item, set its fill color to red:
|
|
3110
|
-
path.onMouseEnter = function(event) {
|
|
3111
|
-
this.fillColor = 'red';
|
|
3112
|
-
}
|
|
3113
|
-
|
|
3114
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3115
|
-
path.onMouseLeave = function(event) {
|
|
3116
|
-
this.fillColor = 'black';
|
|
3117
|
-
}
|
|
3118
|
-
</script>
|
|
3119
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
3120
3653
|
</div>
|
|
3121
|
-
|
|
3122
|
-
|
|
3123
|
-
<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>
|
|
3124
|
-
|
|
3125
|
-
<div class="paperscript split">
|
|
3126
|
-
|
|
3127
|
-
<div class="buttons">
|
|
3128
|
-
<div class="button run">Run</div>
|
|
3129
3654
|
</div>
|
|
3130
3655
|
|
|
3131
|
-
|
|
3132
|
-
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3656
|
+
|
|
3657
|
+
<div id="removeeffects" class="member">
|
|
3658
|
+
<div class="member-link">
|
|
3659
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
3660
|
+
</div>
|
|
3661
|
+
<div class="member-description hidden">
|
|
3662
|
+
<div class="member-text">
|
|
3663
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3664
|
+
|
|
3665
|
+
|
|
3666
|
+
<ul class="member-list">
|
|
3667
|
+
<h4>Parameters:</h4>
|
|
3668
|
+
|
|
3669
|
+
<li>
|
|
3670
|
+
<tt>start:</tt>
|
|
3671
|
+
<tt>Number</tt>
|
|
3672
|
+
— the index of the first effect to remove
|
|
3673
|
+
— optional, default: <tt>0</tt>
|
|
3674
|
+
</li>
|
|
3675
|
+
|
|
3676
|
+
<li>
|
|
3677
|
+
<tt>end:</tt>
|
|
3678
|
+
<tt>Number</tt>
|
|
3679
|
+
— the index after the last one
|
|
3680
|
+
— optional, default: <tt>effects.length</tt>
|
|
3681
|
+
</li>
|
|
3682
|
+
|
|
3683
|
+
</ul>
|
|
3139
3684
|
|
|
3140
|
-
|
|
3141
|
-
|
|
3142
|
-
|
|
3143
|
-
|
|
3144
|
-
|
|
3685
|
+
|
|
3686
|
+
<ul class="member-list">
|
|
3687
|
+
<h4>Returns:</h4>
|
|
3688
|
+
|
|
3689
|
+
<li>
|
|
3690
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3691
|
+
</li>
|
|
3145
3692
|
|
|
3146
|
-
|
|
3147
|
-
|
|
3693
|
+
|
|
3694
|
+
</ul>
|
|
3148
3695
|
|
|
3149
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3150
|
-
path.onMouseLeave = leave;
|
|
3151
|
-
}
|
|
3152
|
-
</script>
|
|
3153
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3154
|
-
</div>
|
|
3155
3696
|
|
|
3156
3697
|
|
|
3698
|
+
|
|
3699
|
+
|
|
3157
3700
|
</div>
|
|
3158
|
-
|
|
3159
3701
|
</div>
|
|
3160
3702
|
</div>
|
|
3161
3703
|
|
|
3162
3704
|
|
|
3163
|
-
<div id="
|
|
3705
|
+
<div id="geteffectoutput" class="member">
|
|
3164
3706
|
<div class="member-link">
|
|
3165
|
-
<a name="
|
|
3707
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
3166
3708
|
</div>
|
|
3167
3709
|
<div class="member-description hidden">
|
|
3168
|
-
|
|
3169
3710
|
<div class="member-text">
|
|
3170
|
-
<p>
|
|
3171
|
-
|
|
3172
|
-
|
|
3173
|
-
|
|
3174
|
-
<ul class="member-list">
|
|
3175
|
-
<h4>Type:</h4>
|
|
3176
|
-
<li>
|
|
3177
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3178
|
-
</li>
|
|
3179
|
-
</ul>
|
|
3711
|
+
<p>Returns what the item’s visible effects make of it, in the item’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’t tracked.</p>
|
|
3180
3712
|
|
|
3181
3713
|
|
|
3714
|
+
|
|
3182
3715
|
<ul class="member-list">
|
|
3183
|
-
<h4>
|
|
3716
|
+
<h4>Returns:</h4>
|
|
3184
3717
|
|
|
3185
|
-
<li
|
|
3718
|
+
<li>
|
|
3719
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3720
|
+
</li>
|
|
3721
|
+
|
|
3186
3722
|
|
|
3187
3723
|
</ul>
|
|
3188
3724
|
|
|
3189
|
-
<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>
|
|
3190
|
-
|
|
3191
|
-
<div class="paperscript split">
|
|
3192
|
-
|
|
3193
|
-
<div class="buttons">
|
|
3194
|
-
<div class="button run">Run</div>
|
|
3195
|
-
</div>
|
|
3196
|
-
|
|
3197
|
-
<script type="text/paperscript" canvas="canvas-35">
|
|
3198
|
-
// Create a circle shaped path at the center of the view:
|
|
3199
|
-
var path = new Path.Circle({
|
|
3200
|
-
center: view.center,
|
|
3201
|
-
radius: 25,
|
|
3202
|
-
fillColor: 'black'
|
|
3203
|
-
});
|
|
3204
|
-
|
|
3205
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
3206
|
-
path.onMouseLeave = function(event) {
|
|
3207
|
-
this.fillColor = 'red';
|
|
3208
|
-
}
|
|
3209
|
-
</script>
|
|
3210
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3211
|
-
</div>
|
|
3212
|
-
|
|
3213
3725
|
|
|
3214
|
-
</div>
|
|
3215
3726
|
|
|
3727
|
+
|
|
3728
|
+
|
|
3216
3729
|
</div>
|
|
3217
3730
|
</div>
|
|
3218
|
-
|
|
3219
3731
|
</div>
|
|
3220
3732
|
|
|
3221
|
-
|
|
3222
|
-
<!-- =========================== inherited methods ========================= -->
|
|
3223
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3224
|
-
|
|
3225
3733
|
|
|
3226
3734
|
<div id="set-props" class="member">
|
|
3227
3735
|
<div class="member-link">
|
|
@@ -3266,7 +3774,7 @@ path.onMouseLeave = function(event) {
|
|
|
3266
3774
|
<div class="button run">Run</div>
|
|
3267
3775
|
</div>
|
|
3268
3776
|
|
|
3269
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3777
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3270
3778
|
var circle = new Path.Circle({
|
|
3271
3779
|
center: [80, 50],
|
|
3272
3780
|
radius: 35
|
|
@@ -3279,7 +3787,7 @@ circle.set({
|
|
|
3279
3787
|
selected: true
|
|
3280
3788
|
});
|
|
3281
3789
|
</script>
|
|
3282
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3790
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3283
3791
|
</div>
|
|
3284
3792
|
|
|
3285
3793
|
|
|
@@ -3335,7 +3843,7 @@ circle.set({
|
|
|
3335
3843
|
<div class="button run">Run</div>
|
|
3336
3844
|
</div>
|
|
3337
3845
|
|
|
3338
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3846
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3339
3847
|
var circle = new Path.Circle({
|
|
3340
3848
|
center: [50, 50],
|
|
3341
3849
|
radius: 10,
|
|
@@ -3350,7 +3858,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3350
3858
|
copy.position.x += i * copy.bounds.width;
|
|
3351
3859
|
}
|
|
3352
3860
|
</script>
|
|
3353
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3861
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3354
3862
|
</div>
|
|
3355
3863
|
|
|
3356
3864
|
|
|
@@ -3476,7 +3984,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3476
3984
|
<div class="button run">Run</div>
|
|
3477
3985
|
</div>
|
|
3478
3986
|
|
|
3479
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3987
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3480
3988
|
var circle = new Path.Circle({
|
|
3481
3989
|
center: [50, 50],
|
|
3482
3990
|
radius: 5,
|
|
@@ -3493,7 +4001,7 @@ raster.position.x += 100;
|
|
|
3493
4001
|
circle.scale(5);
|
|
3494
4002
|
raster.scale(5);
|
|
3495
4003
|
</script>
|
|
3496
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4004
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3497
4005
|
</div>
|
|
3498
4006
|
|
|
3499
4007
|
|
|
@@ -3547,7 +4055,7 @@ raster.scale(5);
|
|
|
3547
4055
|
<div class="button run">Run</div>
|
|
3548
4056
|
</div>
|
|
3549
4057
|
|
|
3550
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4058
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
3551
4059
|
var path = new Path.Star({
|
|
3552
4060
|
center: [50, 50],
|
|
3553
4061
|
points: 12,
|
|
@@ -3568,7 +4076,7 @@ function onMouseDown(event) {
|
|
|
3568
4076
|
}
|
|
3569
4077
|
}
|
|
3570
4078
|
</script>
|
|
3571
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4079
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
3572
4080
|
</div>
|
|
3573
4081
|
|
|
3574
4082
|
|
|
@@ -4086,11 +4594,17 @@ function onMouseDown(event) {
|
|
|
4086
4594
|
</div>
|
|
4087
4595
|
<div class="member-description hidden">
|
|
4088
4596
|
<div class="member-text">
|
|
4089
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4597
|
+
<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><svg></code> element sized to the bounds, as <a href="../classes/Project.html#exportsvg-options"><tt>project.exportSVG(options)</tt></a> does.</p>
|
|
4090
4598
|
<ul class="member-list">
|
|
4091
4599
|
<h4>Options:</h4>
|
|
4092
|
-
<li
|
|
4093
|
-
|
|
4600
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4601
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4602
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4603
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4604
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4605
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4606
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4607
|
+
`options.bounds` the identity matrix is used.</li>
|
|
4094
4608
|
<li><tt>options.asString: <tt>Boolean</tt></tt> — whether a SVG node or a <code>String</code> is to be returned — default: <tt>false</tt></li>
|
|
4095
4609
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
4096
4610
|
<li><tt>options.matchShapes: <tt>Boolean</tt></tt> — whether path items should tried to be converted to SVG shape items (rect, circle, ellipse, line, polyline, polygon), if their geometries match — default: <tt>false</tt></li>
|
|
@@ -4098,6 +4612,12 @@ function onMouseDown(event) {
|
|
|
4098
4612
|
<li><tt>options.reuseImages: <tt>Boolean</tt></tt> — whether raster images with the same content should only be exported once into the <code><defs></code> element, and placed through <code><use></code> elements referencing it — default: <tt>false</tt></li>
|
|
4099
4613
|
<li><tt>options.idPrefix: <tt>String</tt></tt> — 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 — default: <tt>’’</tt></li>
|
|
4100
4614
|
<li><tt>options.reduceAttributes: <tt>Boolean</tt></tt> — 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). — default: <tt>true</tt></li>
|
|
4615
|
+
<li>[options.processNode] {Function} the function to process the
|
|
4616
|
+
SVG node made for each exported item, receiving an object with the
|
|
4617
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
4618
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
4619
|
+
is called before the item's name, style, visibility and data are set
|
|
4620
|
+
on the node, which replace attributes of the same names.</li>
|
|
4101
4621
|
</ul>
|
|
4102
4622
|
|
|
4103
4623
|
<ul class="member-list">
|
|
@@ -4140,6 +4660,7 @@ function onMouseDown(event) {
|
|
|
4140
4660
|
<div class="member-text">
|
|
4141
4661
|
<p>Converts the provided SVG content into Paper.js items and adds them to the this item’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>
|
|
4142
4662
|
<p><code><symbol></code> elements are imported as <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> items, and the <code><use></code> elements that place them as <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> items. The styles that <code><use></code> elements inherit don’t reach the symbols’ content.</p>
|
|
4663
|
+
<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’s SVG the layers of a project again, add them to it with <code>item.children.slice().forEach(project.addLayer, project)</code>.</p>
|
|
4143
4664
|
<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>
|
|
4144
4665
|
<ul class="member-list">
|
|
4145
4666
|
<h4>Options:</h4>
|
|
@@ -4151,6 +4672,13 @@ function onMouseDown(event) {
|
|
|
4151
4672
|
<li><tt>options.onError: <tt>Function</tt></tt> — the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
|
|
4152
4673
|
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the imported items should be added to the item that <code>importSVG()</code> is called on — default: <tt>true</tt></li>
|
|
4153
4674
|
<li><tt>options.applyMatrix: <tt>Boolean</tt></tt> — whether the imported items should have their transformation matrices applied to their contents or not — default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.applyMatrix</tt></li>
|
|
4675
|
+
<li>[options.processItem] {Function} the function to process the
|
|
4676
|
+
item made for each imported SVG element, receiving an object with
|
|
4677
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
4678
|
+
doesn't import, or return an item to replace it with. It is called
|
|
4679
|
+
after the element's attributes and data are applied to the item, so
|
|
4680
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
4681
|
+
copy them over from `item` as needed.</li>
|
|
4154
4682
|
</ul>
|
|
4155
4683
|
|
|
4156
4684
|
<ul class="member-list">
|
|
@@ -5430,7 +5958,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5430
5958
|
<div class="button run">Run</div>
|
|
5431
5959
|
</div>
|
|
5432
5960
|
|
|
5433
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5961
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5434
5962
|
// Create a rectangle shaped path with its top left
|
|
5435
5963
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5436
5964
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5439,7 +5967,7 @@ path.fillColor = 'black';
|
|
|
5439
5967
|
// Rotate the path by 30 degrees:
|
|
5440
5968
|
path.rotate(30);
|
|
5441
5969
|
</script>
|
|
5442
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5970
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
5443
5971
|
</div>
|
|
5444
5972
|
|
|
5445
5973
|
|
|
@@ -5451,7 +5979,7 @@ path.rotate(30);
|
|
|
5451
5979
|
<div class="button run">Run</div>
|
|
5452
5980
|
</div>
|
|
5453
5981
|
|
|
5454
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5982
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5455
5983
|
// Create a rectangle shaped path with its top left
|
|
5456
5984
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5457
5985
|
var topLeft = new Point(175, 50);
|
|
@@ -5473,7 +6001,7 @@ function onFrame(event) {
|
|
|
5473
6001
|
path.rotate(3, view.center);
|
|
5474
6002
|
}
|
|
5475
6003
|
</script>
|
|
5476
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6004
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-44"></canvas></div>
|
|
5477
6005
|
</div>
|
|
5478
6006
|
|
|
5479
6007
|
|
|
@@ -5522,7 +6050,7 @@ function onFrame(event) {
|
|
|
5522
6050
|
<div class="button run">Run</div>
|
|
5523
6051
|
</div>
|
|
5524
6052
|
|
|
5525
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6053
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5526
6054
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5527
6055
|
// with a radius of 20:
|
|
5528
6056
|
var circle = new Path.Circle({
|
|
@@ -5534,7 +6062,7 @@ var circle = new Path.Circle({
|
|
|
5534
6062
|
// Scale the path by 150% from its center point
|
|
5535
6063
|
circle.scale(1.5);
|
|
5536
6064
|
</script>
|
|
5537
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6065
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5538
6066
|
</div>
|
|
5539
6067
|
|
|
5540
6068
|
|
|
@@ -5546,7 +6074,7 @@ circle.scale(1.5);
|
|
|
5546
6074
|
<div class="button run">Run</div>
|
|
5547
6075
|
</div>
|
|
5548
6076
|
|
|
5549
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6077
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5550
6078
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5551
6079
|
// with a radius of 20:
|
|
5552
6080
|
var circle = new Path.Circle({
|
|
@@ -5558,7 +6086,7 @@ var circle = new Path.Circle({
|
|
|
5558
6086
|
// Scale the path 150% from its bottom left corner
|
|
5559
6087
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5560
6088
|
</script>
|
|
5561
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6089
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5562
6090
|
</div>
|
|
5563
6091
|
|
|
5564
6092
|
|
|
@@ -5614,7 +6142,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5614
6142
|
<div class="button run">Run</div>
|
|
5615
6143
|
</div>
|
|
5616
6144
|
|
|
5617
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6145
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5618
6146
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5619
6147
|
// with a radius of 20:
|
|
5620
6148
|
var circle = new Path.Circle({
|
|
@@ -5626,7 +6154,7 @@ var circle = new Path.Circle({
|
|
|
5626
6154
|
// Scale the path horizontally by 300%
|
|
5627
6155
|
circle.scale(3, 1);
|
|
5628
6156
|
</script>
|
|
5629
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6157
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5630
6158
|
</div>
|
|
5631
6159
|
|
|
5632
6160
|
|
|
@@ -6064,7 +6592,7 @@ circle.scale(3, 1);
|
|
|
6064
6592
|
<div class="button run">Run</div>
|
|
6065
6593
|
</div>
|
|
6066
6594
|
|
|
6067
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6595
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
6068
6596
|
// Create a rectangle shaped path with its top left corner
|
|
6069
6597
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6070
6598
|
var path = new Path.Rectangle({
|
|
@@ -6085,7 +6613,7 @@ var circlePath = new Path.Circle({
|
|
|
6085
6613
|
// the rectangular path:
|
|
6086
6614
|
circlePath.fitBounds(path.bounds);
|
|
6087
6615
|
</script>
|
|
6088
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6616
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
6089
6617
|
</div>
|
|
6090
6618
|
|
|
6091
6619
|
|
|
@@ -6097,7 +6625,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
6097
6625
|
<div class="button run">Run</div>
|
|
6098
6626
|
</div>
|
|
6099
6627
|
|
|
6100
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6628
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
6101
6629
|
// Create a rectangle shaped path with its top left corner
|
|
6102
6630
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6103
6631
|
var path = new Path.Rectangle({
|
|
@@ -6118,7 +6646,7 @@ var circlePath = new Path.Circle({
|
|
|
6118
6646
|
// the rectangular path:
|
|
6119
6647
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
6120
6648
|
</script>
|
|
6121
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6649
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
6122
6650
|
</div>
|
|
6123
6651
|
|
|
6124
6652
|
|
|
@@ -6130,7 +6658,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
6130
6658
|
<div class="button run">Run</div>
|
|
6131
6659
|
</div>
|
|
6132
6660
|
|
|
6133
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6661
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
6134
6662
|
var path = new Path.Circle({
|
|
6135
6663
|
center: [80, 50],
|
|
6136
6664
|
radius: 30,
|
|
@@ -6140,7 +6668,7 @@ var path = new Path.Circle({
|
|
|
6140
6668
|
// Fit the path to the bounding rectangle of the view:
|
|
6141
6669
|
path.fitBounds(view.bounds);
|
|
6142
6670
|
</script>
|
|
6143
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6671
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-50"></canvas></div>
|
|
6144
6672
|
</div>
|
|
6145
6673
|
|
|
6146
6674
|
|
|
@@ -6166,7 +6694,7 @@ path.fitBounds(view.bounds);
|
|
|
6166
6694
|
<li>
|
|
6167
6695
|
<tt>type:</tt>
|
|
6168
6696
|
<tt>String</tt>
|
|
6169
|
-
— the type of event: <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>
|
|
6697
|
+
— the type of event: <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>
|
|
6170
6698
|
|
|
6171
6699
|
</li>
|
|
6172
6700
|
|
|
@@ -6201,7 +6729,7 @@ path.fitBounds(view.bounds);
|
|
|
6201
6729
|
<div class="button run">Run</div>
|
|
6202
6730
|
</div>
|
|
6203
6731
|
|
|
6204
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6732
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
6205
6733
|
// Create a circle shaped path at the center of the view:
|
|
6206
6734
|
var path = new Path.Circle({
|
|
6207
6735
|
center: view.center,
|
|
@@ -6219,7 +6747,7 @@ path.on('mouseleave', function() {
|
|
|
6219
6747
|
this.fillColor = 'black';
|
|
6220
6748
|
});
|
|
6221
6749
|
</script>
|
|
6222
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6750
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6223
6751
|
</div>
|
|
6224
6752
|
|
|
6225
6753
|
|
|
@@ -6243,7 +6771,7 @@ path.on('mouseleave', function() {
|
|
|
6243
6771
|
<li>
|
|
6244
6772
|
<tt>object:</tt>
|
|
6245
6773
|
<tt>Object</tt>
|
|
6246
|
-
— 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>
|
|
6774
|
+
— 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>
|
|
6247
6775
|
|
|
6248
6776
|
</li>
|
|
6249
6777
|
|
|
@@ -6271,7 +6799,7 @@ path.on('mouseleave', function() {
|
|
|
6271
6799
|
<div class="button run">Run</div>
|
|
6272
6800
|
</div>
|
|
6273
6801
|
|
|
6274
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6802
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6275
6803
|
// Create a circle shaped path at the center of the view:
|
|
6276
6804
|
var path = new Path.Circle({
|
|
6277
6805
|
center: view.center,
|
|
@@ -6289,7 +6817,7 @@ path.on({
|
|
|
6289
6817
|
}
|
|
6290
6818
|
});
|
|
6291
6819
|
</script>
|
|
6292
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6820
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6293
6821
|
</div>
|
|
6294
6822
|
|
|
6295
6823
|
|
|
@@ -6301,7 +6829,7 @@ path.on({
|
|
|
6301
6829
|
<div class="button run">Run</div>
|
|
6302
6830
|
</div>
|
|
6303
6831
|
|
|
6304
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6832
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6305
6833
|
var pathHandlers = {
|
|
6306
6834
|
mouseenter: function(event) {
|
|
6307
6835
|
this.fillColor = 'red';
|
|
@@ -6324,7 +6852,7 @@ function onMouseDown(event) {
|
|
|
6324
6852
|
path.on(pathHandlers);
|
|
6325
6853
|
}
|
|
6326
6854
|
</script>
|
|
6327
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6855
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
|
|
6328
6856
|
</div>
|
|
6329
6857
|
|
|
6330
6858
|
|
|
@@ -6348,7 +6876,7 @@ function onMouseDown(event) {
|
|
|
6348
6876
|
<li>
|
|
6349
6877
|
<tt>type:</tt>
|
|
6350
6878
|
<tt>String</tt>
|
|
6351
|
-
— the type of event: <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>
|
|
6879
|
+
— the type of event: <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>
|
|
6352
6880
|
|
|
6353
6881
|
</li>
|
|
6354
6882
|
|
|
@@ -6396,7 +6924,7 @@ function onMouseDown(event) {
|
|
|
6396
6924
|
<li>
|
|
6397
6925
|
<tt>object:</tt>
|
|
6398
6926
|
<tt>Object</tt>
|
|
6399
|
-
— 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>
|
|
6927
|
+
— 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>
|
|
6400
6928
|
|
|
6401
6929
|
</li>
|
|
6402
6930
|
|
|
@@ -6437,7 +6965,7 @@ function onMouseDown(event) {
|
|
|
6437
6965
|
<li>
|
|
6438
6966
|
<tt>type:</tt>
|
|
6439
6967
|
<tt>String</tt>
|
|
6440
|
-
— the type of event: <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>
|
|
6968
|
+
— the type of event: <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>
|
|
6441
6969
|
|
|
6442
6970
|
</li>
|
|
6443
6971
|
|
|
@@ -6485,7 +7013,7 @@ function onMouseDown(event) {
|
|
|
6485
7013
|
<li>
|
|
6486
7014
|
<tt>type:</tt>
|
|
6487
7015
|
<tt>String</tt>
|
|
6488
|
-
— the type of event: <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>
|
|
7016
|
+
— the type of event: <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>
|
|
6489
7017
|
|
|
6490
7018
|
</li>
|
|
6491
7019
|
|
|
@@ -6552,7 +7080,7 @@ function onMouseDown(event) {
|
|
|
6552
7080
|
<div class="button run">Run</div>
|
|
6553
7081
|
</div>
|
|
6554
7082
|
|
|
6555
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7083
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6556
7084
|
function onMouseDrag(event) {
|
|
6557
7085
|
// Create a circle shaped path at the mouse position,
|
|
6558
7086
|
// with a radius of 10:
|
|
@@ -6569,7 +7097,7 @@ function onMouseDrag(event) {
|
|
|
6569
7097
|
});
|
|
6570
7098
|
}
|
|
6571
7099
|
</script>
|
|
6572
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7100
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6573
7101
|
</div>
|
|
6574
7102
|
|
|
6575
7103
|
|
|
@@ -6599,7 +7127,7 @@ function onMouseDrag(event) {
|
|
|
6599
7127
|
<div class="button run">Run</div>
|
|
6600
7128
|
</div>
|
|
6601
7129
|
|
|
6602
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7130
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6603
7131
|
function onMouseMove(event) {
|
|
6604
7132
|
// Create a circle shaped path at the mouse position,
|
|
6605
7133
|
// with a radius of 10:
|
|
@@ -6613,7 +7141,7 @@ function onMouseMove(event) {
|
|
|
6613
7141
|
path.removeOnMove();
|
|
6614
7142
|
}
|
|
6615
7143
|
</script>
|
|
6616
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7144
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6617
7145
|
</div>
|
|
6618
7146
|
|
|
6619
7147
|
|
|
@@ -6643,7 +7171,7 @@ function onMouseMove(event) {
|
|
|
6643
7171
|
<div class="button run">Run</div>
|
|
6644
7172
|
</div>
|
|
6645
7173
|
|
|
6646
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7174
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6647
7175
|
function onMouseDown(event) {
|
|
6648
7176
|
// Create a circle shaped path at the mouse position,
|
|
6649
7177
|
// with a radius of 10:
|
|
@@ -6657,7 +7185,7 @@ function onMouseDown(event) {
|
|
|
6657
7185
|
path.removeOnDown();
|
|
6658
7186
|
}
|
|
6659
7187
|
</script>
|
|
6660
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7188
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6661
7189
|
</div>
|
|
6662
7190
|
|
|
6663
7191
|
|
|
@@ -6687,7 +7215,7 @@ function onMouseDown(event) {
|
|
|
6687
7215
|
<div class="button run">Run</div>
|
|
6688
7216
|
</div>
|
|
6689
7217
|
|
|
6690
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7218
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6691
7219
|
function onMouseDrag(event) {
|
|
6692
7220
|
// Create a circle shaped path at the mouse position,
|
|
6693
7221
|
// with a radius of 10:
|
|
@@ -6701,7 +7229,7 @@ function onMouseDrag(event) {
|
|
|
6701
7229
|
path.removeOnDrag();
|
|
6702
7230
|
}
|
|
6703
7231
|
</script>
|
|
6704
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7232
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
|
|
6705
7233
|
</div>
|
|
6706
7234
|
|
|
6707
7235
|
|
|
@@ -6731,7 +7259,7 @@ function onMouseDrag(event) {
|
|
|
6731
7259
|
<div class="button run">Run</div>
|
|
6732
7260
|
</div>
|
|
6733
7261
|
|
|
6734
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7262
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6735
7263
|
function onMouseDown(event) {
|
|
6736
7264
|
// Create a circle shaped path at the mouse position,
|
|
6737
7265
|
// with a radius of 10:
|
|
@@ -6745,7 +7273,7 @@ function onMouseDown(event) {
|
|
|
6745
7273
|
path.removeOnUp();
|
|
6746
7274
|
}
|
|
6747
7275
|
</script>
|
|
6748
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7276
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
|
|
6749
7277
|
</div>
|
|
6750
7278
|
|
|
6751
7279
|
|
|
@@ -6818,7 +7346,7 @@ function onMouseDown(event) {
|
|
|
6818
7346
|
<div class="button run">Run</div>
|
|
6819
7347
|
</div>
|
|
6820
7348
|
|
|
6821
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7349
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6822
7350
|
var path = new Path.Circle({
|
|
6823
7351
|
radius: view.bounds.height * 0.4,
|
|
6824
7352
|
center: view.center
|
|
@@ -6829,7 +7357,7 @@ path.tween(
|
|
|
6829
7357
|
3000
|
|
6830
7358
|
);
|
|
6831
7359
|
</script>
|
|
6832
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7360
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
6833
7361
|
</div>
|
|
6834
7362
|
|
|
6835
7363
|
|
|
@@ -6841,7 +7369,7 @@ path.tween(
|
|
|
6841
7369
|
<div class="button run">Run</div>
|
|
6842
7370
|
</div>
|
|
6843
7371
|
|
|
6844
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7372
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6845
7373
|
var path = new Shape.Rectangle({
|
|
6846
7374
|
fillColor: 'red',
|
|
6847
7375
|
center: [50, view.center.y],
|
|
@@ -6856,7 +7384,7 @@ path.tween({
|
|
|
6856
7384
|
duration: 2000
|
|
6857
7385
|
});
|
|
6858
7386
|
</script>
|
|
6859
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7387
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
|
|
6860
7388
|
</div>
|
|
6861
7389
|
|
|
6862
7390
|
|
|
@@ -6922,7 +7450,7 @@ path.tween({
|
|
|
6922
7450
|
<div class="button run">Run</div>
|
|
6923
7451
|
</div>
|
|
6924
7452
|
|
|
6925
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7453
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6926
7454
|
var path = new Path.Rectangle({
|
|
6927
7455
|
size: [100, 100],
|
|
6928
7456
|
position: view.center,
|
|
@@ -6936,7 +7464,7 @@ path.tween({
|
|
|
6936
7464
|
'segments[2].point.x': '-= 50'
|
|
6937
7465
|
}, 3000);
|
|
6938
7466
|
</script>
|
|
6939
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7467
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
|
|
6940
7468
|
</div>
|
|
6941
7469
|
|
|
6942
7470
|
|
|
@@ -6995,7 +7523,7 @@ path.tween({
|
|
|
6995
7523
|
<div class="button run">Run</div>
|
|
6996
7524
|
</div>
|
|
6997
7525
|
|
|
6998
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7526
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
6999
7527
|
var path = new Path.Circle({
|
|
7000
7528
|
fillColor: 'blue',
|
|
7001
7529
|
radius: view.bounds.height * 0.4,
|
|
@@ -7011,7 +7539,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7011
7539
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
7012
7540
|
};
|
|
7013
7541
|
</script>
|
|
7014
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7542
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
7015
7543
|
</div>
|
|
7016
7544
|
|
|
7017
7545
|
|
|
@@ -7132,7 +7660,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7132
7660
|
<div class="button run">Run</div>
|
|
7133
7661
|
</div>
|
|
7134
7662
|
|
|
7135
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7663
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
7136
7664
|
var path = new Path.Circle({
|
|
7137
7665
|
fillColor: 'blue',
|
|
7138
7666
|
radius: view.bounds.height * 0.4,
|
|
@@ -7140,7 +7668,7 @@ var path = new Path.Circle({
|
|
|
7140
7668
|
});
|
|
7141
7669
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
7142
7670
|
</script>
|
|
7143
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7671
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
7144
7672
|
</div>
|
|
7145
7673
|
|
|
7146
7674
|
|
|
@@ -8273,7 +8801,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
|
|
|
8273
8801
|
<div class="member-description hidden">
|
|
8274
8802
|
|
|
8275
8803
|
<div class="member-text">
|
|
8276
|
-
<p>The direction the paragraph’s lines run in, which <code>'start'</code> and <code>'end'</code> follow; <code>null</code> for left to right.</p>
|
|
8804
|
+
<p>The direction the paragraph’s lines run in, which <code>'start'</code> and <code>'end'</code> follow, and from which side their pieces are placed; <code>null</code> for left to right. Lines that mix directions across styles aren’t reordered by the Unicode bidirectional algorithm: their pieces follow the paragraph’s direction, and canvas orders only the letters within each piece.</p>
|
|
8277
8805
|
|
|
8278
8806
|
|
|
8279
8807
|
<ul class="member-list">
|
|
@@ -8649,7 +9177,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
|
|
|
8649
9177
|
|
|
8650
9178
|
<!-- =========================== copyright notice ========================== -->
|
|
8651
9179
|
<p class="footer">
|
|
8652
|
-
Paper.js v0.
|
|
9180
|
+
Paper.js v0.17.0<br>
|
|
8653
9181
|
Copyright © 2011—2026 <a href="http://www.lehni.org" target="_blank">Jürg Lehni</a> & <a href="http://www.jonathanpuckey.com" target="_blank">Jonathan Puckey</a>. All Rights Reserved.</p>
|
|
8654
9182
|
<div class="content-end"></div>
|
|
8655
9183
|
|