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
|
@@ -517,6 +517,221 @@ result.fillColor = 'red';
|
|
|
517
517
|
|
|
518
518
|
|
|
519
519
|
|
|
520
|
+
</div>
|
|
521
|
+
</div>
|
|
522
|
+
</div>
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
<h3>Offsetting and Outlining</h3>
|
|
526
|
+
|
|
527
|
+
<div id="offset-distance" class="member">
|
|
528
|
+
<div class="member-link">
|
|
529
|
+
<a name="offset-distance" href="#offset-distance"><tt><b>offset</b>(distance[, options])</tt></a>
|
|
530
|
+
</div>
|
|
531
|
+
<div class="member-description hidden">
|
|
532
|
+
<div class="member-text">
|
|
533
|
+
<p>Offsets the path item by the given distance and returns the result as a new path item. Closed paths and compound paths grow by positive distances and shrink by negative ones, open paths are offset along their normals for positive distances, and against them for negative ones. As with the boolean operations, the path item’s matrix is applied first.</p>
|
|
534
|
+
<ul class="member-list">
|
|
535
|
+
<h4>Options:</h4>
|
|
536
|
+
<li><tt>options.join: <tt>String</tt></tt> — the shape of the corners that the offset adds where the path turns away from it: <tt>‘miter’</tt>, <tt>‘round’</tt>, <tt>‘bevel’</tt> — default: <tt>‘miter’</tt></li>
|
|
537
|
+
<li><tt>options.miterLimit: <tt>Number</tt></tt> — the limit of miter corners, see <a href="../classes/Style.html#miterlimit"><tt>style.miterLimit</tt></a> — default: <tt>10</tt></li>
|
|
538
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting item should be inserted back into the scene graph, above this path — default: <tt>true</tt></li>
|
|
539
|
+
</ul>
|
|
540
|
+
|
|
541
|
+
<ul class="member-list">
|
|
542
|
+
<h4>Parameters:</h4>
|
|
543
|
+
|
|
544
|
+
<li>
|
|
545
|
+
<tt>distance:</tt>
|
|
546
|
+
<tt>Number</tt>
|
|
547
|
+
— the distance to offset the path item by
|
|
548
|
+
|
|
549
|
+
</li>
|
|
550
|
+
|
|
551
|
+
<li>
|
|
552
|
+
<tt>options:</tt>
|
|
553
|
+
<tt>Object</tt>
|
|
554
|
+
— the offset options
|
|
555
|
+
— optional
|
|
556
|
+
</li>
|
|
557
|
+
|
|
558
|
+
</ul>
|
|
559
|
+
|
|
560
|
+
|
|
561
|
+
<ul class="member-list">
|
|
562
|
+
<h4>Returns:</h4>
|
|
563
|
+
|
|
564
|
+
<li>
|
|
565
|
+
<tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt> — the resulting path item
|
|
566
|
+
</li>
|
|
567
|
+
|
|
568
|
+
|
|
569
|
+
</ul>
|
|
570
|
+
|
|
571
|
+
|
|
572
|
+
|
|
573
|
+
|
|
574
|
+
<h4>Example:</h4>
|
|
575
|
+
|
|
576
|
+
<div class="paperscript split">
|
|
577
|
+
|
|
578
|
+
<div class="buttons">
|
|
579
|
+
<div class="button run">Run</div>
|
|
580
|
+
</div>
|
|
581
|
+
|
|
582
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
583
|
+
var path = new Path.Star([50, 50], 5, 20, 40);
|
|
584
|
+
path.strokeColor = 'black';
|
|
585
|
+
var result = path.offset(10, { join: 'round' });
|
|
586
|
+
result.strokeColor = 'red';
|
|
587
|
+
</script>
|
|
588
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
589
|
+
</div>
|
|
590
|
+
|
|
591
|
+
|
|
592
|
+
</div>
|
|
593
|
+
</div>
|
|
594
|
+
</div>
|
|
595
|
+
|
|
596
|
+
|
|
597
|
+
<div id="outline" class="member">
|
|
598
|
+
<div class="member-link">
|
|
599
|
+
<a name="outline" href="#outline"><tt><b>outline</b>([options])</tt></a>
|
|
600
|
+
</div>
|
|
601
|
+
<div class="member-description hidden">
|
|
602
|
+
<div class="member-text">
|
|
603
|
+
<p>Outlines the stroke of the path item, and returns the area that it covers as a new path item, filled with the stroke’s color. As with the boolean operations, the path item’s matrix is applied first. Dashed strokes are outlined as their dashes, each with the stroke’s caps, as the canvas draws them, see <a href="../classes/PathItem.html#dash-options"><tt>dash(options)</tt></a>.</p>
|
|
604
|
+
<p>Paths with a <a href="../classes/Path.html#strokeprofile"><tt>path.strokeProfile</tt></a> are outlined as the area that its pens sweep. Their round joins and caps are the pens themselves, and their other joins and caps connect the points where the pens touch the sides of the stroke. Steps in the profile end the parts of the stroke straight across, as butt caps do.</p>
|
|
605
|
+
<ul class="member-list">
|
|
606
|
+
<h4>Options:</h4>
|
|
607
|
+
<li><tt>options.width: <tt>Number</tt></tt> — the width of the stroke — default: <tt>this.strokeWidth</tt></li>
|
|
608
|
+
<li><tt>options.join: <tt>String</tt></tt> — the shape of the stroke’s corners: <tt>‘miter’</tt>, <tt>‘round’</tt>, <tt>‘bevel’</tt> — default: <tt>this.strokeJoin</tt></li>
|
|
609
|
+
<li><tt>options.cap: <tt>String</tt></tt> — the shape of the stroke’s ends: <tt>‘round’</tt>, <tt>‘square’</tt>, <tt>‘butt’</tt> — default: <tt>this.strokeCap</tt></li>
|
|
610
|
+
<li><tt>options.miterLimit: <tt>Number</tt></tt> — the limit of miter corners, see <a href="../classes/Style.html#miterlimit"><tt>style.miterLimit</tt></a> — default: <tt>this.miterLimit</tt></li>
|
|
611
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting item should be inserted back into the scene graph, above this path — default: <tt>true</tt></li>
|
|
612
|
+
</ul>
|
|
613
|
+
|
|
614
|
+
<ul class="member-list">
|
|
615
|
+
<h4>Parameters:</h4>
|
|
616
|
+
|
|
617
|
+
<li>
|
|
618
|
+
<tt>options:</tt>
|
|
619
|
+
<tt>Object</tt>
|
|
620
|
+
— the outline options
|
|
621
|
+
— optional
|
|
622
|
+
</li>
|
|
623
|
+
|
|
624
|
+
</ul>
|
|
625
|
+
|
|
626
|
+
|
|
627
|
+
<ul class="member-list">
|
|
628
|
+
<h4>Returns:</h4>
|
|
629
|
+
|
|
630
|
+
<li>
|
|
631
|
+
<tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt> — the resulting path item
|
|
632
|
+
</li>
|
|
633
|
+
|
|
634
|
+
|
|
635
|
+
</ul>
|
|
636
|
+
|
|
637
|
+
|
|
638
|
+
|
|
639
|
+
|
|
640
|
+
<h4>Example:</h4>
|
|
641
|
+
|
|
642
|
+
<div class="paperscript split">
|
|
643
|
+
|
|
644
|
+
<div class="buttons">
|
|
645
|
+
<div class="button run">Run</div>
|
|
646
|
+
</div>
|
|
647
|
+
|
|
648
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
649
|
+
var path = new Path.Arc([20, 70], [50, 20], [80, 70]);
|
|
650
|
+
path.strokeColor = 'black';
|
|
651
|
+
path.strokeWidth = 20;
|
|
652
|
+
path.strokeCap = 'round';
|
|
653
|
+
var result = path.outline();
|
|
654
|
+
result.strokeColor = 'red';
|
|
655
|
+
result.strokeWidth = 1;
|
|
656
|
+
path.remove();
|
|
657
|
+
</script>
|
|
658
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
659
|
+
</div>
|
|
660
|
+
|
|
661
|
+
|
|
662
|
+
</div>
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
|
|
666
|
+
|
|
667
|
+
<div id="dash" class="member">
|
|
668
|
+
<div class="member-link">
|
|
669
|
+
<a name="dash" href="#dash"><tt><b>dash</b>([options])</tt></a>
|
|
670
|
+
</div>
|
|
671
|
+
<div class="member-description hidden">
|
|
672
|
+
<div class="member-text">
|
|
673
|
+
<p>Cuts the stroke of the path item into its dashes, as the canvas draws them with the <a href="../classes/Style.html#dasharray"><tt>style.dashArray</tt></a> and <a href="../classes/Style.html#dashoffset"><tt>style.dashOffset</tt></a> of the path item or those of the options, and returns them as a new group of open paths with the path item’s style, without its dash pattern. The pattern starts over on each path of a compound path, and the dashes keep the parts of the paths’ stroke profiles. As with the boolean operations, the path item’s matrix is applied first.</p>
|
|
674
|
+
<ul class="member-list">
|
|
675
|
+
<h4>Options:</h4>
|
|
676
|
+
<li><tt>options.dashArray: Array of <tt>Numbers</tt></tt> — the lengths of the dashes and the gaps between them — default: <tt>this.dashArray</tt></li>
|
|
677
|
+
<li><tt>options.dashOffset: <tt>Number</tt></tt> — the offset into the pattern at which the dashes start — default: <tt>this.dashOffset</tt></li>
|
|
678
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting group should be inserted back into the scene graph, above this path item — default: <tt>true</tt></li>
|
|
679
|
+
</ul>
|
|
680
|
+
|
|
681
|
+
<ul class="member-list">
|
|
682
|
+
<h4>Parameters:</h4>
|
|
683
|
+
|
|
684
|
+
<li>
|
|
685
|
+
<tt>options:</tt>
|
|
686
|
+
<tt>Object</tt>
|
|
687
|
+
— the dash options
|
|
688
|
+
— optional
|
|
689
|
+
</li>
|
|
690
|
+
|
|
691
|
+
</ul>
|
|
692
|
+
|
|
693
|
+
|
|
694
|
+
<ul class="member-list">
|
|
695
|
+
<h4>Returns:</h4>
|
|
696
|
+
|
|
697
|
+
<li>
|
|
698
|
+
<tt><a href="../classes/Group.html"><tt>Group</tt></a></tt> — the dashes, as a new group of paths
|
|
699
|
+
</li>
|
|
700
|
+
|
|
701
|
+
|
|
702
|
+
</ul>
|
|
703
|
+
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
|
|
707
|
+
<h4>Example:</h4>
|
|
708
|
+
|
|
709
|
+
<div class="paperscript split">
|
|
710
|
+
|
|
711
|
+
<div class="buttons">
|
|
712
|
+
<div class="button run">Run</div>
|
|
713
|
+
</div>
|
|
714
|
+
|
|
715
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
716
|
+
var path = new Path.Circle({
|
|
717
|
+
center: [80, 50],
|
|
718
|
+
radius: 35,
|
|
719
|
+
strokeColor: 'black',
|
|
720
|
+
strokeWidth: 4,
|
|
721
|
+
dashArray: [12, 6]
|
|
722
|
+
});
|
|
723
|
+
// Turn every other dash red:
|
|
724
|
+
var dashes = path.dash();
|
|
725
|
+
dashes.children.forEach(function(dash, i) {
|
|
726
|
+
if (i % 2)
|
|
727
|
+
dash.strokeColor = 'red';
|
|
728
|
+
});
|
|
729
|
+
path.remove();
|
|
730
|
+
</script>
|
|
731
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
732
|
+
</div>
|
|
733
|
+
|
|
734
|
+
|
|
520
735
|
</div>
|
|
521
736
|
</div>
|
|
522
737
|
</div>
|
|
@@ -581,7 +796,7 @@ result.fillColor = 'red';
|
|
|
581
796
|
<div class="button run">Run</div>
|
|
582
797
|
</div>
|
|
583
798
|
|
|
584
|
-
<script type="text/paperscript" canvas="canvas-
|
|
799
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
585
800
|
var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
|
|
586
801
|
path.strokeColor = 'black';
|
|
587
802
|
|
|
@@ -604,7 +819,7 @@ function onFrame(event) {
|
|
|
604
819
|
}
|
|
605
820
|
}
|
|
606
821
|
</script>
|
|
607
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
822
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
608
823
|
</div>
|
|
609
824
|
|
|
610
825
|
|
|
@@ -745,7 +960,7 @@ function onFrame(event) {
|
|
|
745
960
|
<div class="button run">Run</div>
|
|
746
961
|
</div>
|
|
747
962
|
|
|
748
|
-
<script type="text/paperscript" canvas="canvas-
|
|
963
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
749
964
|
var star = new Path.Star({
|
|
750
965
|
center: view.center,
|
|
751
966
|
points: 10,
|
|
@@ -769,7 +984,7 @@ function onMouseMove(event) {
|
|
|
769
984
|
circle.position = nearestPoint;
|
|
770
985
|
}
|
|
771
986
|
</script>
|
|
772
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
987
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-9"></canvas></div>
|
|
773
988
|
</div>
|
|
774
989
|
|
|
775
990
|
|
|
@@ -832,7 +1047,7 @@ function onMouseMove(event) {
|
|
|
832
1047
|
<div class="button run">Run</div>
|
|
833
1048
|
</div>
|
|
834
1049
|
|
|
835
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1050
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
836
1051
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
837
1052
|
// with a radius of 35:
|
|
838
1053
|
var path = new Path.Circle({
|
|
@@ -850,7 +1065,7 @@ copy.position.x += 150;
|
|
|
850
1065
|
// Flatten the copied path, with a maximum error of 4 points:
|
|
851
1066
|
copy.flatten(4);
|
|
852
1067
|
</script>
|
|
853
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1068
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
854
1069
|
</div>
|
|
855
1070
|
|
|
856
1071
|
|
|
@@ -928,7 +1143,7 @@ copy.flatten(4);
|
|
|
928
1143
|
<div class="button run">Run</div>
|
|
929
1144
|
</div>
|
|
930
1145
|
|
|
931
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1146
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
932
1147
|
// Create a rectangular path with its top-left point at
|
|
933
1148
|
// {x: 30, y: 25} and a size of {width: 50, height: 50}:
|
|
934
1149
|
var path = new Path.Rectangle({
|
|
@@ -947,7 +1162,7 @@ copy.position.x += 100;
|
|
|
947
1162
|
// Smooth the segments of the copy:
|
|
948
1163
|
copy.smooth({ type: 'continuous' });
|
|
949
1164
|
</script>
|
|
950
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1165
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
951
1166
|
</div>
|
|
952
1167
|
|
|
953
1168
|
|
|
@@ -959,7 +1174,7 @@ copy.smooth({ type: 'continuous' });
|
|
|
959
1174
|
<div class="button run">Run</div>
|
|
960
1175
|
</div>
|
|
961
1176
|
|
|
962
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1177
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
963
1178
|
var path = new Path();
|
|
964
1179
|
path.strokeColor = 'black';
|
|
965
1180
|
|
|
@@ -984,7 +1199,7 @@ copy.fullySelected = true;
|
|
|
984
1199
|
// Smooth the path using centripetal Catmull-Rom splines:
|
|
985
1200
|
copy.smooth({ type: 'catmull-rom', factor: 0.5 });
|
|
986
1201
|
</script>
|
|
987
|
-
<div class="canvas"><canvas width="516" height="220" id="canvas-
|
|
1202
|
+
<div class="canvas"><canvas width="516" height="220" id="canvas-12"></canvas></div>
|
|
988
1203
|
</div>
|
|
989
1204
|
|
|
990
1205
|
|
|
@@ -996,7 +1211,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
|
|
|
996
1211
|
<div class="button run">Run</div>
|
|
997
1212
|
</div>
|
|
998
1213
|
|
|
999
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1214
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1000
1215
|
// Create 5 rectangles, next to each other:
|
|
1001
1216
|
var paths = [];
|
|
1002
1217
|
for (var i = 0; i < 5; i++) {
|
|
@@ -1026,7 +1241,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
|
|
|
1026
1241
|
// Smooth a range, using negative indices:
|
|
1027
1242
|
paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
|
|
1028
1243
|
</script>
|
|
1029
|
-
<div class="canvas"><canvas width="516" height="110" id="canvas-
|
|
1244
|
+
<div class="canvas"><canvas width="516" height="110" id="canvas-13"></canvas></div>
|
|
1030
1245
|
</div>
|
|
1031
1246
|
|
|
1032
1247
|
|
|
@@ -1037,22 +1252,28 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
|
|
|
1037
1252
|
|
|
1038
1253
|
<div id="simplify" class="member">
|
|
1039
1254
|
<div class="member-link">
|
|
1040
|
-
<a name="simplify" href="#simplify"><tt><b>simplify</b>([
|
|
1255
|
+
<a name="simplify" href="#simplify"><tt><b>simplify</b>([options])</tt></a>
|
|
1041
1256
|
</div>
|
|
1042
1257
|
<div class="member-description hidden">
|
|
1043
1258
|
<div class="member-text">
|
|
1044
1259
|
<p>Fits a sequence of as few curves as possible through the path’s anchor points, ignoring the path items’s curve-handles, with an allowed maximum error. When called on <a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a> items, each of the nested paths is simplified. On <a href="../classes/Path.html"><tt>Path</tt></a> items, the <a href="../classes/Path.html#segments"><tt>path.segments</tt></a> array is processed and replaced by the resulting sequence of fitted curves.</p>
|
|
1045
1260
|
<p>This method can be used to process and simplify the point data received from a mouse or touch device.</p>
|
|
1046
|
-
|
|
1261
|
+
<p>With <code>options.from</code> and <code>options.to</code>, only the segments in that range are replaced. The fitted curves join the curves outside of the range tangentially where these have handles.</p>
|
|
1262
|
+
<ul class="member-list">
|
|
1263
|
+
<h4>Options:</h4>
|
|
1264
|
+
<li><tt>options.tolerance: <tt>Number</tt></tt> — the allowed maximum error when fitting the curves through the segment points — default: <tt>2.5</tt></li>
|
|
1265
|
+
<li><tt>options.from: <tt>Number</tt>⟋<a href="../classes/Segment.html"><tt>Segment</tt></a>⟋<a href="../classes/Curve.html"><tt>Curve</tt></a></tt> — the segment or curve at which to start simplifying, if not the full path shall be simplified (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path.</li>
|
|
1266
|
+
<li><tt>options.to: <tt>Number</tt>⟋<a href="../classes/Segment.html"><tt>Segment</tt></a>⟋<a href="../classes/Curve.html"><tt>Curve</tt></a></tt> — the segment or curve up to which to simplify (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path.</li>
|
|
1267
|
+
</ul>
|
|
1047
1268
|
|
|
1048
1269
|
<ul class="member-list">
|
|
1049
1270
|
<h4>Parameters:</h4>
|
|
1050
1271
|
|
|
1051
1272
|
<li>
|
|
1052
|
-
<tt>
|
|
1053
|
-
<tt>Number</tt>
|
|
1054
|
-
— the
|
|
1055
|
-
— optional
|
|
1273
|
+
<tt>options:</tt>
|
|
1274
|
+
<tt>Object</tt>⟋<tt>Number</tt>
|
|
1275
|
+
— the simplification options, or the tolerance as a number
|
|
1276
|
+
— optional
|
|
1056
1277
|
</li>
|
|
1057
1278
|
|
|
1058
1279
|
</ul>
|
|
@@ -1079,7 +1300,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
|
|
|
1079
1300
|
<div class="button run">Run</div>
|
|
1080
1301
|
</div>
|
|
1081
1302
|
|
|
1082
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1303
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1083
1304
|
var path;
|
|
1084
1305
|
function onMouseDown(event) {
|
|
1085
1306
|
// If we already made a path before, deselect it:
|
|
@@ -1109,7 +1330,7 @@ function onMouseUp(event) {
|
|
|
1109
1330
|
path.selected = true;
|
|
1110
1331
|
}
|
|
1111
1332
|
</script>
|
|
1112
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
1333
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-14"></canvas></div>
|
|
1113
1334
|
</div>
|
|
1114
1335
|
|
|
1115
1336
|
|
|
@@ -1308,7 +1529,7 @@ function onMouseUp(event) {
|
|
|
1308
1529
|
<div class="button run">Run</div>
|
|
1309
1530
|
</div>
|
|
1310
1531
|
|
|
1311
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1532
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1312
1533
|
var path = new Path();
|
|
1313
1534
|
path.strokeColor = 'black';
|
|
1314
1535
|
|
|
@@ -1328,7 +1549,7 @@ path.arcTo(throughPoint, toPoint);
|
|
|
1328
1549
|
var circle = new Path.Circle(throughPoint, 3);
|
|
1329
1550
|
circle.fillColor = 'red';
|
|
1330
1551
|
</script>
|
|
1331
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1552
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1332
1553
|
</div>
|
|
1333
1554
|
|
|
1334
1555
|
|
|
@@ -1340,7 +1561,7 @@ circle.fillColor = 'red';
|
|
|
1340
1561
|
<div class="button run">Run</div>
|
|
1341
1562
|
</div>
|
|
1342
1563
|
|
|
1343
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1564
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1344
1565
|
var myPath;
|
|
1345
1566
|
function onMouseDrag(event) {
|
|
1346
1567
|
// If we created a path before, remove it:
|
|
@@ -1368,7 +1589,7 @@ function onMouseUp(event) {
|
|
|
1368
1589
|
myPath.fillColor = 'black';
|
|
1369
1590
|
}
|
|
1370
1591
|
</script>
|
|
1371
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
1592
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-16"></canvas></div>
|
|
1372
1593
|
</div>
|
|
1373
1594
|
|
|
1374
1595
|
|
|
@@ -1417,7 +1638,7 @@ function onMouseUp(event) {
|
|
|
1417
1638
|
<div class="button run">Run</div>
|
|
1418
1639
|
</div>
|
|
1419
1640
|
|
|
1420
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1641
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1421
1642
|
var path = new Path();
|
|
1422
1643
|
path.strokeColor = 'black';
|
|
1423
1644
|
|
|
@@ -1432,7 +1653,7 @@ path2.add(new Point(180, 25));
|
|
|
1432
1653
|
// we pass `false` as the second argument to arcTo:
|
|
1433
1654
|
path2.arcTo(new Point(280, 25), false);
|
|
1434
1655
|
</script>
|
|
1435
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1656
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
1436
1657
|
</div>
|
|
1437
1658
|
|
|
1438
1659
|
|
|
@@ -1444,7 +1665,7 @@ path2.arcTo(new Point(280, 25), false);
|
|
|
1444
1665
|
<div class="button run">Run</div>
|
|
1445
1666
|
</div>
|
|
1446
1667
|
|
|
1447
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1668
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1448
1669
|
var myPath;
|
|
1449
1670
|
|
|
1450
1671
|
// The mouse has to move at least 20 points before
|
|
@@ -1465,7 +1686,7 @@ function onMouseDrag(event) {
|
|
|
1465
1686
|
myPath.arcTo(event.point);
|
|
1466
1687
|
}
|
|
1467
1688
|
</script>
|
|
1468
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
1689
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-18"></canvas></div>
|
|
1469
1690
|
</div>
|
|
1470
1691
|
|
|
1471
1692
|
|
|
@@ -1474,37 +1695,30 @@ function onMouseDrag(event) {
|
|
|
1474
1695
|
</div>
|
|
1475
1696
|
|
|
1476
1697
|
|
|
1477
|
-
<div id="
|
|
1698
|
+
<div id="arcaround-center-angle" class="member">
|
|
1478
1699
|
<div class="member-link">
|
|
1479
|
-
<a name="
|
|
1700
|
+
<a name="arcaround-center-angle" href="#arcaround-center-angle"><tt><b>arcAround</b>(center, angle)</tt></a>
|
|
1480
1701
|
</div>
|
|
1481
1702
|
<div class="member-description hidden">
|
|
1482
1703
|
<div class="member-text">
|
|
1483
|
-
<p>Adds
|
|
1704
|
+
<p>Adds an arc that sweeps the specified angle around the specified <code>center</code> point, from the position of the last segment in the path, by adding one or more segments to the path. Positive angles draw the arc in clockwise direction, negative ones in anticlockwise direction.</p>
|
|
1484
1705
|
|
|
1485
1706
|
|
|
1486
1707
|
<ul class="member-list">
|
|
1487
1708
|
<h4>Parameters:</h4>
|
|
1488
1709
|
|
|
1489
1710
|
<li>
|
|
1490
|
-
<tt>
|
|
1491
|
-
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
1492
|
-
— the point through which the curve should pass
|
|
1493
|
-
|
|
1494
|
-
</li>
|
|
1495
|
-
|
|
1496
|
-
<li>
|
|
1497
|
-
<tt>to:</tt>
|
|
1711
|
+
<tt>center:</tt>
|
|
1498
1712
|
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
1499
|
-
— the
|
|
1713
|
+
— the center of the arc
|
|
1500
1714
|
|
|
1501
1715
|
</li>
|
|
1502
1716
|
|
|
1503
1717
|
<li>
|
|
1504
|
-
<tt>
|
|
1718
|
+
<tt>angle:</tt>
|
|
1505
1719
|
<tt>Number</tt>
|
|
1506
|
-
— the
|
|
1507
|
-
|
|
1720
|
+
— the angle in degrees that the arc sweeps over
|
|
1721
|
+
|
|
1508
1722
|
</li>
|
|
1509
1723
|
|
|
1510
1724
|
</ul>
|
|
@@ -1513,7 +1727,7 @@ function onMouseDrag(event) {
|
|
|
1513
1727
|
|
|
1514
1728
|
|
|
1515
1729
|
|
|
1516
|
-
<h4>Example
|
|
1730
|
+
<h4>Example:</h4>
|
|
1517
1731
|
|
|
1518
1732
|
<div class="paperscript split">
|
|
1519
1733
|
|
|
@@ -1521,28 +1735,23 @@ function onMouseDrag(event) {
|
|
|
1521
1735
|
<div class="button run">Run</div>
|
|
1522
1736
|
</div>
|
|
1523
1737
|
|
|
1524
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1525
|
-
var
|
|
1526
|
-
|
|
1527
|
-
|
|
1528
|
-
|
|
1529
|
-
myPath.remove();
|
|
1530
|
-
}
|
|
1531
|
-
|
|
1532
|
-
// Create a new path and add a segment point to it
|
|
1533
|
-
// at {x: 150, y: 150):
|
|
1534
|
-
myPath = new Path();
|
|
1535
|
-
myPath.add(150, 150);
|
|
1738
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1739
|
+
var path = new Path();
|
|
1740
|
+
path.strokeColor = 'black';
|
|
1741
|
+
path.add(new Point(30, 75));
|
|
1742
|
+
path.lineTo(new Point(80, 75));
|
|
1536
1743
|
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1744
|
+
// Draw a half circle around (105, 75) and continue on the other side:
|
|
1745
|
+
path.arcAround(new Point(105, 75), 180);
|
|
1746
|
+
path.lineTo(new Point(180, 75));
|
|
1540
1747
|
|
|
1541
|
-
|
|
1542
|
-
|
|
1543
|
-
|
|
1748
|
+
// Draw a full circle around (230, 75):
|
|
1749
|
+
var circle = new Path();
|
|
1750
|
+
circle.strokeColor = 'red';
|
|
1751
|
+
circle.add(new Point(250, 75));
|
|
1752
|
+
circle.arcAround(new Point(230, 75), 360);
|
|
1544
1753
|
</script>
|
|
1545
|
-
<div class="canvas"><canvas width="516" height="
|
|
1754
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
|
|
1546
1755
|
</div>
|
|
1547
1756
|
|
|
1548
1757
|
|
|
@@ -1551,22 +1760,185 @@ function onMouseMove(event) {
|
|
|
1551
1760
|
</div>
|
|
1552
1761
|
|
|
1553
1762
|
|
|
1554
|
-
<div id="
|
|
1763
|
+
<div id="arctowards-to" class="member">
|
|
1555
1764
|
<div class="member-link">
|
|
1556
|
-
<a name="
|
|
1765
|
+
<a name="arctowards-to" href="#arctowards-to"><tt><b>arcTowards</b>(to)</tt></a>
|
|
1557
1766
|
</div>
|
|
1558
1767
|
<div class="member-description hidden">
|
|
1559
1768
|
<div class="member-text">
|
|
1560
|
-
<p>Adds
|
|
1769
|
+
<p>Adds an arc from the position of the last segment in the path to the specified point, by adding one or more segments to the path. The arc continues in the direction in which the path ends, without a corner.</p>
|
|
1561
1770
|
|
|
1562
1771
|
|
|
1563
1772
|
<ul class="member-list">
|
|
1564
1773
|
<h4>Parameters:</h4>
|
|
1565
1774
|
|
|
1566
1775
|
<li>
|
|
1567
|
-
<tt>
|
|
1776
|
+
<tt>to:</tt>
|
|
1568
1777
|
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
1569
|
-
— the
|
|
1778
|
+
— the point where the arc should end
|
|
1779
|
+
|
|
1780
|
+
</li>
|
|
1781
|
+
|
|
1782
|
+
</ul>
|
|
1783
|
+
|
|
1784
|
+
|
|
1785
|
+
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
<h4>Example:</h4>
|
|
1789
|
+
|
|
1790
|
+
<div class="paperscript split">
|
|
1791
|
+
|
|
1792
|
+
<div class="buttons">
|
|
1793
|
+
<div class="button run">Run</div>
|
|
1794
|
+
</div>
|
|
1795
|
+
|
|
1796
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
1797
|
+
var path = new Path();
|
|
1798
|
+
path.strokeColor = 'black';
|
|
1799
|
+
path.add(new Point(30, 125));
|
|
1800
|
+
path.lineTo(new Point(80, 125));
|
|
1801
|
+
|
|
1802
|
+
// Each arc continues smoothly from where the path ends:
|
|
1803
|
+
path.arcTowards(new Point(130, 75));
|
|
1804
|
+
path.arcTowards(new Point(230, 75));
|
|
1805
|
+
path.lineTo(new Point(230, 125));
|
|
1806
|
+
</script>
|
|
1807
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
1808
|
+
</div>
|
|
1809
|
+
|
|
1810
|
+
|
|
1811
|
+
<h4>Example:<span class="description">Interactive example. Click and drag in the view below:</span></h4>
|
|
1812
|
+
|
|
1813
|
+
<div class="paperscript split">
|
|
1814
|
+
|
|
1815
|
+
<div class="buttons">
|
|
1816
|
+
<div class="button run">Run</div>
|
|
1817
|
+
</div>
|
|
1818
|
+
|
|
1819
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
1820
|
+
var myPath;
|
|
1821
|
+
|
|
1822
|
+
// The mouse has to move at least 20 points before
|
|
1823
|
+
// the next mouse drag event is fired:
|
|
1824
|
+
tool.minDistance = 20;
|
|
1825
|
+
|
|
1826
|
+
// When the user clicks, create a new path that starts
|
|
1827
|
+
// with a horizontal line ending at the mouse position:
|
|
1828
|
+
function onMouseDown(event) {
|
|
1829
|
+
myPath = new Path();
|
|
1830
|
+
myPath.strokeColor = 'black';
|
|
1831
|
+
myPath.add(event.point - [20, 0], event.point);
|
|
1832
|
+
}
|
|
1833
|
+
|
|
1834
|
+
// On each mouse drag event, continue the path smoothly
|
|
1835
|
+
// with an arc to the current position of the mouse:
|
|
1836
|
+
function onMouseDrag(event) {
|
|
1837
|
+
myPath.arcTowards(event.point);
|
|
1838
|
+
}
|
|
1839
|
+
</script>
|
|
1840
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-21"></canvas></div>
|
|
1841
|
+
</div>
|
|
1842
|
+
|
|
1843
|
+
|
|
1844
|
+
</div>
|
|
1845
|
+
</div>
|
|
1846
|
+
</div>
|
|
1847
|
+
|
|
1848
|
+
|
|
1849
|
+
<div id="curveto-through-to" class="member">
|
|
1850
|
+
<div class="member-link">
|
|
1851
|
+
<a name="curveto-through-to" href="#curveto-through-to"><tt><b>curveTo</b>(through, to[, time])</tt></a>
|
|
1852
|
+
</div>
|
|
1853
|
+
<div class="member-description hidden">
|
|
1854
|
+
<div class="member-text">
|
|
1855
|
+
<p>Adds a curve from the last segment in the path through the specified <code>through</code> point, to the specified destination point by adding one segment to the path.</p>
|
|
1856
|
+
|
|
1857
|
+
|
|
1858
|
+
<ul class="member-list">
|
|
1859
|
+
<h4>Parameters:</h4>
|
|
1860
|
+
|
|
1861
|
+
<li>
|
|
1862
|
+
<tt>through:</tt>
|
|
1863
|
+
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
1864
|
+
— the point through which the curve should pass
|
|
1865
|
+
|
|
1866
|
+
</li>
|
|
1867
|
+
|
|
1868
|
+
<li>
|
|
1869
|
+
<tt>to:</tt>
|
|
1870
|
+
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
1871
|
+
— the destination point of the newly added curve
|
|
1872
|
+
|
|
1873
|
+
</li>
|
|
1874
|
+
|
|
1875
|
+
<li>
|
|
1876
|
+
<tt>time:</tt>
|
|
1877
|
+
<tt>Number</tt>
|
|
1878
|
+
— the curve-time parameter at which the <code>through</code> point is to be located
|
|
1879
|
+
— optional, default: <tt>0.5</tt>
|
|
1880
|
+
</li>
|
|
1881
|
+
|
|
1882
|
+
</ul>
|
|
1883
|
+
|
|
1884
|
+
|
|
1885
|
+
|
|
1886
|
+
|
|
1887
|
+
|
|
1888
|
+
<h4>Example:<span class="description">Interactive example. Move your mouse around the view below:</span></h4>
|
|
1889
|
+
|
|
1890
|
+
<div class="paperscript split">
|
|
1891
|
+
|
|
1892
|
+
<div class="buttons">
|
|
1893
|
+
<div class="button run">Run</div>
|
|
1894
|
+
</div>
|
|
1895
|
+
|
|
1896
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
1897
|
+
var myPath;
|
|
1898
|
+
function onMouseMove(event) {
|
|
1899
|
+
// If we created a path before, remove it:
|
|
1900
|
+
if (myPath) {
|
|
1901
|
+
myPath.remove();
|
|
1902
|
+
}
|
|
1903
|
+
|
|
1904
|
+
// Create a new path and add a segment point to it
|
|
1905
|
+
// at {x: 150, y: 150):
|
|
1906
|
+
myPath = new Path();
|
|
1907
|
+
myPath.add(150, 150);
|
|
1908
|
+
|
|
1909
|
+
// Draw a curve through the position of the mouse to 'toPoint'
|
|
1910
|
+
var toPoint = new Point(350, 150);
|
|
1911
|
+
myPath.curveTo(event.point, toPoint);
|
|
1912
|
+
|
|
1913
|
+
// Select the path, so we can see its segments:
|
|
1914
|
+
myPath.selected = true;
|
|
1915
|
+
}
|
|
1916
|
+
</script>
|
|
1917
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-22"></canvas></div>
|
|
1918
|
+
</div>
|
|
1919
|
+
|
|
1920
|
+
|
|
1921
|
+
</div>
|
|
1922
|
+
</div>
|
|
1923
|
+
</div>
|
|
1924
|
+
|
|
1925
|
+
|
|
1926
|
+
<div id="cubiccurveto-handle1-handle2-to" class="member">
|
|
1927
|
+
<div class="member-link">
|
|
1928
|
+
<a name="cubiccurveto-handle1-handle2-to" href="#cubiccurveto-handle1-handle2-to"><tt><b>cubicCurveTo</b>(handle1, handle2, to)</tt></a>
|
|
1929
|
+
</div>
|
|
1930
|
+
<div class="member-description hidden">
|
|
1931
|
+
<div class="member-text">
|
|
1932
|
+
<p>Adds a cubic bezier curve to the path, from the last segment to the specified destination point, with the curve itself defined by two specified handles.</p>
|
|
1933
|
+
|
|
1934
|
+
|
|
1935
|
+
<ul class="member-list">
|
|
1936
|
+
<h4>Parameters:</h4>
|
|
1937
|
+
|
|
1938
|
+
<li>
|
|
1939
|
+
<tt>handle1:</tt>
|
|
1940
|
+
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
1941
|
+
— the location of the first handle of the newly added curve in absolute coordinates, out of which the relative values for <a href="../classes/Segment.html#handleout"><tt>segment.handleOut</tt></a> of its first segment are calculated
|
|
1570
1942
|
|
|
1571
1943
|
</li>
|
|
1572
1944
|
|
|
@@ -1727,7 +2099,7 @@ function onMouseMove(event) {
|
|
|
1727
2099
|
<div class="button run">Run</div>
|
|
1728
2100
|
</div>
|
|
1729
2101
|
|
|
1730
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2102
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
1731
2103
|
var path = new Path();
|
|
1732
2104
|
path.strokeColor = 'black';
|
|
1733
2105
|
|
|
@@ -1741,7 +2113,7 @@ path.lineBy(50, 0);
|
|
|
1741
2113
|
// 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
|
|
1742
2114
|
path.lineBy(0, 50);
|
|
1743
2115
|
</script>
|
|
1744
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2116
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
1745
2117
|
</div>
|
|
1746
2118
|
|
|
1747
2119
|
|
|
@@ -1753,7 +2125,7 @@ path.lineBy(0, 50);
|
|
|
1753
2125
|
<div class="button run">Run</div>
|
|
1754
2126
|
</div>
|
|
1755
2127
|
|
|
1756
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2128
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
1757
2129
|
var path = new Path();
|
|
1758
2130
|
path.strokeColor = 'black';
|
|
1759
2131
|
|
|
@@ -1779,7 +2151,7 @@ path.smooth();
|
|
|
1779
2151
|
// the construction of the path:
|
|
1780
2152
|
// path.selected = true;
|
|
1781
2153
|
</script>
|
|
1782
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
2154
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-24"></canvas></div>
|
|
1783
2155
|
</div>
|
|
1784
2156
|
|
|
1785
2157
|
|
|
@@ -2131,6 +2503,91 @@ Array of <tt>Number[]</tt> objects[]
|
|
|
2131
2503
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
2132
2504
|
|
|
2133
2505
|
|
|
2506
|
+
<div id="effects" class="member">
|
|
2507
|
+
<div class="member-link">
|
|
2508
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
2509
|
+
</div>
|
|
2510
|
+
<div class="member-description hidden">
|
|
2511
|
+
|
|
2512
|
+
<div class="member-text">
|
|
2513
|
+
<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,
|
|
2514
|
+
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>
|
|
2515
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
2516
|
+
<ul>
|
|
2517
|
+
<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>
|
|
2518
|
+
<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>
|
|
2519
|
+
</ul>
|
|
2520
|
+
|
|
2521
|
+
|
|
2522
|
+
|
|
2523
|
+
<ul class="member-list">
|
|
2524
|
+
<h4>Type:</h4>
|
|
2525
|
+
<li>
|
|
2526
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
2527
|
+
</li>
|
|
2528
|
+
</ul>
|
|
2529
|
+
|
|
2530
|
+
|
|
2531
|
+
<h4>Example:</h4>
|
|
2532
|
+
|
|
2533
|
+
<div class="paperscript split">
|
|
2534
|
+
|
|
2535
|
+
<div class="buttons">
|
|
2536
|
+
<div class="button run">Run</div>
|
|
2537
|
+
</div>
|
|
2538
|
+
|
|
2539
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2540
|
+
var path = new Path.Star({
|
|
2541
|
+
center: view.center,
|
|
2542
|
+
points: 5,
|
|
2543
|
+
radius1: 20,
|
|
2544
|
+
radius2: 40,
|
|
2545
|
+
strokeColor: 'black',
|
|
2546
|
+
strokeWidth: 8
|
|
2547
|
+
});
|
|
2548
|
+
path.effects = [
|
|
2549
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
2550
|
+
{ type: 'outline' }
|
|
2551
|
+
];
|
|
2552
|
+
</script>
|
|
2553
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2554
|
+
</div>
|
|
2555
|
+
|
|
2556
|
+
|
|
2557
|
+
</div>
|
|
2558
|
+
|
|
2559
|
+
</div>
|
|
2560
|
+
</div>
|
|
2561
|
+
|
|
2562
|
+
|
|
2563
|
+
<div id="previewbounds-matrix" class="member">
|
|
2564
|
+
<div class="member-link">
|
|
2565
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
2566
|
+
</div>
|
|
2567
|
+
<div class="member-description hidden">
|
|
2568
|
+
|
|
2569
|
+
<div class="member-text">
|
|
2570
|
+
<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>
|
|
2571
|
+
|
|
2572
|
+
<p>Read only.</p>
|
|
2573
|
+
|
|
2574
|
+
|
|
2575
|
+
|
|
2576
|
+
<ul class="member-list">
|
|
2577
|
+
<h4>Type:</h4>
|
|
2578
|
+
<li>
|
|
2579
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
2580
|
+
</li>
|
|
2581
|
+
</ul>
|
|
2582
|
+
|
|
2583
|
+
|
|
2584
|
+
|
|
2585
|
+
</div>
|
|
2586
|
+
|
|
2587
|
+
</div>
|
|
2588
|
+
</div>
|
|
2589
|
+
|
|
2590
|
+
|
|
2134
2591
|
<div id="key" class="member">
|
|
2135
2592
|
<div class="member-link">
|
|
2136
2593
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -2243,7 +2700,7 @@ Array of <tt>Number[]</tt> objects[]
|
|
|
2243
2700
|
<div class="button run">Run</div>
|
|
2244
2701
|
</div>
|
|
2245
2702
|
|
|
2246
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2703
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2247
2704
|
var path = new Path.Circle({
|
|
2248
2705
|
center: [80, 50],
|
|
2249
2706
|
radius: 35
|
|
@@ -2258,7 +2715,7 @@ group.addChild(path);
|
|
|
2258
2715
|
// The path can be accessed by name:
|
|
2259
2716
|
group.children['example'].fillColor = 'red';
|
|
2260
2717
|
</script>
|
|
2261
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2718
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
2262
2719
|
</div>
|
|
2263
2720
|
|
|
2264
2721
|
|
|
@@ -2296,7 +2753,7 @@ group.children['example'].fillColor = 'red';
|
|
|
2296
2753
|
<div class="button run">Run</div>
|
|
2297
2754
|
</div>
|
|
2298
2755
|
|
|
2299
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2756
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2300
2757
|
var circle = new Path.Circle({
|
|
2301
2758
|
center: [80, 50],
|
|
2302
2759
|
radius: 30
|
|
@@ -2307,7 +2764,7 @@ circle.style = {
|
|
|
2307
2764
|
strokeWidth: 5
|
|
2308
2765
|
};
|
|
2309
2766
|
</script>
|
|
2310
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2767
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2311
2768
|
</div>
|
|
2312
2769
|
|
|
2313
2770
|
|
|
@@ -2319,7 +2776,7 @@ circle.style = {
|
|
|
2319
2776
|
<div class="button run">Run</div>
|
|
2320
2777
|
</div>
|
|
2321
2778
|
|
|
2322
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2779
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2323
2780
|
var path = new Path.Circle({
|
|
2324
2781
|
center: [50, 50],
|
|
2325
2782
|
radius: 30,
|
|
@@ -2334,7 +2791,7 @@ var path2 = new Path.Circle({
|
|
|
2334
2791
|
// Copy the path style of path:
|
|
2335
2792
|
path2.style = path.style;
|
|
2336
2793
|
</script>
|
|
2337
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2794
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2338
2795
|
</div>
|
|
2339
2796
|
|
|
2340
2797
|
|
|
@@ -2346,7 +2803,7 @@ path2.style = path.style;
|
|
|
2346
2803
|
<div class="button run">Run</div>
|
|
2347
2804
|
</div>
|
|
2348
2805
|
|
|
2349
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2806
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2350
2807
|
var myStyle = {
|
|
2351
2808
|
fillColor: 'red',
|
|
2352
2809
|
strokeColor: 'blue',
|
|
@@ -2365,7 +2822,7 @@ var path2 = new Path.Circle({
|
|
|
2365
2822
|
});
|
|
2366
2823
|
path2.style = myStyle;
|
|
2367
2824
|
</script>
|
|
2368
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2825
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2369
2826
|
</div>
|
|
2370
2827
|
|
|
2371
2828
|
|
|
@@ -2407,7 +2864,7 @@ path2.style = myStyle;
|
|
|
2407
2864
|
<div class="button run">Run</div>
|
|
2408
2865
|
</div>
|
|
2409
2866
|
|
|
2410
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2867
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2411
2868
|
var unlockedItem = new Path.Circle({
|
|
2412
2869
|
center: view.center - [35, 0],
|
|
2413
2870
|
radius: 30,
|
|
@@ -2434,7 +2891,7 @@ new PointText({
|
|
|
2434
2891
|
justification: 'center'
|
|
2435
2892
|
});
|
|
2436
2893
|
</script>
|
|
2437
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2894
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2438
2895
|
</div>
|
|
2439
2896
|
|
|
2440
2897
|
|
|
@@ -2476,7 +2933,7 @@ new PointText({
|
|
|
2476
2933
|
<div class="button run">Run</div>
|
|
2477
2934
|
</div>
|
|
2478
2935
|
|
|
2479
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2936
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2480
2937
|
var path = new Path.Circle({
|
|
2481
2938
|
center: [50, 50],
|
|
2482
2939
|
radius: 20,
|
|
@@ -2486,7 +2943,7 @@ var path = new Path.Circle({
|
|
|
2486
2943
|
// Hide the path:
|
|
2487
2944
|
path.visible = false;
|
|
2488
2945
|
</script>
|
|
2489
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2946
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2490
2947
|
</div>
|
|
2491
2948
|
|
|
2492
2949
|
|
|
@@ -2534,7 +2991,7 @@ path.visible = false;
|
|
|
2534
2991
|
<div class="button run">Run</div>
|
|
2535
2992
|
</div>
|
|
2536
2993
|
|
|
2537
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2994
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2538
2995
|
// Create a white rectangle in the background
|
|
2539
2996
|
// with the same dimensions as the view:
|
|
2540
2997
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -2555,7 +3012,7 @@ var circle2 = new Path.Circle({
|
|
|
2555
3012
|
// Set the blend mode of circle2:
|
|
2556
3013
|
circle2.blendMode = 'multiply';
|
|
2557
3014
|
</script>
|
|
2558
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3015
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2559
3016
|
</div>
|
|
2560
3017
|
|
|
2561
3018
|
|
|
@@ -2597,7 +3054,7 @@ circle2.blendMode = 'multiply';
|
|
|
2597
3054
|
<div class="button run">Run</div>
|
|
2598
3055
|
</div>
|
|
2599
3056
|
|
|
2600
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3057
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2601
3058
|
var circle = new Path.Circle({
|
|
2602
3059
|
center: [80, 50],
|
|
2603
3060
|
radius: 35,
|
|
@@ -2615,7 +3072,7 @@ var circle2 = new Path.Circle({
|
|
|
2615
3072
|
// Make circle2 50% transparent:
|
|
2616
3073
|
circle2.opacity = 0.5;
|
|
2617
3074
|
</script>
|
|
2618
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3075
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2619
3076
|
</div>
|
|
2620
3077
|
|
|
2621
3078
|
|
|
@@ -2738,14 +3195,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
2738
3195
|
<div class="button run">Run</div>
|
|
2739
3196
|
</div>
|
|
2740
3197
|
|
|
2741
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3198
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
2742
3199
|
var path = new Path.Circle({
|
|
2743
3200
|
center: [80, 50],
|
|
2744
3201
|
radius: 35
|
|
2745
3202
|
});
|
|
2746
3203
|
path.selected = true; // Select the path
|
|
2747
3204
|
</script>
|
|
2748
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3205
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2749
3206
|
</div>
|
|
2750
3207
|
|
|
2751
3208
|
|
|
@@ -2902,7 +3359,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
2902
3359
|
<div class="button run">Run</div>
|
|
2903
3360
|
</div>
|
|
2904
3361
|
|
|
2905
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3362
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
2906
3363
|
// Create a circle at position { x: 10, y: 10 }
|
|
2907
3364
|
var circle = new Path.Circle({
|
|
2908
3365
|
center: new Point(10, 10),
|
|
@@ -2916,7 +3373,7 @@ circle.position = new Point(20, 20);
|
|
|
2916
3373
|
// Move the circle 100 points to the right and 50 points down
|
|
2917
3374
|
circle.position += new Point(100, 50);
|
|
2918
3375
|
</script>
|
|
2919
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3376
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
2920
3377
|
</div>
|
|
2921
3378
|
|
|
2922
3379
|
|
|
@@ -2928,7 +3385,7 @@ circle.position += new Point(100, 50);
|
|
|
2928
3385
|
<div class="button run">Run</div>
|
|
2929
3386
|
</div>
|
|
2930
3387
|
|
|
2931
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3388
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
2932
3389
|
// Create a circle at position { x: 20, y: 20 }
|
|
2933
3390
|
var circle = new Path.Circle({
|
|
2934
3391
|
center: new Point(20, 20),
|
|
@@ -2939,7 +3396,7 @@ var circle = new Path.Circle({
|
|
|
2939
3396
|
// Move the circle 100 points to the right
|
|
2940
3397
|
circle.position.x += 100;
|
|
2941
3398
|
</script>
|
|
2942
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3399
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
2943
3400
|
</div>
|
|
2944
3401
|
|
|
2945
3402
|
|
|
@@ -3465,7 +3922,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
3465
3922
|
<div class="button run">Run</div>
|
|
3466
3923
|
</div>
|
|
3467
3924
|
|
|
3468
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3925
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3469
3926
|
var path = new Path.Circle({
|
|
3470
3927
|
center: [80, 50],
|
|
3471
3928
|
radius: 35
|
|
@@ -3478,7 +3935,7 @@ group.addChild(path);
|
|
|
3478
3935
|
// Access the path through the group's children array:
|
|
3479
3936
|
group.children[0].fillColor = 'red';
|
|
3480
3937
|
</script>
|
|
3481
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3938
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3482
3939
|
</div>
|
|
3483
3940
|
|
|
3484
3941
|
|
|
@@ -3490,7 +3947,7 @@ group.children[0].fillColor = 'red';
|
|
|
3490
3947
|
<div class="button run">Run</div>
|
|
3491
3948
|
</div>
|
|
3492
3949
|
|
|
3493
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3950
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3494
3951
|
var path = new Path.Circle({
|
|
3495
3952
|
center: [80, 50],
|
|
3496
3953
|
radius: 35
|
|
@@ -3505,7 +3962,7 @@ group.addChild(path);
|
|
|
3505
3962
|
// The path can be accessed by name:
|
|
3506
3963
|
group.children['example'].fillColor = 'orange';
|
|
3507
3964
|
</script>
|
|
3508
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3965
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3509
3966
|
</div>
|
|
3510
3967
|
|
|
3511
3968
|
|
|
@@ -3517,7 +3974,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
3517
3974
|
<div class="button run">Run</div>
|
|
3518
3975
|
</div>
|
|
3519
3976
|
|
|
3520
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3977
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3521
3978
|
var path = new Path.Circle({
|
|
3522
3979
|
center: [80, 50],
|
|
3523
3980
|
radius: 35
|
|
@@ -3529,7 +3986,7 @@ group.children = [path];
|
|
|
3529
3986
|
// The path is the first child of the group:
|
|
3530
3987
|
group.firstChild.fillColor = 'green';
|
|
3531
3988
|
</script>
|
|
3532
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3989
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3533
3990
|
</div>
|
|
3534
3991
|
|
|
3535
3992
|
|
|
@@ -3706,7 +4163,7 @@ group.firstChild.fillColor = 'green';
|
|
|
3706
4163
|
<div class="button run">Run</div>
|
|
3707
4164
|
</div>
|
|
3708
4165
|
|
|
3709
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4166
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3710
4167
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
3711
4168
|
// with a radius of 35:
|
|
3712
4169
|
var circle = new Path.Circle({
|
|
@@ -3717,7 +4174,7 @@ var circle = new Path.Circle({
|
|
|
3717
4174
|
// Set its stroke color to RGB red:
|
|
3718
4175
|
circle.strokeColor = new Color(1, 0, 0);
|
|
3719
4176
|
</script>
|
|
3720
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4177
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3721
4178
|
</div>
|
|
3722
4179
|
|
|
3723
4180
|
|
|
@@ -3754,7 +4211,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
3754
4211
|
<div class="button run">Run</div>
|
|
3755
4212
|
</div>
|
|
3756
4213
|
|
|
3757
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4214
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3758
4215
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
3759
4216
|
// with a radius of 35:
|
|
3760
4217
|
var circle = new Path.Circle({
|
|
@@ -3766,7 +4223,7 @@ var circle = new Path.Circle({
|
|
|
3766
4223
|
// Set its stroke width to 10:
|
|
3767
4224
|
circle.strokeWidth = 10;
|
|
3768
4225
|
</script>
|
|
3769
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4226
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3770
4227
|
</div>
|
|
3771
4228
|
|
|
3772
4229
|
|
|
@@ -3813,7 +4270,7 @@ circle.strokeWidth = 10;
|
|
|
3813
4270
|
<div class="button run">Run</div>
|
|
3814
4271
|
</div>
|
|
3815
4272
|
|
|
3816
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4273
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
3817
4274
|
var line = new Path({
|
|
3818
4275
|
segments: [[80, 50], [420, 50]],
|
|
3819
4276
|
strokeColor: 'black',
|
|
@@ -3834,7 +4291,7 @@ var line2 = line.clone();
|
|
|
3834
4291
|
line2.position.y += 100;
|
|
3835
4292
|
line2.strokeCap = 'butt';
|
|
3836
4293
|
</script>
|
|
3837
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
4294
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-42"></canvas></div>
|
|
3838
4295
|
</div>
|
|
3839
4296
|
|
|
3840
4297
|
|
|
@@ -3881,7 +4338,7 @@ line2.strokeCap = 'butt';
|
|
|
3881
4338
|
<div class="button run">Run</div>
|
|
3882
4339
|
</div>
|
|
3883
4340
|
|
|
3884
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4341
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
3885
4342
|
var path = new Path({
|
|
3886
4343
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
3887
4344
|
strokeColor: 'black',
|
|
@@ -3898,7 +4355,7 @@ var path3 = path2.clone();
|
|
|
3898
4355
|
path3.position.x += path3.bounds.width * 1.5;
|
|
3899
4356
|
path3.strokeJoin = 'bevel';
|
|
3900
4357
|
</script>
|
|
3901
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
4358
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-43"></canvas></div>
|
|
3902
4359
|
</div>
|
|
3903
4360
|
|
|
3904
4361
|
|
|
@@ -4002,7 +4459,7 @@ path3.strokeJoin = 'bevel';
|
|
|
4002
4459
|
<div class="button run">Run</div>
|
|
4003
4460
|
</div>
|
|
4004
4461
|
|
|
4005
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4462
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
4006
4463
|
var path = new Path.Circle({
|
|
4007
4464
|
center: [80, 50],
|
|
4008
4465
|
radius: 40,
|
|
@@ -4013,7 +4470,7 @@ var path = new Path.Circle({
|
|
|
4013
4470
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
4014
4471
|
path.dashArray = [10, 4];
|
|
4015
4472
|
</script>
|
|
4016
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4473
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
4017
4474
|
</div>
|
|
4018
4475
|
|
|
4019
4476
|
|
|
@@ -4048,6 +4505,42 @@ path.dashArray = [10, 4];
|
|
|
4048
4505
|
|
|
4049
4506
|
|
|
4050
4507
|
|
|
4508
|
+
</div>
|
|
4509
|
+
|
|
4510
|
+
</div>
|
|
4511
|
+
</div>
|
|
4512
|
+
|
|
4513
|
+
|
|
4514
|
+
<div id="paintorder" class="member">
|
|
4515
|
+
<div class="member-link">
|
|
4516
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
4517
|
+
</div>
|
|
4518
|
+
<div class="member-description hidden">
|
|
4519
|
+
|
|
4520
|
+
<div class="member-text">
|
|
4521
|
+
<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>
|
|
4522
|
+
|
|
4523
|
+
|
|
4524
|
+
<ul class="member-list">
|
|
4525
|
+
<h4>Values:</h4>
|
|
4526
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
4527
|
+
</ul>
|
|
4528
|
+
|
|
4529
|
+
|
|
4530
|
+
<ul class="member-list">
|
|
4531
|
+
<h4>Default:</h4>
|
|
4532
|
+
<li><tt>'fill'</tt></li>
|
|
4533
|
+
</ul>
|
|
4534
|
+
|
|
4535
|
+
<ul class="member-list">
|
|
4536
|
+
<h4>Type:</h4>
|
|
4537
|
+
<li>
|
|
4538
|
+
<tt>String</tt>
|
|
4539
|
+
</li>
|
|
4540
|
+
</ul>
|
|
4541
|
+
|
|
4542
|
+
|
|
4543
|
+
|
|
4051
4544
|
</div>
|
|
4052
4545
|
|
|
4053
4546
|
</div>
|
|
@@ -4083,7 +4576,7 @@ path.dashArray = [10, 4];
|
|
|
4083
4576
|
<div class="button run">Run</div>
|
|
4084
4577
|
</div>
|
|
4085
4578
|
|
|
4086
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4579
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
4087
4580
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
4088
4581
|
// with a radius of 35:
|
|
4089
4582
|
var circle = new Path.Circle({
|
|
@@ -4094,7 +4587,7 @@ var circle = new Path.Circle({
|
|
|
4094
4587
|
// Set the fill color of the circle to RGB red:
|
|
4095
4588
|
circle.fillColor = new Color(1, 0, 0);
|
|
4096
4589
|
</script>
|
|
4097
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4590
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
4098
4591
|
</div>
|
|
4099
4592
|
|
|
4100
4593
|
|
|
@@ -4169,7 +4662,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
4169
4662
|
<div class="button run">Run</div>
|
|
4170
4663
|
</div>
|
|
4171
4664
|
|
|
4172
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4665
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
4173
4666
|
var circle = new Path.Circle({
|
|
4174
4667
|
center: [80, 50],
|
|
4175
4668
|
radius: 35,
|
|
@@ -4182,7 +4675,7 @@ var circle = new Path.Circle({
|
|
|
4182
4675
|
shadowOffset: new Point(5, 5)
|
|
4183
4676
|
});
|
|
4184
4677
|
</script>
|
|
4185
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4678
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
4186
4679
|
</div>
|
|
4187
4680
|
|
|
4188
4681
|
|
|
@@ -4323,7 +4816,7 @@ var circle = new Path.Circle({
|
|
|
4323
4816
|
<div class="button run">Run</div>
|
|
4324
4817
|
</div>
|
|
4325
4818
|
|
|
4326
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4819
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
4327
4820
|
// Create a rectangle shaped path with its top left point at:
|
|
4328
4821
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
4329
4822
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -4334,7 +4827,7 @@ path.onFrame = function(event) {
|
|
|
4334
4827
|
this.rotate(3);
|
|
4335
4828
|
}
|
|
4336
4829
|
</script>
|
|
4337
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4830
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
4338
4831
|
</div>
|
|
4339
4832
|
|
|
4340
4833
|
|
|
@@ -4378,7 +4871,7 @@ path.onFrame = function(event) {
|
|
|
4378
4871
|
<div class="button run">Run</div>
|
|
4379
4872
|
</div>
|
|
4380
4873
|
|
|
4381
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4874
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
4382
4875
|
// Create a circle shaped path at the center of the view:
|
|
4383
4876
|
var path = new Path.Circle({
|
|
4384
4877
|
center: view.center,
|
|
@@ -4392,7 +4885,7 @@ path.onMouseDown = function(event) {
|
|
|
4392
4885
|
this.fillColor = 'red';
|
|
4393
4886
|
}
|
|
4394
4887
|
</script>
|
|
4395
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4888
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
4396
4889
|
</div>
|
|
4397
4890
|
|
|
4398
4891
|
|
|
@@ -4404,7 +4897,7 @@ path.onMouseDown = function(event) {
|
|
|
4404
4897
|
<div class="button run">Run</div>
|
|
4405
4898
|
</div>
|
|
4406
4899
|
|
|
4407
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4900
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
4408
4901
|
// Loop 30 times:
|
|
4409
4902
|
for (var i = 0; i < 30; i++) {
|
|
4410
4903
|
// Create a circle shaped path at a random position
|
|
@@ -4422,7 +4915,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4422
4915
|
}
|
|
4423
4916
|
}
|
|
4424
4917
|
</script>
|
|
4425
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4918
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
4426
4919
|
</div>
|
|
4427
4920
|
|
|
4428
4921
|
|
|
@@ -4466,7 +4959,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4466
4959
|
<div class="button run">Run</div>
|
|
4467
4960
|
</div>
|
|
4468
4961
|
|
|
4469
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4962
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
4470
4963
|
// Create a circle shaped path at the center of the view:
|
|
4471
4964
|
var path = new Path.Circle({
|
|
4472
4965
|
center: view.center,
|
|
@@ -4479,7 +4972,7 @@ path.onMouseDrag = function(event) {
|
|
|
4479
4972
|
path.position += event.delta;
|
|
4480
4973
|
}
|
|
4481
4974
|
</script>
|
|
4482
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
4975
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-50"></canvas></div>
|
|
4483
4976
|
</div>
|
|
4484
4977
|
|
|
4485
4978
|
|
|
@@ -4523,7 +5016,7 @@ path.onMouseDrag = function(event) {
|
|
|
4523
5016
|
<div class="button run">Run</div>
|
|
4524
5017
|
</div>
|
|
4525
5018
|
|
|
4526
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5019
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
4527
5020
|
// Create a circle shaped path at the center of the view:
|
|
4528
5021
|
var path = new Path.Circle({
|
|
4529
5022
|
center: view.center,
|
|
@@ -4537,7 +5030,7 @@ path.onMouseUp = function(event) {
|
|
|
4537
5030
|
this.fillColor = 'red';
|
|
4538
5031
|
}
|
|
4539
5032
|
</script>
|
|
4540
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5033
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
4541
5034
|
</div>
|
|
4542
5035
|
|
|
4543
5036
|
|
|
@@ -4581,7 +5074,7 @@ path.onMouseUp = function(event) {
|
|
|
4581
5074
|
<div class="button run">Run</div>
|
|
4582
5075
|
</div>
|
|
4583
5076
|
|
|
4584
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5077
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
4585
5078
|
// Create a circle shaped path at the center of the view:
|
|
4586
5079
|
var path = new Path.Circle({
|
|
4587
5080
|
center: view.center,
|
|
@@ -4595,7 +5088,7 @@ path.onClick = function(event) {
|
|
|
4595
5088
|
this.fillColor = 'red';
|
|
4596
5089
|
}
|
|
4597
5090
|
</script>
|
|
4598
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5091
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
4599
5092
|
</div>
|
|
4600
5093
|
|
|
4601
5094
|
|
|
@@ -4607,7 +5100,7 @@ path.onClick = function(event) {
|
|
|
4607
5100
|
<div class="button run">Run</div>
|
|
4608
5101
|
</div>
|
|
4609
5102
|
|
|
4610
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5103
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
4611
5104
|
// Loop 30 times:
|
|
4612
5105
|
for (var i = 0; i < 30; i++) {
|
|
4613
5106
|
// Create a circle shaped path at a random position
|
|
@@ -4625,7 +5118,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4625
5118
|
}
|
|
4626
5119
|
}
|
|
4627
5120
|
</script>
|
|
4628
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5121
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
|
|
4629
5122
|
</div>
|
|
4630
5123
|
|
|
4631
5124
|
|
|
@@ -4669,7 +5162,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4669
5162
|
<div class="button run">Run</div>
|
|
4670
5163
|
</div>
|
|
4671
5164
|
|
|
4672
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5165
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
4673
5166
|
// Create a circle shaped path at the center of the view:
|
|
4674
5167
|
var path = new Path.Circle({
|
|
4675
5168
|
center: view.center,
|
|
@@ -4683,7 +5176,7 @@ path.onDoubleClick = function(event) {
|
|
|
4683
5176
|
this.fillColor = 'red';
|
|
4684
5177
|
}
|
|
4685
5178
|
</script>
|
|
4686
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5179
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
|
|
4687
5180
|
</div>
|
|
4688
5181
|
|
|
4689
5182
|
|
|
@@ -4695,7 +5188,7 @@ path.onDoubleClick = function(event) {
|
|
|
4695
5188
|
<div class="button run">Run</div>
|
|
4696
5189
|
</div>
|
|
4697
5190
|
|
|
4698
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5191
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
4699
5192
|
// Loop 30 times:
|
|
4700
5193
|
for (var i = 0; i < 30; i++) {
|
|
4701
5194
|
// Create a circle shaped path at a random position
|
|
@@ -4713,7 +5206,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4713
5206
|
}
|
|
4714
5207
|
}
|
|
4715
5208
|
</script>
|
|
4716
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5209
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
|
|
4717
5210
|
</div>
|
|
4718
5211
|
|
|
4719
5212
|
|
|
@@ -4757,7 +5250,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4757
5250
|
<div class="button run">Run</div>
|
|
4758
5251
|
</div>
|
|
4759
5252
|
|
|
4760
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5253
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
4761
5254
|
// Create a circle shaped path at the center of the view:
|
|
4762
5255
|
var path = new Path.Circle({
|
|
4763
5256
|
center: view.center,
|
|
@@ -4771,174 +5264,561 @@ path.onMouseMove = function(event) {
|
|
|
4771
5264
|
this.opacity = Math.random();
|
|
4772
5265
|
}
|
|
4773
5266
|
</script>
|
|
4774
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5267
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
|
|
5268
|
+
</div>
|
|
5269
|
+
|
|
5270
|
+
|
|
5271
|
+
</div>
|
|
5272
|
+
|
|
5273
|
+
</div>
|
|
5274
|
+
</div>
|
|
5275
|
+
|
|
5276
|
+
|
|
5277
|
+
<div id="onmouseenter" class="member">
|
|
5278
|
+
<div class="member-link">
|
|
5279
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
5280
|
+
</div>
|
|
5281
|
+
<div class="member-description hidden">
|
|
5282
|
+
|
|
5283
|
+
<div class="member-text">
|
|
5284
|
+
<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>
|
|
5285
|
+
|
|
5286
|
+
|
|
5287
|
+
|
|
5288
|
+
<ul class="member-list">
|
|
5289
|
+
<h4>Type:</h4>
|
|
5290
|
+
<li>
|
|
5291
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
5292
|
+
</li>
|
|
5293
|
+
</ul>
|
|
5294
|
+
|
|
5295
|
+
|
|
5296
|
+
<ul class="member-list">
|
|
5297
|
+
<h4>See also:</h4>
|
|
5298
|
+
|
|
5299
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
5300
|
+
|
|
5301
|
+
</ul>
|
|
5302
|
+
|
|
5303
|
+
<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>
|
|
5304
|
+
|
|
5305
|
+
<div class="paperscript split">
|
|
5306
|
+
|
|
5307
|
+
<div class="buttons">
|
|
5308
|
+
<div class="button run">Run</div>
|
|
4775
5309
|
</div>
|
|
4776
5310
|
|
|
5311
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
5312
|
+
// Create a circle shaped path at the center of the view:
|
|
5313
|
+
var path = new Path.Circle({
|
|
5314
|
+
center: view.center,
|
|
5315
|
+
radius: 25,
|
|
5316
|
+
fillColor: 'black'
|
|
5317
|
+
});
|
|
5318
|
+
|
|
5319
|
+
// When the mouse enters the item, set its fill color to red:
|
|
5320
|
+
path.onMouseEnter = function(event) {
|
|
5321
|
+
this.fillColor = 'red';
|
|
5322
|
+
}
|
|
5323
|
+
|
|
5324
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
5325
|
+
path.onMouseLeave = function(event) {
|
|
5326
|
+
this.fillColor = 'black';
|
|
5327
|
+
}
|
|
5328
|
+
</script>
|
|
5329
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
|
|
5330
|
+
</div>
|
|
5331
|
+
|
|
5332
|
+
|
|
5333
|
+
<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>
|
|
5334
|
+
|
|
5335
|
+
<div class="paperscript split">
|
|
5336
|
+
|
|
5337
|
+
<div class="buttons">
|
|
5338
|
+
<div class="button run">Run</div>
|
|
5339
|
+
</div>
|
|
5340
|
+
|
|
5341
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
5342
|
+
function enter(event) {
|
|
5343
|
+
this.fillColor = 'red';
|
|
5344
|
+
}
|
|
5345
|
+
|
|
5346
|
+
function leave(event) {
|
|
5347
|
+
this.fillColor = 'black';
|
|
5348
|
+
}
|
|
5349
|
+
|
|
5350
|
+
// When the mouse is pressed:
|
|
5351
|
+
function onMouseDown(event) {
|
|
5352
|
+
// Create a circle shaped path at the position of the mouse:
|
|
5353
|
+
var path = new Path.Circle(event.point, 25);
|
|
5354
|
+
path.fillColor = 'black';
|
|
5355
|
+
|
|
5356
|
+
// When the mouse enters the item, set its fill color to red:
|
|
5357
|
+
path.onMouseEnter = enter;
|
|
5358
|
+
|
|
5359
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
5360
|
+
path.onMouseLeave = leave;
|
|
5361
|
+
}
|
|
5362
|
+
</script>
|
|
5363
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
5364
|
+
</div>
|
|
5365
|
+
|
|
5366
|
+
|
|
5367
|
+
</div>
|
|
5368
|
+
|
|
5369
|
+
</div>
|
|
5370
|
+
</div>
|
|
5371
|
+
|
|
5372
|
+
|
|
5373
|
+
<div id="onmouseleave" class="member">
|
|
5374
|
+
<div class="member-link">
|
|
5375
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
5376
|
+
</div>
|
|
5377
|
+
<div class="member-description hidden">
|
|
5378
|
+
|
|
5379
|
+
<div class="member-text">
|
|
5380
|
+
<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>
|
|
5381
|
+
|
|
5382
|
+
|
|
5383
|
+
|
|
5384
|
+
<ul class="member-list">
|
|
5385
|
+
<h4>Type:</h4>
|
|
5386
|
+
<li>
|
|
5387
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
5388
|
+
</li>
|
|
5389
|
+
</ul>
|
|
5390
|
+
|
|
5391
|
+
|
|
5392
|
+
<ul class="member-list">
|
|
5393
|
+
<h4>See also:</h4>
|
|
5394
|
+
|
|
5395
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
5396
|
+
|
|
5397
|
+
</ul>
|
|
5398
|
+
|
|
5399
|
+
<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>
|
|
5400
|
+
|
|
5401
|
+
<div class="paperscript split">
|
|
5402
|
+
|
|
5403
|
+
<div class="buttons">
|
|
5404
|
+
<div class="button run">Run</div>
|
|
5405
|
+
</div>
|
|
5406
|
+
|
|
5407
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
5408
|
+
// Create a circle shaped path at the center of the view:
|
|
5409
|
+
var path = new Path.Circle({
|
|
5410
|
+
center: view.center,
|
|
5411
|
+
radius: 25,
|
|
5412
|
+
fillColor: 'black'
|
|
5413
|
+
});
|
|
5414
|
+
|
|
5415
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
5416
|
+
path.onMouseLeave = function(event) {
|
|
5417
|
+
this.fillColor = 'red';
|
|
5418
|
+
}
|
|
5419
|
+
</script>
|
|
5420
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
5421
|
+
</div>
|
|
5422
|
+
|
|
5423
|
+
|
|
5424
|
+
</div>
|
|
5425
|
+
|
|
5426
|
+
</div>
|
|
5427
|
+
</div>
|
|
5428
|
+
|
|
5429
|
+
|
|
5430
|
+
<div id="ondraw" class="member">
|
|
5431
|
+
<div class="member-link">
|
|
5432
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
5433
|
+
</div>
|
|
5434
|
+
<div class="member-description hidden">
|
|
5435
|
+
|
|
5436
|
+
<div class="member-text">
|
|
5437
|
+
<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>
|
|
5438
|
+
|
|
5439
|
+
|
|
5440
|
+
|
|
5441
|
+
<ul class="member-list">
|
|
5442
|
+
<h4>Type:</h4>
|
|
5443
|
+
<li>
|
|
5444
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
5445
|
+
</li>
|
|
5446
|
+
</ul>
|
|
5447
|
+
<ul class="member-list">
|
|
5448
|
+
<h4>Options:</h4>
|
|
5449
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
5450
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
5451
|
+
<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>
|
|
5452
|
+
<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>
|
|
5453
|
+
<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>()
|
|
5454
|
+
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>
|
|
5455
|
+
</ul>
|
|
5456
|
+
|
|
5457
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
5458
|
+
|
|
5459
|
+
<div class="paperscript split">
|
|
5460
|
+
|
|
5461
|
+
<div class="buttons">
|
|
5462
|
+
<div class="button run">Run</div>
|
|
5463
|
+
</div>
|
|
5464
|
+
|
|
5465
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
5466
|
+
var path = new Path.Circle({
|
|
5467
|
+
center: view.center,
|
|
5468
|
+
radius: 25,
|
|
5469
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
5470
|
+
});
|
|
5471
|
+
|
|
5472
|
+
path.onDraw = function(event) {
|
|
5473
|
+
var ctx = event.context,
|
|
5474
|
+
center = this.position,
|
|
5475
|
+
scale = event.matrix.scaling.x;
|
|
5476
|
+
ctx.beginPath();
|
|
5477
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
5478
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
5479
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
5480
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
5481
|
+
ctx.lineWidth = 1 / scale;
|
|
5482
|
+
ctx.stroke();
|
|
5483
|
+
}
|
|
5484
|
+
</script>
|
|
5485
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
|
|
5486
|
+
</div>
|
|
5487
|
+
|
|
5488
|
+
|
|
5489
|
+
</div>
|
|
5490
|
+
|
|
5491
|
+
</div>
|
|
5492
|
+
</div>
|
|
5493
|
+
|
|
5494
|
+
|
|
5495
|
+
<div id="ondrawselection" class="member">
|
|
5496
|
+
<div class="member-link">
|
|
5497
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
5498
|
+
</div>
|
|
5499
|
+
<div class="member-description hidden">
|
|
5500
|
+
|
|
5501
|
+
<div class="member-text">
|
|
5502
|
+
<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>
|
|
5503
|
+
|
|
5504
|
+
|
|
5505
|
+
|
|
5506
|
+
<ul class="member-list">
|
|
5507
|
+
<h4>Type:</h4>
|
|
5508
|
+
<li>
|
|
5509
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
5510
|
+
</li>
|
|
5511
|
+
</ul>
|
|
5512
|
+
<ul class="member-list">
|
|
5513
|
+
<h4>Options:</h4>
|
|
5514
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
5515
|
+
<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>
|
|
5516
|
+
<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>
|
|
5517
|
+
<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>
|
|
5518
|
+
<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>
|
|
5519
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
5520
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
5521
|
+
</ul>
|
|
5522
|
+
|
|
5523
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
5524
|
+
|
|
5525
|
+
<div class="paperscript split">
|
|
5526
|
+
|
|
5527
|
+
<div class="buttons">
|
|
5528
|
+
<div class="button run">Run</div>
|
|
5529
|
+
</div>
|
|
5530
|
+
|
|
5531
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
5532
|
+
var path = new Path.Star({
|
|
5533
|
+
center: view.center,
|
|
5534
|
+
points: 5,
|
|
5535
|
+
radius1: 20,
|
|
5536
|
+
radius2: 40,
|
|
5537
|
+
strokeColor: 'black',
|
|
5538
|
+
selected: true
|
|
5539
|
+
});
|
|
5540
|
+
|
|
5541
|
+
path.onDrawSelection = function(event) {
|
|
5542
|
+
var ctx = event.context;
|
|
5543
|
+
this.segments.forEach(function(segment) {
|
|
5544
|
+
var point = event.matrix.transform(segment.point);
|
|
5545
|
+
ctx.beginPath();
|
|
5546
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
5547
|
+
ctx.fill();
|
|
5548
|
+
});
|
|
5549
|
+
return false;
|
|
5550
|
+
}
|
|
5551
|
+
</script>
|
|
5552
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
5553
|
+
</div>
|
|
5554
|
+
|
|
5555
|
+
|
|
5556
|
+
</div>
|
|
5557
|
+
|
|
5558
|
+
</div>
|
|
5559
|
+
</div>
|
|
5560
|
+
|
|
5561
|
+
</div>
|
|
5562
|
+
|
|
5563
|
+
|
|
5564
|
+
<!-- =========================== inherited methods ========================= -->
|
|
5565
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
5566
|
+
|
|
5567
|
+
|
|
5568
|
+
<div id="addeffect-effect" class="member">
|
|
5569
|
+
<div class="member-link">
|
|
5570
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
5571
|
+
</div>
|
|
5572
|
+
<div class="member-description hidden">
|
|
5573
|
+
<div class="member-text">
|
|
5574
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
5575
|
+
|
|
5576
|
+
|
|
5577
|
+
<ul class="member-list">
|
|
5578
|
+
<h4>Parameters:</h4>
|
|
5579
|
+
|
|
5580
|
+
<li>
|
|
5581
|
+
<tt>effect:</tt>
|
|
5582
|
+
<tt>Object</tt>
|
|
5583
|
+
— the plain object describing the effect
|
|
5584
|
+
|
|
5585
|
+
</li>
|
|
5586
|
+
|
|
5587
|
+
</ul>
|
|
5588
|
+
|
|
5589
|
+
|
|
5590
|
+
<ul class="member-list">
|
|
5591
|
+
<h4>Returns:</h4>
|
|
5592
|
+
|
|
5593
|
+
<li>
|
|
5594
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
5595
|
+
</li>
|
|
5596
|
+
|
|
5597
|
+
|
|
5598
|
+
</ul>
|
|
5599
|
+
|
|
5600
|
+
|
|
5601
|
+
|
|
5602
|
+
|
|
5603
|
+
|
|
5604
|
+
</div>
|
|
5605
|
+
</div>
|
|
5606
|
+
</div>
|
|
5607
|
+
|
|
5608
|
+
|
|
5609
|
+
<div id="inserteffect-index-effect" class="member">
|
|
5610
|
+
<div class="member-link">
|
|
5611
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
5612
|
+
</div>
|
|
5613
|
+
<div class="member-description hidden">
|
|
5614
|
+
<div class="member-text">
|
|
5615
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
5616
|
+
|
|
5617
|
+
|
|
5618
|
+
<ul class="member-list">
|
|
5619
|
+
<h4>Parameters:</h4>
|
|
5620
|
+
|
|
5621
|
+
<li>
|
|
5622
|
+
<tt>index:</tt>
|
|
5623
|
+
<tt>Number</tt>
|
|
5624
|
+
— the index at which to insert the effect
|
|
5625
|
+
|
|
5626
|
+
</li>
|
|
5627
|
+
|
|
5628
|
+
<li>
|
|
5629
|
+
<tt>effect:</tt>
|
|
5630
|
+
<tt>Object</tt>
|
|
5631
|
+
— the plain object describing the effect
|
|
5632
|
+
|
|
5633
|
+
</li>
|
|
5634
|
+
|
|
5635
|
+
</ul>
|
|
5636
|
+
|
|
5637
|
+
|
|
5638
|
+
<ul class="member-list">
|
|
5639
|
+
<h4>Returns:</h4>
|
|
5640
|
+
|
|
5641
|
+
<li>
|
|
5642
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
5643
|
+
</li>
|
|
5644
|
+
|
|
5645
|
+
|
|
5646
|
+
</ul>
|
|
4777
5647
|
|
|
4778
|
-
</div>
|
|
4779
5648
|
|
|
5649
|
+
|
|
5650
|
+
|
|
5651
|
+
|
|
5652
|
+
</div>
|
|
4780
5653
|
</div>
|
|
4781
5654
|
</div>
|
|
4782
5655
|
|
|
4783
5656
|
|
|
4784
|
-
<div id="
|
|
5657
|
+
<div id="inserteffects-index-effects" class="member">
|
|
4785
5658
|
<div class="member-link">
|
|
4786
|
-
<a name="
|
|
5659
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
4787
5660
|
</div>
|
|
4788
5661
|
<div class="member-description hidden">
|
|
4789
|
-
|
|
4790
5662
|
<div class="member-text">
|
|
4791
|
-
<p>
|
|
5663
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
5664
|
+
|
|
5665
|
+
|
|
5666
|
+
<ul class="member-list">
|
|
5667
|
+
<h4>Parameters:</h4>
|
|
4792
5668
|
|
|
5669
|
+
<li>
|
|
5670
|
+
<tt>index:</tt>
|
|
5671
|
+
<tt>Number</tt>
|
|
5672
|
+
— the index at which to insert the effects
|
|
5673
|
+
|
|
5674
|
+
</li>
|
|
4793
5675
|
|
|
5676
|
+
<li>
|
|
5677
|
+
<tt>effects:</tt>
|
|
5678
|
+
Array of <tt>Object</tt> objects
|
|
5679
|
+
— the plain objects describing the effects
|
|
5680
|
+
|
|
5681
|
+
</li>
|
|
4794
5682
|
|
|
4795
|
-
|
|
4796
|
-
|
|
4797
|
-
<li>
|
|
4798
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
4799
|
-
</li>
|
|
4800
|
-
</ul>
|
|
4801
|
-
|
|
5683
|
+
</ul>
|
|
5684
|
+
|
|
4802
5685
|
|
|
4803
5686
|
<ul class="member-list">
|
|
4804
|
-
<h4>
|
|
5687
|
+
<h4>Returns:</h4>
|
|
4805
5688
|
|
|
4806
|
-
<li
|
|
5689
|
+
<li>
|
|
5690
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
5691
|
+
</li>
|
|
5692
|
+
|
|
4807
5693
|
|
|
4808
5694
|
</ul>
|
|
4809
5695
|
|
|
4810
|
-
<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>
|
|
4811
5696
|
|
|
4812
|
-
<div class="paperscript split">
|
|
4813
5697
|
|
|
4814
|
-
|
|
4815
|
-
|
|
5698
|
+
|
|
5699
|
+
|
|
4816
5700
|
</div>
|
|
4817
|
-
|
|
4818
|
-
<script type="text/paperscript" canvas="canvas-50">
|
|
4819
|
-
// Create a circle shaped path at the center of the view:
|
|
4820
|
-
var path = new Path.Circle({
|
|
4821
|
-
center: view.center,
|
|
4822
|
-
radius: 25,
|
|
4823
|
-
fillColor: 'black'
|
|
4824
|
-
});
|
|
4825
|
-
|
|
4826
|
-
// When the mouse enters the item, set its fill color to red:
|
|
4827
|
-
path.onMouseEnter = function(event) {
|
|
4828
|
-
this.fillColor = 'red';
|
|
4829
|
-
}
|
|
4830
|
-
|
|
4831
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
4832
|
-
path.onMouseLeave = function(event) {
|
|
4833
|
-
this.fillColor = 'black';
|
|
4834
|
-
}
|
|
4835
|
-
</script>
|
|
4836
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
4837
5701
|
</div>
|
|
4838
|
-
|
|
4839
|
-
|
|
4840
|
-
<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>
|
|
4841
|
-
|
|
4842
|
-
<div class="paperscript split">
|
|
4843
|
-
|
|
4844
|
-
<div class="buttons">
|
|
4845
|
-
<div class="button run">Run</div>
|
|
4846
5702
|
</div>
|
|
4847
5703
|
|
|
4848
|
-
|
|
4849
|
-
|
|
4850
|
-
|
|
4851
|
-
|
|
5704
|
+
|
|
5705
|
+
<div id="removeeffect-index" class="member">
|
|
5706
|
+
<div class="member-link">
|
|
5707
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
5708
|
+
</div>
|
|
5709
|
+
<div class="member-description hidden">
|
|
5710
|
+
<div class="member-text">
|
|
5711
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
5712
|
+
|
|
5713
|
+
|
|
5714
|
+
<ul class="member-list">
|
|
5715
|
+
<h4>Parameters:</h4>
|
|
5716
|
+
|
|
5717
|
+
<li>
|
|
5718
|
+
<tt>index:</tt>
|
|
5719
|
+
<tt>Number</tt>
|
|
5720
|
+
— the index of the effect to remove
|
|
4852
5721
|
|
|
4853
|
-
|
|
4854
|
-
|
|
4855
|
-
|
|
5722
|
+
</li>
|
|
5723
|
+
|
|
5724
|
+
</ul>
|
|
4856
5725
|
|
|
4857
|
-
|
|
4858
|
-
|
|
4859
|
-
|
|
4860
|
-
|
|
4861
|
-
|
|
5726
|
+
|
|
5727
|
+
<ul class="member-list">
|
|
5728
|
+
<h4>Returns:</h4>
|
|
5729
|
+
|
|
5730
|
+
<li>
|
|
5731
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
5732
|
+
</li>
|
|
4862
5733
|
|
|
4863
|
-
|
|
4864
|
-
|
|
5734
|
+
|
|
5735
|
+
</ul>
|
|
4865
5736
|
|
|
4866
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
4867
|
-
path.onMouseLeave = leave;
|
|
4868
|
-
}
|
|
4869
|
-
</script>
|
|
4870
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
4871
|
-
</div>
|
|
4872
5737
|
|
|
4873
5738
|
|
|
5739
|
+
|
|
5740
|
+
|
|
4874
5741
|
</div>
|
|
4875
|
-
|
|
4876
5742
|
</div>
|
|
4877
5743
|
</div>
|
|
4878
5744
|
|
|
4879
5745
|
|
|
4880
|
-
<div id="
|
|
5746
|
+
<div id="removeeffects" class="member">
|
|
4881
5747
|
<div class="member-link">
|
|
4882
|
-
<a name="
|
|
5748
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
4883
5749
|
</div>
|
|
4884
5750
|
<div class="member-description hidden">
|
|
4885
|
-
|
|
4886
5751
|
<div class="member-text">
|
|
4887
|
-
<p>
|
|
5752
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
5753
|
+
|
|
4888
5754
|
|
|
5755
|
+
<ul class="member-list">
|
|
5756
|
+
<h4>Parameters:</h4>
|
|
5757
|
+
|
|
5758
|
+
<li>
|
|
5759
|
+
<tt>start:</tt>
|
|
5760
|
+
<tt>Number</tt>
|
|
5761
|
+
— the index of the first effect to remove
|
|
5762
|
+
— optional, default: <tt>0</tt>
|
|
5763
|
+
</li>
|
|
4889
5764
|
|
|
5765
|
+
<li>
|
|
5766
|
+
<tt>end:</tt>
|
|
5767
|
+
<tt>Number</tt>
|
|
5768
|
+
— the index after the last one
|
|
5769
|
+
— optional, default: <tt>effects.length</tt>
|
|
5770
|
+
</li>
|
|
4890
5771
|
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
<li>
|
|
4894
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
4895
|
-
</li>
|
|
4896
|
-
</ul>
|
|
4897
|
-
|
|
5772
|
+
</ul>
|
|
5773
|
+
|
|
4898
5774
|
|
|
4899
5775
|
<ul class="member-list">
|
|
4900
|
-
<h4>
|
|
5776
|
+
<h4>Returns:</h4>
|
|
4901
5777
|
|
|
4902
|
-
<li
|
|
5778
|
+
<li>
|
|
5779
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
5780
|
+
</li>
|
|
5781
|
+
|
|
4903
5782
|
|
|
4904
5783
|
</ul>
|
|
4905
5784
|
|
|
4906
|
-
<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>
|
|
4907
5785
|
|
|
4908
|
-
<div class="paperscript split">
|
|
4909
5786
|
|
|
4910
|
-
|
|
4911
|
-
|
|
5787
|
+
|
|
5788
|
+
|
|
5789
|
+
</div>
|
|
5790
|
+
</div>
|
|
4912
5791
|
</div>
|
|
4913
5792
|
|
|
4914
|
-
|
|
4915
|
-
|
|
4916
|
-
|
|
4917
|
-
|
|
4918
|
-
radius: 25,
|
|
4919
|
-
fillColor: 'black'
|
|
4920
|
-
});
|
|
4921
|
-
|
|
4922
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
4923
|
-
path.onMouseLeave = function(event) {
|
|
4924
|
-
this.fillColor = 'red';
|
|
4925
|
-
}
|
|
4926
|
-
</script>
|
|
4927
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
5793
|
+
|
|
5794
|
+
<div id="geteffectoutput" class="member">
|
|
5795
|
+
<div class="member-link">
|
|
5796
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
4928
5797
|
</div>
|
|
5798
|
+
<div class="member-description hidden">
|
|
5799
|
+
<div class="member-text">
|
|
5800
|
+
<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>
|
|
5801
|
+
|
|
5802
|
+
|
|
5803
|
+
|
|
5804
|
+
<ul class="member-list">
|
|
5805
|
+
<h4>Returns:</h4>
|
|
5806
|
+
|
|
5807
|
+
<li>
|
|
5808
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
5809
|
+
</li>
|
|
5810
|
+
|
|
5811
|
+
|
|
5812
|
+
</ul>
|
|
4929
5813
|
|
|
4930
5814
|
|
|
4931
|
-
</div>
|
|
4932
5815
|
|
|
5816
|
+
|
|
5817
|
+
|
|
4933
5818
|
</div>
|
|
4934
5819
|
</div>
|
|
4935
|
-
|
|
4936
5820
|
</div>
|
|
4937
5821
|
|
|
4938
|
-
|
|
4939
|
-
<!-- =========================== inherited methods ========================= -->
|
|
4940
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
4941
|
-
|
|
4942
5822
|
|
|
4943
5823
|
<div id="set-props" class="member">
|
|
4944
5824
|
<div class="member-link">
|
|
@@ -4983,7 +5863,7 @@ path.onMouseLeave = function(event) {
|
|
|
4983
5863
|
<div class="button run">Run</div>
|
|
4984
5864
|
</div>
|
|
4985
5865
|
|
|
4986
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5866
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
4987
5867
|
var circle = new Path.Circle({
|
|
4988
5868
|
center: [80, 50],
|
|
4989
5869
|
radius: 35
|
|
@@ -4996,7 +5876,7 @@ circle.set({
|
|
|
4996
5876
|
selected: true
|
|
4997
5877
|
});
|
|
4998
5878
|
</script>
|
|
4999
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5879
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
5000
5880
|
</div>
|
|
5001
5881
|
|
|
5002
5882
|
|
|
@@ -5052,7 +5932,7 @@ circle.set({
|
|
|
5052
5932
|
<div class="button run">Run</div>
|
|
5053
5933
|
</div>
|
|
5054
5934
|
|
|
5055
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5935
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
5056
5936
|
var circle = new Path.Circle({
|
|
5057
5937
|
center: [50, 50],
|
|
5058
5938
|
radius: 10,
|
|
@@ -5067,7 +5947,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
5067
5947
|
copy.position.x += i * copy.bounds.width;
|
|
5068
5948
|
}
|
|
5069
5949
|
</script>
|
|
5070
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5950
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
5071
5951
|
</div>
|
|
5072
5952
|
|
|
5073
5953
|
|
|
@@ -5193,7 +6073,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
5193
6073
|
<div class="button run">Run</div>
|
|
5194
6074
|
</div>
|
|
5195
6075
|
|
|
5196
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6076
|
+
<script type="text/paperscript" canvas="canvas-64">
|
|
5197
6077
|
var circle = new Path.Circle({
|
|
5198
6078
|
center: [50, 50],
|
|
5199
6079
|
radius: 5,
|
|
@@ -5210,7 +6090,7 @@ raster.position.x += 100;
|
|
|
5210
6090
|
circle.scale(5);
|
|
5211
6091
|
raster.scale(5);
|
|
5212
6092
|
</script>
|
|
5213
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6093
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
|
|
5214
6094
|
</div>
|
|
5215
6095
|
|
|
5216
6096
|
|
|
@@ -5264,7 +6144,7 @@ raster.scale(5);
|
|
|
5264
6144
|
<div class="button run">Run</div>
|
|
5265
6145
|
</div>
|
|
5266
6146
|
|
|
5267
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6147
|
+
<script type="text/paperscript" canvas="canvas-65">
|
|
5268
6148
|
var path = new Path.Star({
|
|
5269
6149
|
center: [50, 50],
|
|
5270
6150
|
points: 12,
|
|
@@ -5285,7 +6165,7 @@ function onMouseDown(event) {
|
|
|
5285
6165
|
}
|
|
5286
6166
|
}
|
|
5287
6167
|
</script>
|
|
5288
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6168
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
|
|
5289
6169
|
</div>
|
|
5290
6170
|
|
|
5291
6171
|
|
|
@@ -5803,11 +6683,17 @@ function onMouseDown(event) {
|
|
|
5803
6683
|
</div>
|
|
5804
6684
|
<div class="member-description hidden">
|
|
5805
6685
|
<div class="member-text">
|
|
5806
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
6686
|
+
<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>
|
|
5807
6687
|
<ul class="member-list">
|
|
5808
6688
|
<h4>Options:</h4>
|
|
5809
|
-
<li
|
|
5810
|
-
|
|
6689
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
6690
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
6691
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
6692
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
6693
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
6694
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
6695
|
+
`paper.view.matrix` is used, for all other settings of
|
|
6696
|
+
`options.bounds` the identity matrix is used.</li>
|
|
5811
6697
|
<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>
|
|
5812
6698
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
5813
6699
|
<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>
|
|
@@ -5815,6 +6701,12 @@ function onMouseDown(event) {
|
|
|
5815
6701
|
<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>
|
|
5816
6702
|
<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>
|
|
5817
6703
|
<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>
|
|
6704
|
+
<li>[options.processNode] {Function} the function to process the
|
|
6705
|
+
SVG node made for each exported item, receiving an object with the
|
|
6706
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
6707
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
6708
|
+
is called before the item's name, style, visibility and data are set
|
|
6709
|
+
on the node, which replace attributes of the same names.</li>
|
|
5818
6710
|
</ul>
|
|
5819
6711
|
|
|
5820
6712
|
<ul class="member-list">
|
|
@@ -5857,6 +6749,7 @@ function onMouseDown(event) {
|
|
|
5857
6749
|
<div class="member-text">
|
|
5858
6750
|
<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>
|
|
5859
6751
|
<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>
|
|
6752
|
+
<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>
|
|
5860
6753
|
<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>
|
|
5861
6754
|
<ul class="member-list">
|
|
5862
6755
|
<h4>Options:</h4>
|
|
@@ -5868,6 +6761,13 @@ function onMouseDown(event) {
|
|
|
5868
6761
|
<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>
|
|
5869
6762
|
<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>
|
|
5870
6763
|
<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>
|
|
6764
|
+
<li>[options.processItem] {Function} the function to process the
|
|
6765
|
+
item made for each imported SVG element, receiving an object with
|
|
6766
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
6767
|
+
doesn't import, or return an item to replace it with. It is called
|
|
6768
|
+
after the element's attributes and data are applied to the item, so
|
|
6769
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
6770
|
+
copy them over from `item` as needed.</li>
|
|
5871
6771
|
</ul>
|
|
5872
6772
|
|
|
5873
6773
|
<ul class="member-list">
|
|
@@ -7147,7 +8047,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
7147
8047
|
<div class="button run">Run</div>
|
|
7148
8048
|
</div>
|
|
7149
8049
|
|
|
7150
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8050
|
+
<script type="text/paperscript" canvas="canvas-66">
|
|
7151
8051
|
// Create a rectangle shaped path with its top left
|
|
7152
8052
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
7153
8053
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -7156,7 +8056,7 @@ path.fillColor = 'black';
|
|
|
7156
8056
|
// Rotate the path by 30 degrees:
|
|
7157
8057
|
path.rotate(30);
|
|
7158
8058
|
</script>
|
|
7159
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8059
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
|
|
7160
8060
|
</div>
|
|
7161
8061
|
|
|
7162
8062
|
|
|
@@ -7168,7 +8068,7 @@ path.rotate(30);
|
|
|
7168
8068
|
<div class="button run">Run</div>
|
|
7169
8069
|
</div>
|
|
7170
8070
|
|
|
7171
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8071
|
+
<script type="text/paperscript" canvas="canvas-67">
|
|
7172
8072
|
// Create a rectangle shaped path with its top left
|
|
7173
8073
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
7174
8074
|
var topLeft = new Point(175, 50);
|
|
@@ -7190,7 +8090,7 @@ function onFrame(event) {
|
|
|
7190
8090
|
path.rotate(3, view.center);
|
|
7191
8091
|
}
|
|
7192
8092
|
</script>
|
|
7193
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8093
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-67"></canvas></div>
|
|
7194
8094
|
</div>
|
|
7195
8095
|
|
|
7196
8096
|
|
|
@@ -7239,7 +8139,7 @@ function onFrame(event) {
|
|
|
7239
8139
|
<div class="button run">Run</div>
|
|
7240
8140
|
</div>
|
|
7241
8141
|
|
|
7242
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8142
|
+
<script type="text/paperscript" canvas="canvas-68">
|
|
7243
8143
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
7244
8144
|
// with a radius of 20:
|
|
7245
8145
|
var circle = new Path.Circle({
|
|
@@ -7251,7 +8151,7 @@ var circle = new Path.Circle({
|
|
|
7251
8151
|
// Scale the path by 150% from its center point
|
|
7252
8152
|
circle.scale(1.5);
|
|
7253
8153
|
</script>
|
|
7254
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8154
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
|
|
7255
8155
|
</div>
|
|
7256
8156
|
|
|
7257
8157
|
|
|
@@ -7263,7 +8163,7 @@ circle.scale(1.5);
|
|
|
7263
8163
|
<div class="button run">Run</div>
|
|
7264
8164
|
</div>
|
|
7265
8165
|
|
|
7266
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8166
|
+
<script type="text/paperscript" canvas="canvas-69">
|
|
7267
8167
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
7268
8168
|
// with a radius of 20:
|
|
7269
8169
|
var circle = new Path.Circle({
|
|
@@ -7275,7 +8175,7 @@ var circle = new Path.Circle({
|
|
|
7275
8175
|
// Scale the path 150% from its bottom left corner
|
|
7276
8176
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
7277
8177
|
</script>
|
|
7278
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8178
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-69"></canvas></div>
|
|
7279
8179
|
</div>
|
|
7280
8180
|
|
|
7281
8181
|
|
|
@@ -7331,7 +8231,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
7331
8231
|
<div class="button run">Run</div>
|
|
7332
8232
|
</div>
|
|
7333
8233
|
|
|
7334
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8234
|
+
<script type="text/paperscript" canvas="canvas-70">
|
|
7335
8235
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
7336
8236
|
// with a radius of 20:
|
|
7337
8237
|
var circle = new Path.Circle({
|
|
@@ -7343,7 +8243,7 @@ var circle = new Path.Circle({
|
|
|
7343
8243
|
// Scale the path horizontally by 300%
|
|
7344
8244
|
circle.scale(3, 1);
|
|
7345
8245
|
</script>
|
|
7346
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8246
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
|
|
7347
8247
|
</div>
|
|
7348
8248
|
|
|
7349
8249
|
|
|
@@ -7781,7 +8681,7 @@ circle.scale(3, 1);
|
|
|
7781
8681
|
<div class="button run">Run</div>
|
|
7782
8682
|
</div>
|
|
7783
8683
|
|
|
7784
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8684
|
+
<script type="text/paperscript" canvas="canvas-71">
|
|
7785
8685
|
// Create a rectangle shaped path with its top left corner
|
|
7786
8686
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
7787
8687
|
var path = new Path.Rectangle({
|
|
@@ -7802,7 +8702,7 @@ var circlePath = new Path.Circle({
|
|
|
7802
8702
|
// the rectangular path:
|
|
7803
8703
|
circlePath.fitBounds(path.bounds);
|
|
7804
8704
|
</script>
|
|
7805
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8705
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-71"></canvas></div>
|
|
7806
8706
|
</div>
|
|
7807
8707
|
|
|
7808
8708
|
|
|
@@ -7814,7 +8714,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
7814
8714
|
<div class="button run">Run</div>
|
|
7815
8715
|
</div>
|
|
7816
8716
|
|
|
7817
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8717
|
+
<script type="text/paperscript" canvas="canvas-72">
|
|
7818
8718
|
// Create a rectangle shaped path with its top left corner
|
|
7819
8719
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
7820
8720
|
var path = new Path.Rectangle({
|
|
@@ -7835,7 +8735,7 @@ var circlePath = new Path.Circle({
|
|
|
7835
8735
|
// the rectangular path:
|
|
7836
8736
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
7837
8737
|
</script>
|
|
7838
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8738
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-72"></canvas></div>
|
|
7839
8739
|
</div>
|
|
7840
8740
|
|
|
7841
8741
|
|
|
@@ -7847,7 +8747,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
7847
8747
|
<div class="button run">Run</div>
|
|
7848
8748
|
</div>
|
|
7849
8749
|
|
|
7850
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8750
|
+
<script type="text/paperscript" canvas="canvas-73">
|
|
7851
8751
|
var path = new Path.Circle({
|
|
7852
8752
|
center: [80, 50],
|
|
7853
8753
|
radius: 30,
|
|
@@ -7857,7 +8757,7 @@ var path = new Path.Circle({
|
|
|
7857
8757
|
// Fit the path to the bounding rectangle of the view:
|
|
7858
8758
|
path.fitBounds(view.bounds);
|
|
7859
8759
|
</script>
|
|
7860
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8760
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-73"></canvas></div>
|
|
7861
8761
|
</div>
|
|
7862
8762
|
|
|
7863
8763
|
|
|
@@ -7883,7 +8783,7 @@ path.fitBounds(view.bounds);
|
|
|
7883
8783
|
<li>
|
|
7884
8784
|
<tt>type:</tt>
|
|
7885
8785
|
<tt>String</tt>
|
|
7886
|
-
— 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>
|
|
8786
|
+
— 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>
|
|
7887
8787
|
|
|
7888
8788
|
</li>
|
|
7889
8789
|
|
|
@@ -7918,7 +8818,7 @@ path.fitBounds(view.bounds);
|
|
|
7918
8818
|
<div class="button run">Run</div>
|
|
7919
8819
|
</div>
|
|
7920
8820
|
|
|
7921
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8821
|
+
<script type="text/paperscript" canvas="canvas-74">
|
|
7922
8822
|
// Create a circle shaped path at the center of the view:
|
|
7923
8823
|
var path = new Path.Circle({
|
|
7924
8824
|
center: view.center,
|
|
@@ -7936,7 +8836,7 @@ path.on('mouseleave', function() {
|
|
|
7936
8836
|
this.fillColor = 'black';
|
|
7937
8837
|
});
|
|
7938
8838
|
</script>
|
|
7939
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8839
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
|
|
7940
8840
|
</div>
|
|
7941
8841
|
|
|
7942
8842
|
|
|
@@ -7960,7 +8860,7 @@ path.on('mouseleave', function() {
|
|
|
7960
8860
|
<li>
|
|
7961
8861
|
<tt>object:</tt>
|
|
7962
8862
|
<tt>Object</tt>
|
|
7963
|
-
— 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>
|
|
8863
|
+
— 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>
|
|
7964
8864
|
|
|
7965
8865
|
</li>
|
|
7966
8866
|
|
|
@@ -7988,7 +8888,7 @@ path.on('mouseleave', function() {
|
|
|
7988
8888
|
<div class="button run">Run</div>
|
|
7989
8889
|
</div>
|
|
7990
8890
|
|
|
7991
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8891
|
+
<script type="text/paperscript" canvas="canvas-75">
|
|
7992
8892
|
// Create a circle shaped path at the center of the view:
|
|
7993
8893
|
var path = new Path.Circle({
|
|
7994
8894
|
center: view.center,
|
|
@@ -8006,7 +8906,7 @@ path.on({
|
|
|
8006
8906
|
}
|
|
8007
8907
|
});
|
|
8008
8908
|
</script>
|
|
8009
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8909
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-75"></canvas></div>
|
|
8010
8910
|
</div>
|
|
8011
8911
|
|
|
8012
8912
|
|
|
@@ -8018,7 +8918,7 @@ path.on({
|
|
|
8018
8918
|
<div class="button run">Run</div>
|
|
8019
8919
|
</div>
|
|
8020
8920
|
|
|
8021
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8921
|
+
<script type="text/paperscript" canvas="canvas-76">
|
|
8022
8922
|
var pathHandlers = {
|
|
8023
8923
|
mouseenter: function(event) {
|
|
8024
8924
|
this.fillColor = 'red';
|
|
@@ -8041,7 +8941,7 @@ function onMouseDown(event) {
|
|
|
8041
8941
|
path.on(pathHandlers);
|
|
8042
8942
|
}
|
|
8043
8943
|
</script>
|
|
8044
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8944
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-76"></canvas></div>
|
|
8045
8945
|
</div>
|
|
8046
8946
|
|
|
8047
8947
|
|
|
@@ -8065,7 +8965,7 @@ function onMouseDown(event) {
|
|
|
8065
8965
|
<li>
|
|
8066
8966
|
<tt>type:</tt>
|
|
8067
8967
|
<tt>String</tt>
|
|
8068
|
-
— 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>
|
|
8968
|
+
— 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>
|
|
8069
8969
|
|
|
8070
8970
|
</li>
|
|
8071
8971
|
|
|
@@ -8113,7 +9013,7 @@ function onMouseDown(event) {
|
|
|
8113
9013
|
<li>
|
|
8114
9014
|
<tt>object:</tt>
|
|
8115
9015
|
<tt>Object</tt>
|
|
8116
|
-
— 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>
|
|
9016
|
+
— 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>
|
|
8117
9017
|
|
|
8118
9018
|
</li>
|
|
8119
9019
|
|
|
@@ -8154,7 +9054,7 @@ function onMouseDown(event) {
|
|
|
8154
9054
|
<li>
|
|
8155
9055
|
<tt>type:</tt>
|
|
8156
9056
|
<tt>String</tt>
|
|
8157
|
-
— 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>
|
|
9057
|
+
— 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>
|
|
8158
9058
|
|
|
8159
9059
|
</li>
|
|
8160
9060
|
|
|
@@ -8202,7 +9102,7 @@ function onMouseDown(event) {
|
|
|
8202
9102
|
<li>
|
|
8203
9103
|
<tt>type:</tt>
|
|
8204
9104
|
<tt>String</tt>
|
|
8205
|
-
— 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>
|
|
9105
|
+
— 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>
|
|
8206
9106
|
|
|
8207
9107
|
</li>
|
|
8208
9108
|
|
|
@@ -8269,7 +9169,7 @@ function onMouseDown(event) {
|
|
|
8269
9169
|
<div class="button run">Run</div>
|
|
8270
9170
|
</div>
|
|
8271
9171
|
|
|
8272
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9172
|
+
<script type="text/paperscript" canvas="canvas-77">
|
|
8273
9173
|
function onMouseDrag(event) {
|
|
8274
9174
|
// Create a circle shaped path at the mouse position,
|
|
8275
9175
|
// with a radius of 10:
|
|
@@ -8286,7 +9186,7 @@ function onMouseDrag(event) {
|
|
|
8286
9186
|
});
|
|
8287
9187
|
}
|
|
8288
9188
|
</script>
|
|
8289
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9189
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-77"></canvas></div>
|
|
8290
9190
|
</div>
|
|
8291
9191
|
|
|
8292
9192
|
|
|
@@ -8316,7 +9216,7 @@ function onMouseDrag(event) {
|
|
|
8316
9216
|
<div class="button run">Run</div>
|
|
8317
9217
|
</div>
|
|
8318
9218
|
|
|
8319
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9219
|
+
<script type="text/paperscript" canvas="canvas-78">
|
|
8320
9220
|
function onMouseMove(event) {
|
|
8321
9221
|
// Create a circle shaped path at the mouse position,
|
|
8322
9222
|
// with a radius of 10:
|
|
@@ -8330,7 +9230,7 @@ function onMouseMove(event) {
|
|
|
8330
9230
|
path.removeOnMove();
|
|
8331
9231
|
}
|
|
8332
9232
|
</script>
|
|
8333
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9233
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-78"></canvas></div>
|
|
8334
9234
|
</div>
|
|
8335
9235
|
|
|
8336
9236
|
|
|
@@ -8360,7 +9260,7 @@ function onMouseMove(event) {
|
|
|
8360
9260
|
<div class="button run">Run</div>
|
|
8361
9261
|
</div>
|
|
8362
9262
|
|
|
8363
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9263
|
+
<script type="text/paperscript" canvas="canvas-79">
|
|
8364
9264
|
function onMouseDown(event) {
|
|
8365
9265
|
// Create a circle shaped path at the mouse position,
|
|
8366
9266
|
// with a radius of 10:
|
|
@@ -8374,7 +9274,7 @@ function onMouseDown(event) {
|
|
|
8374
9274
|
path.removeOnDown();
|
|
8375
9275
|
}
|
|
8376
9276
|
</script>
|
|
8377
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9277
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-79"></canvas></div>
|
|
8378
9278
|
</div>
|
|
8379
9279
|
|
|
8380
9280
|
|
|
@@ -8404,7 +9304,7 @@ function onMouseDown(event) {
|
|
|
8404
9304
|
<div class="button run">Run</div>
|
|
8405
9305
|
</div>
|
|
8406
9306
|
|
|
8407
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9307
|
+
<script type="text/paperscript" canvas="canvas-80">
|
|
8408
9308
|
function onMouseDrag(event) {
|
|
8409
9309
|
// Create a circle shaped path at the mouse position,
|
|
8410
9310
|
// with a radius of 10:
|
|
@@ -8418,7 +9318,7 @@ function onMouseDrag(event) {
|
|
|
8418
9318
|
path.removeOnDrag();
|
|
8419
9319
|
}
|
|
8420
9320
|
</script>
|
|
8421
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9321
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-80"></canvas></div>
|
|
8422
9322
|
</div>
|
|
8423
9323
|
|
|
8424
9324
|
|
|
@@ -8448,7 +9348,7 @@ function onMouseDrag(event) {
|
|
|
8448
9348
|
<div class="button run">Run</div>
|
|
8449
9349
|
</div>
|
|
8450
9350
|
|
|
8451
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9351
|
+
<script type="text/paperscript" canvas="canvas-81">
|
|
8452
9352
|
function onMouseDown(event) {
|
|
8453
9353
|
// Create a circle shaped path at the mouse position,
|
|
8454
9354
|
// with a radius of 10:
|
|
@@ -8462,7 +9362,7 @@ function onMouseDown(event) {
|
|
|
8462
9362
|
path.removeOnUp();
|
|
8463
9363
|
}
|
|
8464
9364
|
</script>
|
|
8465
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9365
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-81"></canvas></div>
|
|
8466
9366
|
</div>
|
|
8467
9367
|
|
|
8468
9368
|
|
|
@@ -8535,7 +9435,7 @@ function onMouseDown(event) {
|
|
|
8535
9435
|
<div class="button run">Run</div>
|
|
8536
9436
|
</div>
|
|
8537
9437
|
|
|
8538
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9438
|
+
<script type="text/paperscript" canvas="canvas-82">
|
|
8539
9439
|
var path = new Path.Circle({
|
|
8540
9440
|
radius: view.bounds.height * 0.4,
|
|
8541
9441
|
center: view.center
|
|
@@ -8546,7 +9446,7 @@ path.tween(
|
|
|
8546
9446
|
3000
|
|
8547
9447
|
);
|
|
8548
9448
|
</script>
|
|
8549
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9449
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-82"></canvas></div>
|
|
8550
9450
|
</div>
|
|
8551
9451
|
|
|
8552
9452
|
|
|
@@ -8558,7 +9458,7 @@ path.tween(
|
|
|
8558
9458
|
<div class="button run">Run</div>
|
|
8559
9459
|
</div>
|
|
8560
9460
|
|
|
8561
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9461
|
+
<script type="text/paperscript" canvas="canvas-83">
|
|
8562
9462
|
var path = new Shape.Rectangle({
|
|
8563
9463
|
fillColor: 'red',
|
|
8564
9464
|
center: [50, view.center.y],
|
|
@@ -8573,7 +9473,7 @@ path.tween({
|
|
|
8573
9473
|
duration: 2000
|
|
8574
9474
|
});
|
|
8575
9475
|
</script>
|
|
8576
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9476
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-83"></canvas></div>
|
|
8577
9477
|
</div>
|
|
8578
9478
|
|
|
8579
9479
|
|
|
@@ -8639,7 +9539,7 @@ path.tween({
|
|
|
8639
9539
|
<div class="button run">Run</div>
|
|
8640
9540
|
</div>
|
|
8641
9541
|
|
|
8642
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9542
|
+
<script type="text/paperscript" canvas="canvas-84">
|
|
8643
9543
|
var path = new Path.Rectangle({
|
|
8644
9544
|
size: [100, 100],
|
|
8645
9545
|
position: view.center,
|
|
@@ -8653,7 +9553,7 @@ path.tween({
|
|
|
8653
9553
|
'segments[2].point.x': '-= 50'
|
|
8654
9554
|
}, 3000);
|
|
8655
9555
|
</script>
|
|
8656
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9556
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-84"></canvas></div>
|
|
8657
9557
|
</div>
|
|
8658
9558
|
|
|
8659
9559
|
|
|
@@ -8712,7 +9612,7 @@ path.tween({
|
|
|
8712
9612
|
<div class="button run">Run</div>
|
|
8713
9613
|
</div>
|
|
8714
9614
|
|
|
8715
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9615
|
+
<script type="text/paperscript" canvas="canvas-85">
|
|
8716
9616
|
var path = new Path.Circle({
|
|
8717
9617
|
fillColor: 'blue',
|
|
8718
9618
|
radius: view.bounds.height * 0.4,
|
|
@@ -8728,7 +9628,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
8728
9628
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
8729
9629
|
};
|
|
8730
9630
|
</script>
|
|
8731
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9631
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-85"></canvas></div>
|
|
8732
9632
|
</div>
|
|
8733
9633
|
|
|
8734
9634
|
|
|
@@ -8849,7 +9749,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
8849
9749
|
<div class="button run">Run</div>
|
|
8850
9750
|
</div>
|
|
8851
9751
|
|
|
8852
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9752
|
+
<script type="text/paperscript" canvas="canvas-86">
|
|
8853
9753
|
var path = new Path.Circle({
|
|
8854
9754
|
fillColor: 'blue',
|
|
8855
9755
|
radius: view.bounds.height * 0.4,
|
|
@@ -8857,7 +9757,7 @@ var path = new Path.Circle({
|
|
|
8857
9757
|
});
|
|
8858
9758
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
8859
9759
|
</script>
|
|
8860
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9760
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-86"></canvas></div>
|
|
8861
9761
|
</div>
|
|
8862
9762
|
|
|
8863
9763
|
|
|
@@ -8871,7 +9771,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
8871
9771
|
|
|
8872
9772
|
<!-- =========================== copyright notice ========================== -->
|
|
8873
9773
|
<p class="footer">
|
|
8874
|
-
Paper.js v0.
|
|
9774
|
+
Paper.js v0.17.0<br>
|
|
8875
9775
|
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>
|
|
8876
9776
|
<div class="content-end"></div>
|
|
8877
9777
|
|