paper 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/dist/docs/assets/js/paper.js +4565 -733
- package/dist/docs/classes/AreaText.html +720 -242
- package/dist/docs/classes/ChangeFlag.html +1 -1
- package/dist/docs/classes/Color.html +218 -21
- package/dist/docs/classes/CompoundPath.html +1146 -296
- package/dist/docs/classes/Curve.html +1 -1
- 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 +792 -243
- package/dist/docs/classes/HitResult.html +1 -1
- package/dist/docs/classes/HostItem.html +720 -242
- package/dist/docs/classes/Item.html +777 -242
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +734 -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 +1195 -252
- package/dist/docs/classes/PathItem.html +1148 -298
- package/dist/docs/classes/PathText.html +720 -242
- package/dist/docs/classes/PatternDefinition.html +367 -0
- package/dist/docs/classes/Point.html +1 -1
- package/dist/docs/classes/PointText.html +720 -242
- package/dist/docs/classes/Project.html +177 -7
- package/dist/docs/classes/Raster.html +720 -242
- package/dist/docs/classes/Rectangle.html +1 -1
- package/dist/docs/classes/Segment.html +3 -3
- package/dist/docs/classes/Shape.html +720 -242
- package/dist/docs/classes/Size.html +1 -1
- package/dist/docs/classes/StrokeProfileStop.html +346 -0
- package/dist/docs/classes/Style.html +1 -1
- package/dist/docs/classes/SymbolDefinition.html +28 -2
- package/dist/docs/classes/SymbolItem.html +720 -242
- package/dist/docs/classes/TextItem.html +720 -242
- 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 +4476 -674
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +4565 -733
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +5111 -823
- package/dist/paper.d.ts +898 -47
- 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 +5 -3
|
@@ -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
|
|
|
@@ -4119,7 +4576,7 @@ path.dashArray = [10, 4];
|
|
|
4119
4576
|
<div class="button run">Run</div>
|
|
4120
4577
|
</div>
|
|
4121
4578
|
|
|
4122
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4579
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
4123
4580
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
4124
4581
|
// with a radius of 35:
|
|
4125
4582
|
var circle = new Path.Circle({
|
|
@@ -4130,7 +4587,7 @@ var circle = new Path.Circle({
|
|
|
4130
4587
|
// Set the fill color of the circle to RGB red:
|
|
4131
4588
|
circle.fillColor = new Color(1, 0, 0);
|
|
4132
4589
|
</script>
|
|
4133
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4590
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
4134
4591
|
</div>
|
|
4135
4592
|
|
|
4136
4593
|
|
|
@@ -4205,7 +4662,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
4205
4662
|
<div class="button run">Run</div>
|
|
4206
4663
|
</div>
|
|
4207
4664
|
|
|
4208
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4665
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
4209
4666
|
var circle = new Path.Circle({
|
|
4210
4667
|
center: [80, 50],
|
|
4211
4668
|
radius: 35,
|
|
@@ -4218,7 +4675,7 @@ var circle = new Path.Circle({
|
|
|
4218
4675
|
shadowOffset: new Point(5, 5)
|
|
4219
4676
|
});
|
|
4220
4677
|
</script>
|
|
4221
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4678
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
4222
4679
|
</div>
|
|
4223
4680
|
|
|
4224
4681
|
|
|
@@ -4359,7 +4816,7 @@ var circle = new Path.Circle({
|
|
|
4359
4816
|
<div class="button run">Run</div>
|
|
4360
4817
|
</div>
|
|
4361
4818
|
|
|
4362
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4819
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
4363
4820
|
// Create a rectangle shaped path with its top left point at:
|
|
4364
4821
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
4365
4822
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -4370,7 +4827,7 @@ path.onFrame = function(event) {
|
|
|
4370
4827
|
this.rotate(3);
|
|
4371
4828
|
}
|
|
4372
4829
|
</script>
|
|
4373
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4830
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
4374
4831
|
</div>
|
|
4375
4832
|
|
|
4376
4833
|
|
|
@@ -4414,7 +4871,7 @@ path.onFrame = function(event) {
|
|
|
4414
4871
|
<div class="button run">Run</div>
|
|
4415
4872
|
</div>
|
|
4416
4873
|
|
|
4417
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4874
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
4418
4875
|
// Create a circle shaped path at the center of the view:
|
|
4419
4876
|
var path = new Path.Circle({
|
|
4420
4877
|
center: view.center,
|
|
@@ -4428,7 +4885,7 @@ path.onMouseDown = function(event) {
|
|
|
4428
4885
|
this.fillColor = 'red';
|
|
4429
4886
|
}
|
|
4430
4887
|
</script>
|
|
4431
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4888
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
4432
4889
|
</div>
|
|
4433
4890
|
|
|
4434
4891
|
|
|
@@ -4440,7 +4897,7 @@ path.onMouseDown = function(event) {
|
|
|
4440
4897
|
<div class="button run">Run</div>
|
|
4441
4898
|
</div>
|
|
4442
4899
|
|
|
4443
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4900
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
4444
4901
|
// Loop 30 times:
|
|
4445
4902
|
for (var i = 0; i < 30; i++) {
|
|
4446
4903
|
// Create a circle shaped path at a random position
|
|
@@ -4458,7 +4915,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4458
4915
|
}
|
|
4459
4916
|
}
|
|
4460
4917
|
</script>
|
|
4461
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4918
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
4462
4919
|
</div>
|
|
4463
4920
|
|
|
4464
4921
|
|
|
@@ -4502,7 +4959,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4502
4959
|
<div class="button run">Run</div>
|
|
4503
4960
|
</div>
|
|
4504
4961
|
|
|
4505
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4962
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
4506
4963
|
// Create a circle shaped path at the center of the view:
|
|
4507
4964
|
var path = new Path.Circle({
|
|
4508
4965
|
center: view.center,
|
|
@@ -4515,7 +4972,7 @@ path.onMouseDrag = function(event) {
|
|
|
4515
4972
|
path.position += event.delta;
|
|
4516
4973
|
}
|
|
4517
4974
|
</script>
|
|
4518
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
4975
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-50"></canvas></div>
|
|
4519
4976
|
</div>
|
|
4520
4977
|
|
|
4521
4978
|
|
|
@@ -4559,7 +5016,7 @@ path.onMouseDrag = function(event) {
|
|
|
4559
5016
|
<div class="button run">Run</div>
|
|
4560
5017
|
</div>
|
|
4561
5018
|
|
|
4562
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5019
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
4563
5020
|
// Create a circle shaped path at the center of the view:
|
|
4564
5021
|
var path = new Path.Circle({
|
|
4565
5022
|
center: view.center,
|
|
@@ -4573,7 +5030,7 @@ path.onMouseUp = function(event) {
|
|
|
4573
5030
|
this.fillColor = 'red';
|
|
4574
5031
|
}
|
|
4575
5032
|
</script>
|
|
4576
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5033
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
4577
5034
|
</div>
|
|
4578
5035
|
|
|
4579
5036
|
|
|
@@ -4617,7 +5074,7 @@ path.onMouseUp = function(event) {
|
|
|
4617
5074
|
<div class="button run">Run</div>
|
|
4618
5075
|
</div>
|
|
4619
5076
|
|
|
4620
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5077
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
4621
5078
|
// Create a circle shaped path at the center of the view:
|
|
4622
5079
|
var path = new Path.Circle({
|
|
4623
5080
|
center: view.center,
|
|
@@ -4631,7 +5088,7 @@ path.onClick = function(event) {
|
|
|
4631
5088
|
this.fillColor = 'red';
|
|
4632
5089
|
}
|
|
4633
5090
|
</script>
|
|
4634
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5091
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
4635
5092
|
</div>
|
|
4636
5093
|
|
|
4637
5094
|
|
|
@@ -4643,7 +5100,7 @@ path.onClick = function(event) {
|
|
|
4643
5100
|
<div class="button run">Run</div>
|
|
4644
5101
|
</div>
|
|
4645
5102
|
|
|
4646
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5103
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
4647
5104
|
// Loop 30 times:
|
|
4648
5105
|
for (var i = 0; i < 30; i++) {
|
|
4649
5106
|
// Create a circle shaped path at a random position
|
|
@@ -4661,7 +5118,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4661
5118
|
}
|
|
4662
5119
|
}
|
|
4663
5120
|
</script>
|
|
4664
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5121
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
|
|
4665
5122
|
</div>
|
|
4666
5123
|
|
|
4667
5124
|
|
|
@@ -4705,7 +5162,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4705
5162
|
<div class="button run">Run</div>
|
|
4706
5163
|
</div>
|
|
4707
5164
|
|
|
4708
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5165
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
4709
5166
|
// Create a circle shaped path at the center of the view:
|
|
4710
5167
|
var path = new Path.Circle({
|
|
4711
5168
|
center: view.center,
|
|
@@ -4719,7 +5176,7 @@ path.onDoubleClick = function(event) {
|
|
|
4719
5176
|
this.fillColor = 'red';
|
|
4720
5177
|
}
|
|
4721
5178
|
</script>
|
|
4722
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5179
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
|
|
4723
5180
|
</div>
|
|
4724
5181
|
|
|
4725
5182
|
|
|
@@ -4731,7 +5188,7 @@ path.onDoubleClick = function(event) {
|
|
|
4731
5188
|
<div class="button run">Run</div>
|
|
4732
5189
|
</div>
|
|
4733
5190
|
|
|
4734
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5191
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
4735
5192
|
// Loop 30 times:
|
|
4736
5193
|
for (var i = 0; i < 30; i++) {
|
|
4737
5194
|
// Create a circle shaped path at a random position
|
|
@@ -4749,7 +5206,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4749
5206
|
}
|
|
4750
5207
|
}
|
|
4751
5208
|
</script>
|
|
4752
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5209
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
|
|
4753
5210
|
</div>
|
|
4754
5211
|
|
|
4755
5212
|
|
|
@@ -4793,7 +5250,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
4793
5250
|
<div class="button run">Run</div>
|
|
4794
5251
|
</div>
|
|
4795
5252
|
|
|
4796
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5253
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
4797
5254
|
// Create a circle shaped path at the center of the view:
|
|
4798
5255
|
var path = new Path.Circle({
|
|
4799
5256
|
center: view.center,
|
|
@@ -4807,174 +5264,561 @@ path.onMouseMove = function(event) {
|
|
|
4807
5264
|
this.opacity = Math.random();
|
|
4808
5265
|
}
|
|
4809
5266
|
</script>
|
|
4810
|
-
<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>
|
|
5309
|
+
</div>
|
|
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>
|
|
4811
5492
|
</div>
|
|
4812
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>
|
|
4813
5647
|
|
|
4814
|
-
</div>
|
|
4815
5648
|
|
|
5649
|
+
|
|
5650
|
+
|
|
5651
|
+
|
|
5652
|
+
</div>
|
|
4816
5653
|
</div>
|
|
4817
5654
|
</div>
|
|
4818
5655
|
|
|
4819
5656
|
|
|
4820
|
-
<div id="
|
|
5657
|
+
<div id="inserteffects-index-effects" class="member">
|
|
4821
5658
|
<div class="member-link">
|
|
4822
|
-
<a name="
|
|
5659
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
4823
5660
|
</div>
|
|
4824
5661
|
<div class="member-description hidden">
|
|
4825
|
-
|
|
4826
5662
|
<div class="member-text">
|
|
4827
|
-
<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>
|
|
4828
5668
|
|
|
5669
|
+
<li>
|
|
5670
|
+
<tt>index:</tt>
|
|
5671
|
+
<tt>Number</tt>
|
|
5672
|
+
— the index at which to insert the effects
|
|
5673
|
+
|
|
5674
|
+
</li>
|
|
4829
5675
|
|
|
5676
|
+
<li>
|
|
5677
|
+
<tt>effects:</tt>
|
|
5678
|
+
Array of <tt>Object</tt> objects
|
|
5679
|
+
— the plain objects describing the effects
|
|
5680
|
+
|
|
5681
|
+
</li>
|
|
4830
5682
|
|
|
4831
|
-
|
|
4832
|
-
|
|
4833
|
-
<li>
|
|
4834
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
4835
|
-
</li>
|
|
4836
|
-
</ul>
|
|
4837
|
-
|
|
5683
|
+
</ul>
|
|
5684
|
+
|
|
4838
5685
|
|
|
4839
5686
|
<ul class="member-list">
|
|
4840
|
-
<h4>
|
|
5687
|
+
<h4>Returns:</h4>
|
|
4841
5688
|
|
|
4842
|
-
<li
|
|
5689
|
+
<li>
|
|
5690
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
5691
|
+
</li>
|
|
5692
|
+
|
|
4843
5693
|
|
|
4844
5694
|
</ul>
|
|
4845
5695
|
|
|
4846
|
-
<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>
|
|
4847
5696
|
|
|
4848
|
-
<div class="paperscript split">
|
|
4849
5697
|
|
|
4850
|
-
|
|
4851
|
-
|
|
5698
|
+
|
|
5699
|
+
|
|
4852
5700
|
</div>
|
|
4853
|
-
|
|
4854
|
-
<script type="text/paperscript" canvas="canvas-50">
|
|
4855
|
-
// Create a circle shaped path at the center of the view:
|
|
4856
|
-
var path = new Path.Circle({
|
|
4857
|
-
center: view.center,
|
|
4858
|
-
radius: 25,
|
|
4859
|
-
fillColor: 'black'
|
|
4860
|
-
});
|
|
4861
|
-
|
|
4862
|
-
// When the mouse enters the item, set its fill color to red:
|
|
4863
|
-
path.onMouseEnter = function(event) {
|
|
4864
|
-
this.fillColor = 'red';
|
|
4865
|
-
}
|
|
4866
|
-
|
|
4867
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
4868
|
-
path.onMouseLeave = function(event) {
|
|
4869
|
-
this.fillColor = 'black';
|
|
4870
|
-
}
|
|
4871
|
-
</script>
|
|
4872
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
4873
5701
|
</div>
|
|
4874
|
-
|
|
4875
|
-
|
|
4876
|
-
<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>
|
|
4877
|
-
|
|
4878
|
-
<div class="paperscript split">
|
|
4879
|
-
|
|
4880
|
-
<div class="buttons">
|
|
4881
|
-
<div class="button run">Run</div>
|
|
4882
5702
|
</div>
|
|
4883
5703
|
|
|
4884
|
-
|
|
4885
|
-
|
|
4886
|
-
|
|
4887
|
-
|
|
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
|
|
4888
5721
|
|
|
4889
|
-
|
|
4890
|
-
|
|
4891
|
-
|
|
5722
|
+
</li>
|
|
5723
|
+
|
|
5724
|
+
</ul>
|
|
4892
5725
|
|
|
4893
|
-
|
|
4894
|
-
|
|
4895
|
-
|
|
4896
|
-
|
|
4897
|
-
|
|
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>
|
|
4898
5733
|
|
|
4899
|
-
|
|
4900
|
-
|
|
5734
|
+
|
|
5735
|
+
</ul>
|
|
4901
5736
|
|
|
4902
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
4903
|
-
path.onMouseLeave = leave;
|
|
4904
|
-
}
|
|
4905
|
-
</script>
|
|
4906
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
4907
|
-
</div>
|
|
4908
5737
|
|
|
4909
5738
|
|
|
5739
|
+
|
|
5740
|
+
|
|
4910
5741
|
</div>
|
|
4911
|
-
|
|
4912
5742
|
</div>
|
|
4913
5743
|
</div>
|
|
4914
5744
|
|
|
4915
5745
|
|
|
4916
|
-
<div id="
|
|
5746
|
+
<div id="removeeffects" class="member">
|
|
4917
5747
|
<div class="member-link">
|
|
4918
|
-
<a name="
|
|
5748
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
4919
5749
|
</div>
|
|
4920
5750
|
<div class="member-description hidden">
|
|
4921
|
-
|
|
4922
5751
|
<div class="member-text">
|
|
4923
|
-
<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
|
+
|
|
4924
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>
|
|
4925
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>
|
|
4926
5771
|
|
|
4927
|
-
|
|
4928
|
-
|
|
4929
|
-
<li>
|
|
4930
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
4931
|
-
</li>
|
|
4932
|
-
</ul>
|
|
4933
|
-
|
|
5772
|
+
</ul>
|
|
5773
|
+
|
|
4934
5774
|
|
|
4935
5775
|
<ul class="member-list">
|
|
4936
|
-
<h4>
|
|
5776
|
+
<h4>Returns:</h4>
|
|
4937
5777
|
|
|
4938
|
-
<li
|
|
5778
|
+
<li>
|
|
5779
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
5780
|
+
</li>
|
|
5781
|
+
|
|
4939
5782
|
|
|
4940
5783
|
</ul>
|
|
4941
5784
|
|
|
4942
|
-
<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>
|
|
4943
5785
|
|
|
4944
|
-
<div class="paperscript split">
|
|
4945
5786
|
|
|
4946
|
-
|
|
4947
|
-
|
|
5787
|
+
|
|
5788
|
+
|
|
5789
|
+
</div>
|
|
5790
|
+
</div>
|
|
4948
5791
|
</div>
|
|
4949
5792
|
|
|
4950
|
-
|
|
4951
|
-
|
|
4952
|
-
|
|
4953
|
-
|
|
4954
|
-
radius: 25,
|
|
4955
|
-
fillColor: 'black'
|
|
4956
|
-
});
|
|
4957
|
-
|
|
4958
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
4959
|
-
path.onMouseLeave = function(event) {
|
|
4960
|
-
this.fillColor = 'red';
|
|
4961
|
-
}
|
|
4962
|
-
</script>
|
|
4963
|
-
<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>
|
|
4964
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>
|
|
4965
5813
|
|
|
4966
5814
|
|
|
4967
|
-
</div>
|
|
4968
5815
|
|
|
5816
|
+
|
|
5817
|
+
|
|
4969
5818
|
</div>
|
|
4970
5819
|
</div>
|
|
4971
|
-
|
|
4972
5820
|
</div>
|
|
4973
5821
|
|
|
4974
|
-
|
|
4975
|
-
<!-- =========================== inherited methods ========================= -->
|
|
4976
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
4977
|
-
|
|
4978
5822
|
|
|
4979
5823
|
<div id="set-props" class="member">
|
|
4980
5824
|
<div class="member-link">
|
|
@@ -5019,7 +5863,7 @@ path.onMouseLeave = function(event) {
|
|
|
5019
5863
|
<div class="button run">Run</div>
|
|
5020
5864
|
</div>
|
|
5021
5865
|
|
|
5022
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5866
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
5023
5867
|
var circle = new Path.Circle({
|
|
5024
5868
|
center: [80, 50],
|
|
5025
5869
|
radius: 35
|
|
@@ -5032,7 +5876,7 @@ circle.set({
|
|
|
5032
5876
|
selected: true
|
|
5033
5877
|
});
|
|
5034
5878
|
</script>
|
|
5035
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5879
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
5036
5880
|
</div>
|
|
5037
5881
|
|
|
5038
5882
|
|
|
@@ -5088,7 +5932,7 @@ circle.set({
|
|
|
5088
5932
|
<div class="button run">Run</div>
|
|
5089
5933
|
</div>
|
|
5090
5934
|
|
|
5091
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5935
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
5092
5936
|
var circle = new Path.Circle({
|
|
5093
5937
|
center: [50, 50],
|
|
5094
5938
|
radius: 10,
|
|
@@ -5103,7 +5947,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
5103
5947
|
copy.position.x += i * copy.bounds.width;
|
|
5104
5948
|
}
|
|
5105
5949
|
</script>
|
|
5106
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5950
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
5107
5951
|
</div>
|
|
5108
5952
|
|
|
5109
5953
|
|
|
@@ -5229,7 +6073,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
5229
6073
|
<div class="button run">Run</div>
|
|
5230
6074
|
</div>
|
|
5231
6075
|
|
|
5232
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6076
|
+
<script type="text/paperscript" canvas="canvas-64">
|
|
5233
6077
|
var circle = new Path.Circle({
|
|
5234
6078
|
center: [50, 50],
|
|
5235
6079
|
radius: 5,
|
|
@@ -5246,7 +6090,7 @@ raster.position.x += 100;
|
|
|
5246
6090
|
circle.scale(5);
|
|
5247
6091
|
raster.scale(5);
|
|
5248
6092
|
</script>
|
|
5249
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6093
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
|
|
5250
6094
|
</div>
|
|
5251
6095
|
|
|
5252
6096
|
|
|
@@ -5300,7 +6144,7 @@ raster.scale(5);
|
|
|
5300
6144
|
<div class="button run">Run</div>
|
|
5301
6145
|
</div>
|
|
5302
6146
|
|
|
5303
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6147
|
+
<script type="text/paperscript" canvas="canvas-65">
|
|
5304
6148
|
var path = new Path.Star({
|
|
5305
6149
|
center: [50, 50],
|
|
5306
6150
|
points: 12,
|
|
@@ -5321,7 +6165,7 @@ function onMouseDown(event) {
|
|
|
5321
6165
|
}
|
|
5322
6166
|
}
|
|
5323
6167
|
</script>
|
|
5324
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6168
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
|
|
5325
6169
|
</div>
|
|
5326
6170
|
|
|
5327
6171
|
|
|
@@ -5839,11 +6683,17 @@ function onMouseDown(event) {
|
|
|
5839
6683
|
</div>
|
|
5840
6684
|
<div class="member-description hidden">
|
|
5841
6685
|
<div class="member-text">
|
|
5842
|
-
<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>
|
|
5843
6687
|
<ul class="member-list">
|
|
5844
6688
|
<h4>Options:</h4>
|
|
5845
|
-
<li
|
|
5846
|
-
|
|
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>
|
|
5847
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>
|
|
5848
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>
|
|
5849
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>
|
|
@@ -7197,7 +8047,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
7197
8047
|
<div class="button run">Run</div>
|
|
7198
8048
|
</div>
|
|
7199
8049
|
|
|
7200
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8050
|
+
<script type="text/paperscript" canvas="canvas-66">
|
|
7201
8051
|
// Create a rectangle shaped path with its top left
|
|
7202
8052
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
7203
8053
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -7206,7 +8056,7 @@ path.fillColor = 'black';
|
|
|
7206
8056
|
// Rotate the path by 30 degrees:
|
|
7207
8057
|
path.rotate(30);
|
|
7208
8058
|
</script>
|
|
7209
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8059
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
|
|
7210
8060
|
</div>
|
|
7211
8061
|
|
|
7212
8062
|
|
|
@@ -7218,7 +8068,7 @@ path.rotate(30);
|
|
|
7218
8068
|
<div class="button run">Run</div>
|
|
7219
8069
|
</div>
|
|
7220
8070
|
|
|
7221
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8071
|
+
<script type="text/paperscript" canvas="canvas-67">
|
|
7222
8072
|
// Create a rectangle shaped path with its top left
|
|
7223
8073
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
7224
8074
|
var topLeft = new Point(175, 50);
|
|
@@ -7240,7 +8090,7 @@ function onFrame(event) {
|
|
|
7240
8090
|
path.rotate(3, view.center);
|
|
7241
8091
|
}
|
|
7242
8092
|
</script>
|
|
7243
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8093
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-67"></canvas></div>
|
|
7244
8094
|
</div>
|
|
7245
8095
|
|
|
7246
8096
|
|
|
@@ -7289,7 +8139,7 @@ function onFrame(event) {
|
|
|
7289
8139
|
<div class="button run">Run</div>
|
|
7290
8140
|
</div>
|
|
7291
8141
|
|
|
7292
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8142
|
+
<script type="text/paperscript" canvas="canvas-68">
|
|
7293
8143
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
7294
8144
|
// with a radius of 20:
|
|
7295
8145
|
var circle = new Path.Circle({
|
|
@@ -7301,7 +8151,7 @@ var circle = new Path.Circle({
|
|
|
7301
8151
|
// Scale the path by 150% from its center point
|
|
7302
8152
|
circle.scale(1.5);
|
|
7303
8153
|
</script>
|
|
7304
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8154
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
|
|
7305
8155
|
</div>
|
|
7306
8156
|
|
|
7307
8157
|
|
|
@@ -7313,7 +8163,7 @@ circle.scale(1.5);
|
|
|
7313
8163
|
<div class="button run">Run</div>
|
|
7314
8164
|
</div>
|
|
7315
8165
|
|
|
7316
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8166
|
+
<script type="text/paperscript" canvas="canvas-69">
|
|
7317
8167
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
7318
8168
|
// with a radius of 20:
|
|
7319
8169
|
var circle = new Path.Circle({
|
|
@@ -7325,7 +8175,7 @@ var circle = new Path.Circle({
|
|
|
7325
8175
|
// Scale the path 150% from its bottom left corner
|
|
7326
8176
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
7327
8177
|
</script>
|
|
7328
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8178
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-69"></canvas></div>
|
|
7329
8179
|
</div>
|
|
7330
8180
|
|
|
7331
8181
|
|
|
@@ -7381,7 +8231,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
7381
8231
|
<div class="button run">Run</div>
|
|
7382
8232
|
</div>
|
|
7383
8233
|
|
|
7384
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8234
|
+
<script type="text/paperscript" canvas="canvas-70">
|
|
7385
8235
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
7386
8236
|
// with a radius of 20:
|
|
7387
8237
|
var circle = new Path.Circle({
|
|
@@ -7393,7 +8243,7 @@ var circle = new Path.Circle({
|
|
|
7393
8243
|
// Scale the path horizontally by 300%
|
|
7394
8244
|
circle.scale(3, 1);
|
|
7395
8245
|
</script>
|
|
7396
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8246
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
|
|
7397
8247
|
</div>
|
|
7398
8248
|
|
|
7399
8249
|
|
|
@@ -7831,7 +8681,7 @@ circle.scale(3, 1);
|
|
|
7831
8681
|
<div class="button run">Run</div>
|
|
7832
8682
|
</div>
|
|
7833
8683
|
|
|
7834
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8684
|
+
<script type="text/paperscript" canvas="canvas-71">
|
|
7835
8685
|
// Create a rectangle shaped path with its top left corner
|
|
7836
8686
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
7837
8687
|
var path = new Path.Rectangle({
|
|
@@ -7852,7 +8702,7 @@ var circlePath = new Path.Circle({
|
|
|
7852
8702
|
// the rectangular path:
|
|
7853
8703
|
circlePath.fitBounds(path.bounds);
|
|
7854
8704
|
</script>
|
|
7855
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8705
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-71"></canvas></div>
|
|
7856
8706
|
</div>
|
|
7857
8707
|
|
|
7858
8708
|
|
|
@@ -7864,7 +8714,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
7864
8714
|
<div class="button run">Run</div>
|
|
7865
8715
|
</div>
|
|
7866
8716
|
|
|
7867
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8717
|
+
<script type="text/paperscript" canvas="canvas-72">
|
|
7868
8718
|
// Create a rectangle shaped path with its top left corner
|
|
7869
8719
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
7870
8720
|
var path = new Path.Rectangle({
|
|
@@ -7885,7 +8735,7 @@ var circlePath = new Path.Circle({
|
|
|
7885
8735
|
// the rectangular path:
|
|
7886
8736
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
7887
8737
|
</script>
|
|
7888
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8738
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-72"></canvas></div>
|
|
7889
8739
|
</div>
|
|
7890
8740
|
|
|
7891
8741
|
|
|
@@ -7897,7 +8747,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
7897
8747
|
<div class="button run">Run</div>
|
|
7898
8748
|
</div>
|
|
7899
8749
|
|
|
7900
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8750
|
+
<script type="text/paperscript" canvas="canvas-73">
|
|
7901
8751
|
var path = new Path.Circle({
|
|
7902
8752
|
center: [80, 50],
|
|
7903
8753
|
radius: 30,
|
|
@@ -7907,7 +8757,7 @@ var path = new Path.Circle({
|
|
|
7907
8757
|
// Fit the path to the bounding rectangle of the view:
|
|
7908
8758
|
path.fitBounds(view.bounds);
|
|
7909
8759
|
</script>
|
|
7910
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8760
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-73"></canvas></div>
|
|
7911
8761
|
</div>
|
|
7912
8762
|
|
|
7913
8763
|
|
|
@@ -7933,7 +8783,7 @@ path.fitBounds(view.bounds);
|
|
|
7933
8783
|
<li>
|
|
7934
8784
|
<tt>type:</tt>
|
|
7935
8785
|
<tt>String</tt>
|
|
7936
|
-
— 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>
|
|
7937
8787
|
|
|
7938
8788
|
</li>
|
|
7939
8789
|
|
|
@@ -7968,7 +8818,7 @@ path.fitBounds(view.bounds);
|
|
|
7968
8818
|
<div class="button run">Run</div>
|
|
7969
8819
|
</div>
|
|
7970
8820
|
|
|
7971
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8821
|
+
<script type="text/paperscript" canvas="canvas-74">
|
|
7972
8822
|
// Create a circle shaped path at the center of the view:
|
|
7973
8823
|
var path = new Path.Circle({
|
|
7974
8824
|
center: view.center,
|
|
@@ -7986,7 +8836,7 @@ path.on('mouseleave', function() {
|
|
|
7986
8836
|
this.fillColor = 'black';
|
|
7987
8837
|
});
|
|
7988
8838
|
</script>
|
|
7989
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8839
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
|
|
7990
8840
|
</div>
|
|
7991
8841
|
|
|
7992
8842
|
|
|
@@ -8010,7 +8860,7 @@ path.on('mouseleave', function() {
|
|
|
8010
8860
|
<li>
|
|
8011
8861
|
<tt>object:</tt>
|
|
8012
8862
|
<tt>Object</tt>
|
|
8013
|
-
— 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>
|
|
8014
8864
|
|
|
8015
8865
|
</li>
|
|
8016
8866
|
|
|
@@ -8038,7 +8888,7 @@ path.on('mouseleave', function() {
|
|
|
8038
8888
|
<div class="button run">Run</div>
|
|
8039
8889
|
</div>
|
|
8040
8890
|
|
|
8041
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8891
|
+
<script type="text/paperscript" canvas="canvas-75">
|
|
8042
8892
|
// Create a circle shaped path at the center of the view:
|
|
8043
8893
|
var path = new Path.Circle({
|
|
8044
8894
|
center: view.center,
|
|
@@ -8056,7 +8906,7 @@ path.on({
|
|
|
8056
8906
|
}
|
|
8057
8907
|
});
|
|
8058
8908
|
</script>
|
|
8059
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8909
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-75"></canvas></div>
|
|
8060
8910
|
</div>
|
|
8061
8911
|
|
|
8062
8912
|
|
|
@@ -8068,7 +8918,7 @@ path.on({
|
|
|
8068
8918
|
<div class="button run">Run</div>
|
|
8069
8919
|
</div>
|
|
8070
8920
|
|
|
8071
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8921
|
+
<script type="text/paperscript" canvas="canvas-76">
|
|
8072
8922
|
var pathHandlers = {
|
|
8073
8923
|
mouseenter: function(event) {
|
|
8074
8924
|
this.fillColor = 'red';
|
|
@@ -8091,7 +8941,7 @@ function onMouseDown(event) {
|
|
|
8091
8941
|
path.on(pathHandlers);
|
|
8092
8942
|
}
|
|
8093
8943
|
</script>
|
|
8094
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8944
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-76"></canvas></div>
|
|
8095
8945
|
</div>
|
|
8096
8946
|
|
|
8097
8947
|
|
|
@@ -8115,7 +8965,7 @@ function onMouseDown(event) {
|
|
|
8115
8965
|
<li>
|
|
8116
8966
|
<tt>type:</tt>
|
|
8117
8967
|
<tt>String</tt>
|
|
8118
|
-
— 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>
|
|
8119
8969
|
|
|
8120
8970
|
</li>
|
|
8121
8971
|
|
|
@@ -8163,7 +9013,7 @@ function onMouseDown(event) {
|
|
|
8163
9013
|
<li>
|
|
8164
9014
|
<tt>object:</tt>
|
|
8165
9015
|
<tt>Object</tt>
|
|
8166
|
-
— 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>
|
|
8167
9017
|
|
|
8168
9018
|
</li>
|
|
8169
9019
|
|
|
@@ -8204,7 +9054,7 @@ function onMouseDown(event) {
|
|
|
8204
9054
|
<li>
|
|
8205
9055
|
<tt>type:</tt>
|
|
8206
9056
|
<tt>String</tt>
|
|
8207
|
-
— 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>
|
|
8208
9058
|
|
|
8209
9059
|
</li>
|
|
8210
9060
|
|
|
@@ -8252,7 +9102,7 @@ function onMouseDown(event) {
|
|
|
8252
9102
|
<li>
|
|
8253
9103
|
<tt>type:</tt>
|
|
8254
9104
|
<tt>String</tt>
|
|
8255
|
-
— 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>
|
|
8256
9106
|
|
|
8257
9107
|
</li>
|
|
8258
9108
|
|
|
@@ -8319,7 +9169,7 @@ function onMouseDown(event) {
|
|
|
8319
9169
|
<div class="button run">Run</div>
|
|
8320
9170
|
</div>
|
|
8321
9171
|
|
|
8322
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9172
|
+
<script type="text/paperscript" canvas="canvas-77">
|
|
8323
9173
|
function onMouseDrag(event) {
|
|
8324
9174
|
// Create a circle shaped path at the mouse position,
|
|
8325
9175
|
// with a radius of 10:
|
|
@@ -8336,7 +9186,7 @@ function onMouseDrag(event) {
|
|
|
8336
9186
|
});
|
|
8337
9187
|
}
|
|
8338
9188
|
</script>
|
|
8339
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9189
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-77"></canvas></div>
|
|
8340
9190
|
</div>
|
|
8341
9191
|
|
|
8342
9192
|
|
|
@@ -8366,7 +9216,7 @@ function onMouseDrag(event) {
|
|
|
8366
9216
|
<div class="button run">Run</div>
|
|
8367
9217
|
</div>
|
|
8368
9218
|
|
|
8369
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9219
|
+
<script type="text/paperscript" canvas="canvas-78">
|
|
8370
9220
|
function onMouseMove(event) {
|
|
8371
9221
|
// Create a circle shaped path at the mouse position,
|
|
8372
9222
|
// with a radius of 10:
|
|
@@ -8380,7 +9230,7 @@ function onMouseMove(event) {
|
|
|
8380
9230
|
path.removeOnMove();
|
|
8381
9231
|
}
|
|
8382
9232
|
</script>
|
|
8383
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9233
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-78"></canvas></div>
|
|
8384
9234
|
</div>
|
|
8385
9235
|
|
|
8386
9236
|
|
|
@@ -8410,7 +9260,7 @@ function onMouseMove(event) {
|
|
|
8410
9260
|
<div class="button run">Run</div>
|
|
8411
9261
|
</div>
|
|
8412
9262
|
|
|
8413
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9263
|
+
<script type="text/paperscript" canvas="canvas-79">
|
|
8414
9264
|
function onMouseDown(event) {
|
|
8415
9265
|
// Create a circle shaped path at the mouse position,
|
|
8416
9266
|
// with a radius of 10:
|
|
@@ -8424,7 +9274,7 @@ function onMouseDown(event) {
|
|
|
8424
9274
|
path.removeOnDown();
|
|
8425
9275
|
}
|
|
8426
9276
|
</script>
|
|
8427
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9277
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-79"></canvas></div>
|
|
8428
9278
|
</div>
|
|
8429
9279
|
|
|
8430
9280
|
|
|
@@ -8454,7 +9304,7 @@ function onMouseDown(event) {
|
|
|
8454
9304
|
<div class="button run">Run</div>
|
|
8455
9305
|
</div>
|
|
8456
9306
|
|
|
8457
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9307
|
+
<script type="text/paperscript" canvas="canvas-80">
|
|
8458
9308
|
function onMouseDrag(event) {
|
|
8459
9309
|
// Create a circle shaped path at the mouse position,
|
|
8460
9310
|
// with a radius of 10:
|
|
@@ -8468,7 +9318,7 @@ function onMouseDrag(event) {
|
|
|
8468
9318
|
path.removeOnDrag();
|
|
8469
9319
|
}
|
|
8470
9320
|
</script>
|
|
8471
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9321
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-80"></canvas></div>
|
|
8472
9322
|
</div>
|
|
8473
9323
|
|
|
8474
9324
|
|
|
@@ -8498,7 +9348,7 @@ function onMouseDrag(event) {
|
|
|
8498
9348
|
<div class="button run">Run</div>
|
|
8499
9349
|
</div>
|
|
8500
9350
|
|
|
8501
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9351
|
+
<script type="text/paperscript" canvas="canvas-81">
|
|
8502
9352
|
function onMouseDown(event) {
|
|
8503
9353
|
// Create a circle shaped path at the mouse position,
|
|
8504
9354
|
// with a radius of 10:
|
|
@@ -8512,7 +9362,7 @@ function onMouseDown(event) {
|
|
|
8512
9362
|
path.removeOnUp();
|
|
8513
9363
|
}
|
|
8514
9364
|
</script>
|
|
8515
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9365
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-81"></canvas></div>
|
|
8516
9366
|
</div>
|
|
8517
9367
|
|
|
8518
9368
|
|
|
@@ -8585,7 +9435,7 @@ function onMouseDown(event) {
|
|
|
8585
9435
|
<div class="button run">Run</div>
|
|
8586
9436
|
</div>
|
|
8587
9437
|
|
|
8588
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9438
|
+
<script type="text/paperscript" canvas="canvas-82">
|
|
8589
9439
|
var path = new Path.Circle({
|
|
8590
9440
|
radius: view.bounds.height * 0.4,
|
|
8591
9441
|
center: view.center
|
|
@@ -8596,7 +9446,7 @@ path.tween(
|
|
|
8596
9446
|
3000
|
|
8597
9447
|
);
|
|
8598
9448
|
</script>
|
|
8599
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9449
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-82"></canvas></div>
|
|
8600
9450
|
</div>
|
|
8601
9451
|
|
|
8602
9452
|
|
|
@@ -8608,7 +9458,7 @@ path.tween(
|
|
|
8608
9458
|
<div class="button run">Run</div>
|
|
8609
9459
|
</div>
|
|
8610
9460
|
|
|
8611
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9461
|
+
<script type="text/paperscript" canvas="canvas-83">
|
|
8612
9462
|
var path = new Shape.Rectangle({
|
|
8613
9463
|
fillColor: 'red',
|
|
8614
9464
|
center: [50, view.center.y],
|
|
@@ -8623,7 +9473,7 @@ path.tween({
|
|
|
8623
9473
|
duration: 2000
|
|
8624
9474
|
});
|
|
8625
9475
|
</script>
|
|
8626
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9476
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-83"></canvas></div>
|
|
8627
9477
|
</div>
|
|
8628
9478
|
|
|
8629
9479
|
|
|
@@ -8689,7 +9539,7 @@ path.tween({
|
|
|
8689
9539
|
<div class="button run">Run</div>
|
|
8690
9540
|
</div>
|
|
8691
9541
|
|
|
8692
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9542
|
+
<script type="text/paperscript" canvas="canvas-84">
|
|
8693
9543
|
var path = new Path.Rectangle({
|
|
8694
9544
|
size: [100, 100],
|
|
8695
9545
|
position: view.center,
|
|
@@ -8703,7 +9553,7 @@ path.tween({
|
|
|
8703
9553
|
'segments[2].point.x': '-= 50'
|
|
8704
9554
|
}, 3000);
|
|
8705
9555
|
</script>
|
|
8706
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9556
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-84"></canvas></div>
|
|
8707
9557
|
</div>
|
|
8708
9558
|
|
|
8709
9559
|
|
|
@@ -8762,7 +9612,7 @@ path.tween({
|
|
|
8762
9612
|
<div class="button run">Run</div>
|
|
8763
9613
|
</div>
|
|
8764
9614
|
|
|
8765
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9615
|
+
<script type="text/paperscript" canvas="canvas-85">
|
|
8766
9616
|
var path = new Path.Circle({
|
|
8767
9617
|
fillColor: 'blue',
|
|
8768
9618
|
radius: view.bounds.height * 0.4,
|
|
@@ -8778,7 +9628,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
8778
9628
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
8779
9629
|
};
|
|
8780
9630
|
</script>
|
|
8781
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9631
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-85"></canvas></div>
|
|
8782
9632
|
</div>
|
|
8783
9633
|
|
|
8784
9634
|
|
|
@@ -8899,7 +9749,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
8899
9749
|
<div class="button run">Run</div>
|
|
8900
9750
|
</div>
|
|
8901
9751
|
|
|
8902
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9752
|
+
<script type="text/paperscript" canvas="canvas-86">
|
|
8903
9753
|
var path = new Path.Circle({
|
|
8904
9754
|
fillColor: 'blue',
|
|
8905
9755
|
radius: view.bounds.height * 0.4,
|
|
@@ -8907,7 +9757,7 @@ var path = new Path.Circle({
|
|
|
8907
9757
|
});
|
|
8908
9758
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
8909
9759
|
</script>
|
|
8910
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9760
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-86"></canvas></div>
|
|
8911
9761
|
</div>
|
|
8912
9762
|
|
|
8913
9763
|
|
|
@@ -8921,7 +9771,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
8921
9771
|
|
|
8922
9772
|
<!-- =========================== copyright notice ========================== -->
|
|
8923
9773
|
<p class="footer">
|
|
8924
|
-
Paper.js v0.
|
|
9774
|
+
Paper.js v0.17.0<br>
|
|
8925
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>
|
|
8926
9776
|
<div class="content-end"></div>
|
|
8927
9777
|
|