paper 0.15.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +158 -0
- package/README.md +24 -16
- package/dist/docs/assets/js/paper.js +4811 -808
- package/dist/docs/classes/AreaText.html +771 -243
- package/dist/docs/classes/ChangeFlag.html +1 -1
- package/dist/docs/classes/Color.html +218 -21
- package/dist/docs/classes/CompoundPath.html +1174 -274
- package/dist/docs/classes/Curve.html +2 -2
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/DrawEvent.html +69 -0
- package/dist/docs/classes/Effect.html +434 -0
- package/dist/docs/classes/EffectInstance.html +304 -0
- package/dist/docs/classes/Event.html +1 -1
- package/dist/docs/classes/Gradient.html +1 -1
- package/dist/docs/classes/GradientStop.html +1 -1
- package/dist/docs/classes/Group.html +842 -243
- package/dist/docs/classes/HitResult.html +1 -1
- package/dist/docs/classes/HostItem.html +770 -242
- package/dist/docs/classes/Item.html +827 -242
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +784 -185
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +1 -1
- package/dist/docs/classes/PaperScript.html +4 -2
- package/dist/docs/classes/Path.html +1366 -352
- package/dist/docs/classes/PathItem.html +1198 -298
- package/dist/docs/classes/PathText.html +772 -244
- package/dist/docs/classes/PatternDefinition.html +367 -0
- package/dist/docs/classes/Point.html +33 -5
- package/dist/docs/classes/PointText.html +771 -243
- package/dist/docs/classes/Project.html +251 -9
- package/dist/docs/classes/Raster.html +770 -242
- package/dist/docs/classes/Rectangle.html +50 -8
- package/dist/docs/classes/Segment.html +79 -2
- package/dist/docs/classes/Shape.html +770 -242
- package/dist/docs/classes/Size.html +31 -3
- package/dist/docs/classes/StrokeProfileStop.html +346 -0
- package/dist/docs/classes/Style.html +67 -6
- package/dist/docs/classes/SymbolDefinition.html +28 -2
- package/dist/docs/classes/SymbolItem.html +807 -242
- package/dist/docs/classes/TextItem.html +771 -243
- package/dist/docs/classes/TextRange.html +1 -1
- package/dist/docs/classes/TextStory.html +1 -1
- package/dist/docs/classes/Tool.html +2 -2
- package/dist/docs/classes/ToolEvent.html +1 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +2 -2
- package/dist/docs/classes/global.html +1 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/node/browser.js +15 -0
- package/dist/paper-core.js +4701 -728
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +4811 -808
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +5389 -892
- package/dist/paper.d.ts +1058 -69
- package/examples/Paperjs.org/LiveEffects.html +366 -0
- package/examples/Paperjs.org/Offsetting.html +379 -0
- package/examples/Paperjs.org/StrokeProfiles.html +706 -0
- package/examples/Scripts/Patterns.html +57 -0
- package/package.json +21 -11
|
@@ -771,6 +771,91 @@ var shape = new Shape.Ellipse({
|
|
|
771
771
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
772
772
|
|
|
773
773
|
|
|
774
|
+
<div id="effects" class="member">
|
|
775
|
+
<div class="member-link">
|
|
776
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
777
|
+
</div>
|
|
778
|
+
<div class="member-description hidden">
|
|
779
|
+
|
|
780
|
+
<div class="member-text">
|
|
781
|
+
<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,
|
|
782
|
+
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>
|
|
783
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
784
|
+
<ul>
|
|
785
|
+
<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>
|
|
786
|
+
<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>
|
|
787
|
+
</ul>
|
|
788
|
+
|
|
789
|
+
|
|
790
|
+
|
|
791
|
+
<ul class="member-list">
|
|
792
|
+
<h4>Type:</h4>
|
|
793
|
+
<li>
|
|
794
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
795
|
+
</li>
|
|
796
|
+
</ul>
|
|
797
|
+
|
|
798
|
+
|
|
799
|
+
<h4>Example:</h4>
|
|
800
|
+
|
|
801
|
+
<div class="paperscript split">
|
|
802
|
+
|
|
803
|
+
<div class="buttons">
|
|
804
|
+
<div class="button run">Run</div>
|
|
805
|
+
</div>
|
|
806
|
+
|
|
807
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
808
|
+
var path = new Path.Star({
|
|
809
|
+
center: view.center,
|
|
810
|
+
points: 5,
|
|
811
|
+
radius1: 20,
|
|
812
|
+
radius2: 40,
|
|
813
|
+
strokeColor: 'black',
|
|
814
|
+
strokeWidth: 8
|
|
815
|
+
});
|
|
816
|
+
path.effects = [
|
|
817
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
818
|
+
{ type: 'outline' }
|
|
819
|
+
];
|
|
820
|
+
</script>
|
|
821
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
822
|
+
</div>
|
|
823
|
+
|
|
824
|
+
|
|
825
|
+
</div>
|
|
826
|
+
|
|
827
|
+
</div>
|
|
828
|
+
</div>
|
|
829
|
+
|
|
830
|
+
|
|
831
|
+
<div id="previewbounds-matrix" class="member">
|
|
832
|
+
<div class="member-link">
|
|
833
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
834
|
+
</div>
|
|
835
|
+
<div class="member-description hidden">
|
|
836
|
+
|
|
837
|
+
<div class="member-text">
|
|
838
|
+
<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>
|
|
839
|
+
|
|
840
|
+
<p>Read only.</p>
|
|
841
|
+
|
|
842
|
+
|
|
843
|
+
|
|
844
|
+
<ul class="member-list">
|
|
845
|
+
<h4>Type:</h4>
|
|
846
|
+
<li>
|
|
847
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
848
|
+
</li>
|
|
849
|
+
</ul>
|
|
850
|
+
|
|
851
|
+
|
|
852
|
+
|
|
853
|
+
</div>
|
|
854
|
+
|
|
855
|
+
</div>
|
|
856
|
+
</div>
|
|
857
|
+
|
|
858
|
+
|
|
774
859
|
<div id="key" class="member">
|
|
775
860
|
<div class="member-link">
|
|
776
861
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -883,7 +968,7 @@ var shape = new Shape.Ellipse({
|
|
|
883
968
|
<div class="button run">Run</div>
|
|
884
969
|
</div>
|
|
885
970
|
|
|
886
|
-
<script type="text/paperscript" canvas="canvas-
|
|
971
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
887
972
|
var path = new Path.Circle({
|
|
888
973
|
center: [80, 50],
|
|
889
974
|
radius: 35
|
|
@@ -898,7 +983,7 @@ group.addChild(path);
|
|
|
898
983
|
// The path can be accessed by name:
|
|
899
984
|
group.children['example'].fillColor = 'red';
|
|
900
985
|
</script>
|
|
901
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
986
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
902
987
|
</div>
|
|
903
988
|
|
|
904
989
|
|
|
@@ -936,7 +1021,7 @@ group.children['example'].fillColor = 'red';
|
|
|
936
1021
|
<div class="button run">Run</div>
|
|
937
1022
|
</div>
|
|
938
1023
|
|
|
939
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1024
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
940
1025
|
var circle = new Path.Circle({
|
|
941
1026
|
center: [80, 50],
|
|
942
1027
|
radius: 30
|
|
@@ -947,7 +1032,7 @@ circle.style = {
|
|
|
947
1032
|
strokeWidth: 5
|
|
948
1033
|
};
|
|
949
1034
|
</script>
|
|
950
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1035
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
951
1036
|
</div>
|
|
952
1037
|
|
|
953
1038
|
|
|
@@ -959,7 +1044,7 @@ circle.style = {
|
|
|
959
1044
|
<div class="button run">Run</div>
|
|
960
1045
|
</div>
|
|
961
1046
|
|
|
962
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1047
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
963
1048
|
var path = new Path.Circle({
|
|
964
1049
|
center: [50, 50],
|
|
965
1050
|
radius: 30,
|
|
@@ -974,7 +1059,7 @@ var path2 = new Path.Circle({
|
|
|
974
1059
|
// Copy the path style of path:
|
|
975
1060
|
path2.style = path.style;
|
|
976
1061
|
</script>
|
|
977
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1062
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
978
1063
|
</div>
|
|
979
1064
|
|
|
980
1065
|
|
|
@@ -986,7 +1071,7 @@ path2.style = path.style;
|
|
|
986
1071
|
<div class="button run">Run</div>
|
|
987
1072
|
</div>
|
|
988
1073
|
|
|
989
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1074
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
990
1075
|
var myStyle = {
|
|
991
1076
|
fillColor: 'red',
|
|
992
1077
|
strokeColor: 'blue',
|
|
@@ -1005,7 +1090,7 @@ var path2 = new Path.Circle({
|
|
|
1005
1090
|
});
|
|
1006
1091
|
path2.style = myStyle;
|
|
1007
1092
|
</script>
|
|
1008
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1093
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
1009
1094
|
</div>
|
|
1010
1095
|
|
|
1011
1096
|
|
|
@@ -1047,7 +1132,7 @@ path2.style = myStyle;
|
|
|
1047
1132
|
<div class="button run">Run</div>
|
|
1048
1133
|
</div>
|
|
1049
1134
|
|
|
1050
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1135
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1051
1136
|
var unlockedItem = new Path.Circle({
|
|
1052
1137
|
center: view.center - [35, 0],
|
|
1053
1138
|
radius: 30,
|
|
@@ -1074,7 +1159,7 @@ new PointText({
|
|
|
1074
1159
|
justification: 'center'
|
|
1075
1160
|
});
|
|
1076
1161
|
</script>
|
|
1077
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1162
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
|
|
1078
1163
|
</div>
|
|
1079
1164
|
|
|
1080
1165
|
|
|
@@ -1116,7 +1201,7 @@ new PointText({
|
|
|
1116
1201
|
<div class="button run">Run</div>
|
|
1117
1202
|
</div>
|
|
1118
1203
|
|
|
1119
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1204
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1120
1205
|
var path = new Path.Circle({
|
|
1121
1206
|
center: [50, 50],
|
|
1122
1207
|
radius: 20,
|
|
@@ -1126,7 +1211,7 @@ var path = new Path.Circle({
|
|
|
1126
1211
|
// Hide the path:
|
|
1127
1212
|
path.visible = false;
|
|
1128
1213
|
</script>
|
|
1129
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1214
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
|
|
1130
1215
|
</div>
|
|
1131
1216
|
|
|
1132
1217
|
|
|
@@ -1174,7 +1259,7 @@ path.visible = false;
|
|
|
1174
1259
|
<div class="button run">Run</div>
|
|
1175
1260
|
</div>
|
|
1176
1261
|
|
|
1177
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1262
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
1178
1263
|
// Create a white rectangle in the background
|
|
1179
1264
|
// with the same dimensions as the view:
|
|
1180
1265
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -1195,7 +1280,7 @@ var circle2 = new Path.Circle({
|
|
|
1195
1280
|
// Set the blend mode of circle2:
|
|
1196
1281
|
circle2.blendMode = 'multiply';
|
|
1197
1282
|
</script>
|
|
1198
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1283
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
1199
1284
|
</div>
|
|
1200
1285
|
|
|
1201
1286
|
|
|
@@ -1237,7 +1322,7 @@ circle2.blendMode = 'multiply';
|
|
|
1237
1322
|
<div class="button run">Run</div>
|
|
1238
1323
|
</div>
|
|
1239
1324
|
|
|
1240
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1325
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
1241
1326
|
var circle = new Path.Circle({
|
|
1242
1327
|
center: [80, 50],
|
|
1243
1328
|
radius: 35,
|
|
@@ -1255,7 +1340,7 @@ var circle2 = new Path.Circle({
|
|
|
1255
1340
|
// Make circle2 50% transparent:
|
|
1256
1341
|
circle2.opacity = 0.5;
|
|
1257
1342
|
</script>
|
|
1258
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1343
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
1259
1344
|
</div>
|
|
1260
1345
|
|
|
1261
1346
|
|
|
@@ -1378,14 +1463,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
1378
1463
|
<div class="button run">Run</div>
|
|
1379
1464
|
</div>
|
|
1380
1465
|
|
|
1381
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1466
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
1382
1467
|
var path = new Path.Circle({
|
|
1383
1468
|
center: [80, 50],
|
|
1384
1469
|
radius: 35
|
|
1385
1470
|
});
|
|
1386
1471
|
path.selected = true; // Select the path
|
|
1387
1472
|
</script>
|
|
1388
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1473
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
1389
1474
|
</div>
|
|
1390
1475
|
|
|
1391
1476
|
|
|
@@ -1542,7 +1627,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
1542
1627
|
<div class="button run">Run</div>
|
|
1543
1628
|
</div>
|
|
1544
1629
|
|
|
1545
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1630
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
1546
1631
|
// Create a circle at position { x: 10, y: 10 }
|
|
1547
1632
|
var circle = new Path.Circle({
|
|
1548
1633
|
center: new Point(10, 10),
|
|
@@ -1556,7 +1641,7 @@ circle.position = new Point(20, 20);
|
|
|
1556
1641
|
// Move the circle 100 points to the right and 50 points down
|
|
1557
1642
|
circle.position += new Point(100, 50);
|
|
1558
1643
|
</script>
|
|
1559
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1644
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
1560
1645
|
</div>
|
|
1561
1646
|
|
|
1562
1647
|
|
|
@@ -1568,7 +1653,7 @@ circle.position += new Point(100, 50);
|
|
|
1568
1653
|
<div class="button run">Run</div>
|
|
1569
1654
|
</div>
|
|
1570
1655
|
|
|
1571
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1656
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
1572
1657
|
// Create a circle at position { x: 20, y: 20 }
|
|
1573
1658
|
var circle = new Path.Circle({
|
|
1574
1659
|
center: new Point(20, 20),
|
|
@@ -1579,7 +1664,7 @@ var circle = new Path.Circle({
|
|
|
1579
1664
|
// Move the circle 100 points to the right
|
|
1580
1665
|
circle.position.x += 100;
|
|
1581
1666
|
</script>
|
|
1582
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1667
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
1583
1668
|
</div>
|
|
1584
1669
|
|
|
1585
1670
|
|
|
@@ -2105,7 +2190,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
2105
2190
|
<div class="button run">Run</div>
|
|
2106
2191
|
</div>
|
|
2107
2192
|
|
|
2108
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2193
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2109
2194
|
var path = new Path.Circle({
|
|
2110
2195
|
center: [80, 50],
|
|
2111
2196
|
radius: 35
|
|
@@ -2118,7 +2203,7 @@ group.addChild(path);
|
|
|
2118
2203
|
// Access the path through the group's children array:
|
|
2119
2204
|
group.children[0].fillColor = 'red';
|
|
2120
2205
|
</script>
|
|
2121
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2206
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2122
2207
|
</div>
|
|
2123
2208
|
|
|
2124
2209
|
|
|
@@ -2130,7 +2215,7 @@ group.children[0].fillColor = 'red';
|
|
|
2130
2215
|
<div class="button run">Run</div>
|
|
2131
2216
|
</div>
|
|
2132
2217
|
|
|
2133
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2218
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2134
2219
|
var path = new Path.Circle({
|
|
2135
2220
|
center: [80, 50],
|
|
2136
2221
|
radius: 35
|
|
@@ -2145,7 +2230,7 @@ group.addChild(path);
|
|
|
2145
2230
|
// The path can be accessed by name:
|
|
2146
2231
|
group.children['example'].fillColor = 'orange';
|
|
2147
2232
|
</script>
|
|
2148
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2233
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
2149
2234
|
</div>
|
|
2150
2235
|
|
|
2151
2236
|
|
|
@@ -2157,7 +2242,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
2157
2242
|
<div class="button run">Run</div>
|
|
2158
2243
|
</div>
|
|
2159
2244
|
|
|
2160
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2245
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2161
2246
|
var path = new Path.Circle({
|
|
2162
2247
|
center: [80, 50],
|
|
2163
2248
|
radius: 35
|
|
@@ -2169,7 +2254,7 @@ group.children = [path];
|
|
|
2169
2254
|
// The path is the first child of the group:
|
|
2170
2255
|
group.firstChild.fillColor = 'green';
|
|
2171
2256
|
</script>
|
|
2172
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2257
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2173
2258
|
</div>
|
|
2174
2259
|
|
|
2175
2260
|
|
|
@@ -2346,7 +2431,7 @@ group.firstChild.fillColor = 'green';
|
|
|
2346
2431
|
<div class="button run">Run</div>
|
|
2347
2432
|
</div>
|
|
2348
2433
|
|
|
2349
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2434
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2350
2435
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2351
2436
|
// with a radius of 35:
|
|
2352
2437
|
var circle = new Path.Circle({
|
|
@@ -2357,7 +2442,7 @@ var circle = new Path.Circle({
|
|
|
2357
2442
|
// Set its stroke color to RGB red:
|
|
2358
2443
|
circle.strokeColor = new Color(1, 0, 0);
|
|
2359
2444
|
</script>
|
|
2360
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2445
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2361
2446
|
</div>
|
|
2362
2447
|
|
|
2363
2448
|
|
|
@@ -2394,7 +2479,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
2394
2479
|
<div class="button run">Run</div>
|
|
2395
2480
|
</div>
|
|
2396
2481
|
|
|
2397
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2482
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2398
2483
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2399
2484
|
// with a radius of 35:
|
|
2400
2485
|
var circle = new Path.Circle({
|
|
@@ -2406,7 +2491,7 @@ var circle = new Path.Circle({
|
|
|
2406
2491
|
// Set its stroke width to 10:
|
|
2407
2492
|
circle.strokeWidth = 10;
|
|
2408
2493
|
</script>
|
|
2409
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2494
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2410
2495
|
</div>
|
|
2411
2496
|
|
|
2412
2497
|
|
|
@@ -2453,7 +2538,7 @@ circle.strokeWidth = 10;
|
|
|
2453
2538
|
<div class="button run">Run</div>
|
|
2454
2539
|
</div>
|
|
2455
2540
|
|
|
2456
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2541
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2457
2542
|
var line = new Path({
|
|
2458
2543
|
segments: [[80, 50], [420, 50]],
|
|
2459
2544
|
strokeColor: 'black',
|
|
@@ -2474,7 +2559,7 @@ var line2 = line.clone();
|
|
|
2474
2559
|
line2.position.y += 100;
|
|
2475
2560
|
line2.strokeCap = 'butt';
|
|
2476
2561
|
</script>
|
|
2477
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
2562
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-30"></canvas></div>
|
|
2478
2563
|
</div>
|
|
2479
2564
|
|
|
2480
2565
|
|
|
@@ -2521,7 +2606,7 @@ line2.strokeCap = 'butt';
|
|
|
2521
2606
|
<div class="button run">Run</div>
|
|
2522
2607
|
</div>
|
|
2523
2608
|
|
|
2524
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2609
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2525
2610
|
var path = new Path({
|
|
2526
2611
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
2527
2612
|
strokeColor: 'black',
|
|
@@ -2538,7 +2623,7 @@ var path3 = path2.clone();
|
|
|
2538
2623
|
path3.position.x += path3.bounds.width * 1.5;
|
|
2539
2624
|
path3.strokeJoin = 'bevel';
|
|
2540
2625
|
</script>
|
|
2541
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
2626
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-31"></canvas></div>
|
|
2542
2627
|
</div>
|
|
2543
2628
|
|
|
2544
2629
|
|
|
@@ -2642,7 +2727,7 @@ path3.strokeJoin = 'bevel';
|
|
|
2642
2727
|
<div class="button run">Run</div>
|
|
2643
2728
|
</div>
|
|
2644
2729
|
|
|
2645
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2730
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2646
2731
|
var path = new Path.Circle({
|
|
2647
2732
|
center: [80, 50],
|
|
2648
2733
|
radius: 40,
|
|
@@ -2653,7 +2738,7 @@ var path = new Path.Circle({
|
|
|
2653
2738
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
2654
2739
|
path.dashArray = [10, 4];
|
|
2655
2740
|
</script>
|
|
2656
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2741
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2657
2742
|
</div>
|
|
2658
2743
|
|
|
2659
2744
|
|
|
@@ -2688,6 +2773,42 @@ path.dashArray = [10, 4];
|
|
|
2688
2773
|
|
|
2689
2774
|
|
|
2690
2775
|
|
|
2776
|
+
</div>
|
|
2777
|
+
|
|
2778
|
+
</div>
|
|
2779
|
+
</div>
|
|
2780
|
+
|
|
2781
|
+
|
|
2782
|
+
<div id="paintorder" class="member">
|
|
2783
|
+
<div class="member-link">
|
|
2784
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
2785
|
+
</div>
|
|
2786
|
+
<div class="member-description hidden">
|
|
2787
|
+
|
|
2788
|
+
<div class="member-text">
|
|
2789
|
+
<p>The order in which the fill and the stroke are painted, as in SVG’s <code>paint-order</code>, named after what is painted first: <code>'fill'</code> paints the fill first, <code>'stroke'</code> paints the stroke first, so the fill covers its inner half.</p>
|
|
2790
|
+
|
|
2791
|
+
|
|
2792
|
+
<ul class="member-list">
|
|
2793
|
+
<h4>Values:</h4>
|
|
2794
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
2795
|
+
</ul>
|
|
2796
|
+
|
|
2797
|
+
|
|
2798
|
+
<ul class="member-list">
|
|
2799
|
+
<h4>Default:</h4>
|
|
2800
|
+
<li><tt>'fill'</tt></li>
|
|
2801
|
+
</ul>
|
|
2802
|
+
|
|
2803
|
+
<ul class="member-list">
|
|
2804
|
+
<h4>Type:</h4>
|
|
2805
|
+
<li>
|
|
2806
|
+
<tt>String</tt>
|
|
2807
|
+
</li>
|
|
2808
|
+
</ul>
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
|
|
2691
2812
|
</div>
|
|
2692
2813
|
|
|
2693
2814
|
</div>
|
|
@@ -2723,7 +2844,7 @@ path.dashArray = [10, 4];
|
|
|
2723
2844
|
<div class="button run">Run</div>
|
|
2724
2845
|
</div>
|
|
2725
2846
|
|
|
2726
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2847
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2727
2848
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2728
2849
|
// with a radius of 35:
|
|
2729
2850
|
var circle = new Path.Circle({
|
|
@@ -2734,7 +2855,7 @@ var circle = new Path.Circle({
|
|
|
2734
2855
|
// Set the fill color of the circle to RGB red:
|
|
2735
2856
|
circle.fillColor = new Color(1, 0, 0);
|
|
2736
2857
|
</script>
|
|
2737
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2858
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2738
2859
|
</div>
|
|
2739
2860
|
|
|
2740
2861
|
|
|
@@ -2809,7 +2930,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2809
2930
|
<div class="button run">Run</div>
|
|
2810
2931
|
</div>
|
|
2811
2932
|
|
|
2812
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2933
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
2813
2934
|
var circle = new Path.Circle({
|
|
2814
2935
|
center: [80, 50],
|
|
2815
2936
|
radius: 35,
|
|
@@ -2822,7 +2943,7 @@ var circle = new Path.Circle({
|
|
|
2822
2943
|
shadowOffset: new Point(5, 5)
|
|
2823
2944
|
});
|
|
2824
2945
|
</script>
|
|
2825
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2946
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2826
2947
|
</div>
|
|
2827
2948
|
|
|
2828
2949
|
|
|
@@ -2963,7 +3084,7 @@ var circle = new Path.Circle({
|
|
|
2963
3084
|
<div class="button run">Run</div>
|
|
2964
3085
|
</div>
|
|
2965
3086
|
|
|
2966
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3087
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
2967
3088
|
// Create a rectangle shaped path with its top left point at:
|
|
2968
3089
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2969
3090
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2974,7 +3095,7 @@ path.onFrame = function(event) {
|
|
|
2974
3095
|
this.rotate(3);
|
|
2975
3096
|
}
|
|
2976
3097
|
</script>
|
|
2977
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3098
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
2978
3099
|
</div>
|
|
2979
3100
|
|
|
2980
3101
|
|
|
@@ -3018,7 +3139,7 @@ path.onFrame = function(event) {
|
|
|
3018
3139
|
<div class="button run">Run</div>
|
|
3019
3140
|
</div>
|
|
3020
3141
|
|
|
3021
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3142
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3022
3143
|
// Create a circle shaped path at the center of the view:
|
|
3023
3144
|
var path = new Path.Circle({
|
|
3024
3145
|
center: view.center,
|
|
@@ -3032,7 +3153,7 @@ path.onMouseDown = function(event) {
|
|
|
3032
3153
|
this.fillColor = 'red';
|
|
3033
3154
|
}
|
|
3034
3155
|
</script>
|
|
3035
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3156
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3036
3157
|
</div>
|
|
3037
3158
|
|
|
3038
3159
|
|
|
@@ -3044,7 +3165,7 @@ path.onMouseDown = function(event) {
|
|
|
3044
3165
|
<div class="button run">Run</div>
|
|
3045
3166
|
</div>
|
|
3046
3167
|
|
|
3047
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3168
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3048
3169
|
// Loop 30 times:
|
|
3049
3170
|
for (var i = 0; i < 30; i++) {
|
|
3050
3171
|
// Create a circle shaped path at a random position
|
|
@@ -3062,7 +3183,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3062
3183
|
}
|
|
3063
3184
|
}
|
|
3064
3185
|
</script>
|
|
3065
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3186
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3066
3187
|
</div>
|
|
3067
3188
|
|
|
3068
3189
|
|
|
@@ -3106,7 +3227,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3106
3227
|
<div class="button run">Run</div>
|
|
3107
3228
|
</div>
|
|
3108
3229
|
|
|
3109
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3230
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3110
3231
|
// Create a circle shaped path at the center of the view:
|
|
3111
3232
|
var path = new Path.Circle({
|
|
3112
3233
|
center: view.center,
|
|
@@ -3119,7 +3240,7 @@ path.onMouseDrag = function(event) {
|
|
|
3119
3240
|
path.position += event.delta;
|
|
3120
3241
|
}
|
|
3121
3242
|
</script>
|
|
3122
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
3243
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-38"></canvas></div>
|
|
3123
3244
|
</div>
|
|
3124
3245
|
|
|
3125
3246
|
|
|
@@ -3163,7 +3284,7 @@ path.onMouseDrag = function(event) {
|
|
|
3163
3284
|
<div class="button run">Run</div>
|
|
3164
3285
|
</div>
|
|
3165
3286
|
|
|
3166
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3287
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3167
3288
|
// Create a circle shaped path at the center of the view:
|
|
3168
3289
|
var path = new Path.Circle({
|
|
3169
3290
|
center: view.center,
|
|
@@ -3177,7 +3298,7 @@ path.onMouseUp = function(event) {
|
|
|
3177
3298
|
this.fillColor = 'red';
|
|
3178
3299
|
}
|
|
3179
3300
|
</script>
|
|
3180
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3301
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3181
3302
|
</div>
|
|
3182
3303
|
|
|
3183
3304
|
|
|
@@ -3221,7 +3342,7 @@ path.onMouseUp = function(event) {
|
|
|
3221
3342
|
<div class="button run">Run</div>
|
|
3222
3343
|
</div>
|
|
3223
3344
|
|
|
3224
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3345
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3225
3346
|
// Create a circle shaped path at the center of the view:
|
|
3226
3347
|
var path = new Path.Circle({
|
|
3227
3348
|
center: view.center,
|
|
@@ -3235,7 +3356,7 @@ path.onClick = function(event) {
|
|
|
3235
3356
|
this.fillColor = 'red';
|
|
3236
3357
|
}
|
|
3237
3358
|
</script>
|
|
3238
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3359
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3239
3360
|
</div>
|
|
3240
3361
|
|
|
3241
3362
|
|
|
@@ -3247,7 +3368,7 @@ path.onClick = function(event) {
|
|
|
3247
3368
|
<div class="button run">Run</div>
|
|
3248
3369
|
</div>
|
|
3249
3370
|
|
|
3250
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3371
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3251
3372
|
// Loop 30 times:
|
|
3252
3373
|
for (var i = 0; i < 30; i++) {
|
|
3253
3374
|
// Create a circle shaped path at a random position
|
|
@@ -3265,7 +3386,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3265
3386
|
}
|
|
3266
3387
|
}
|
|
3267
3388
|
</script>
|
|
3268
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3389
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3269
3390
|
</div>
|
|
3270
3391
|
|
|
3271
3392
|
|
|
@@ -3309,7 +3430,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3309
3430
|
<div class="button run">Run</div>
|
|
3310
3431
|
</div>
|
|
3311
3432
|
|
|
3312
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3433
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
3313
3434
|
// Create a circle shaped path at the center of the view:
|
|
3314
3435
|
var path = new Path.Circle({
|
|
3315
3436
|
center: view.center,
|
|
@@ -3323,7 +3444,7 @@ path.onDoubleClick = function(event) {
|
|
|
3323
3444
|
this.fillColor = 'red';
|
|
3324
3445
|
}
|
|
3325
3446
|
</script>
|
|
3326
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3447
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
3327
3448
|
</div>
|
|
3328
3449
|
|
|
3329
3450
|
|
|
@@ -3335,7 +3456,7 @@ path.onDoubleClick = function(event) {
|
|
|
3335
3456
|
<div class="button run">Run</div>
|
|
3336
3457
|
</div>
|
|
3337
3458
|
|
|
3338
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3459
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
3339
3460
|
// Loop 30 times:
|
|
3340
3461
|
for (var i = 0; i < 30; i++) {
|
|
3341
3462
|
// Create a circle shaped path at a random position
|
|
@@ -3353,7 +3474,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3353
3474
|
}
|
|
3354
3475
|
}
|
|
3355
3476
|
</script>
|
|
3356
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3477
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
3357
3478
|
</div>
|
|
3358
3479
|
|
|
3359
3480
|
|
|
@@ -3397,7 +3518,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3397
3518
|
<div class="button run">Run</div>
|
|
3398
3519
|
</div>
|
|
3399
3520
|
|
|
3400
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3521
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
3401
3522
|
// Create a circle shaped path at the center of the view:
|
|
3402
3523
|
var path = new Path.Circle({
|
|
3403
3524
|
center: view.center,
|
|
@@ -3405,180 +3526,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
3405
3526
|
fillColor: 'black'
|
|
3406
3527
|
});
|
|
3407
3528
|
|
|
3408
|
-
// When the mouse moves on top of the item, set its opacity
|
|
3409
|
-
// to a random value between 0 and 1:
|
|
3410
|
-
path.onMouseMove = function(event) {
|
|
3411
|
-
this.opacity = Math.random();
|
|
3412
|
-
}
|
|
3413
|
-
</script>
|
|
3414
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3415
|
-
</div>
|
|
3529
|
+
// When the mouse moves on top of the item, set its opacity
|
|
3530
|
+
// to a random value between 0 and 1:
|
|
3531
|
+
path.onMouseMove = function(event) {
|
|
3532
|
+
this.opacity = Math.random();
|
|
3533
|
+
}
|
|
3534
|
+
</script>
|
|
3535
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
3536
|
+
</div>
|
|
3537
|
+
|
|
3538
|
+
|
|
3539
|
+
</div>
|
|
3540
|
+
|
|
3541
|
+
</div>
|
|
3542
|
+
</div>
|
|
3543
|
+
|
|
3544
|
+
|
|
3545
|
+
<div id="onmouseenter" class="member">
|
|
3546
|
+
<div class="member-link">
|
|
3547
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
3548
|
+
</div>
|
|
3549
|
+
<div class="member-description hidden">
|
|
3550
|
+
|
|
3551
|
+
<div class="member-text">
|
|
3552
|
+
<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>
|
|
3553
|
+
|
|
3554
|
+
|
|
3555
|
+
|
|
3556
|
+
<ul class="member-list">
|
|
3557
|
+
<h4>Type:</h4>
|
|
3558
|
+
<li>
|
|
3559
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3560
|
+
</li>
|
|
3561
|
+
</ul>
|
|
3562
|
+
|
|
3563
|
+
|
|
3564
|
+
<ul class="member-list">
|
|
3565
|
+
<h4>See also:</h4>
|
|
3566
|
+
|
|
3567
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
3568
|
+
|
|
3569
|
+
</ul>
|
|
3570
|
+
|
|
3571
|
+
<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>
|
|
3572
|
+
|
|
3573
|
+
<div class="paperscript split">
|
|
3574
|
+
|
|
3575
|
+
<div class="buttons">
|
|
3576
|
+
<div class="button run">Run</div>
|
|
3577
|
+
</div>
|
|
3578
|
+
|
|
3579
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
3580
|
+
// Create a circle shaped path at the center of the view:
|
|
3581
|
+
var path = new Path.Circle({
|
|
3582
|
+
center: view.center,
|
|
3583
|
+
radius: 25,
|
|
3584
|
+
fillColor: 'black'
|
|
3585
|
+
});
|
|
3586
|
+
|
|
3587
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3588
|
+
path.onMouseEnter = function(event) {
|
|
3589
|
+
this.fillColor = 'red';
|
|
3590
|
+
}
|
|
3591
|
+
|
|
3592
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3593
|
+
path.onMouseLeave = function(event) {
|
|
3594
|
+
this.fillColor = 'black';
|
|
3595
|
+
}
|
|
3596
|
+
</script>
|
|
3597
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
3598
|
+
</div>
|
|
3599
|
+
|
|
3600
|
+
|
|
3601
|
+
<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>
|
|
3602
|
+
|
|
3603
|
+
<div class="paperscript split">
|
|
3604
|
+
|
|
3605
|
+
<div class="buttons">
|
|
3606
|
+
<div class="button run">Run</div>
|
|
3607
|
+
</div>
|
|
3608
|
+
|
|
3609
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
3610
|
+
function enter(event) {
|
|
3611
|
+
this.fillColor = 'red';
|
|
3612
|
+
}
|
|
3613
|
+
|
|
3614
|
+
function leave(event) {
|
|
3615
|
+
this.fillColor = 'black';
|
|
3616
|
+
}
|
|
3617
|
+
|
|
3618
|
+
// When the mouse is pressed:
|
|
3619
|
+
function onMouseDown(event) {
|
|
3620
|
+
// Create a circle shaped path at the position of the mouse:
|
|
3621
|
+
var path = new Path.Circle(event.point, 25);
|
|
3622
|
+
path.fillColor = 'black';
|
|
3623
|
+
|
|
3624
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3625
|
+
path.onMouseEnter = enter;
|
|
3626
|
+
|
|
3627
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3628
|
+
path.onMouseLeave = leave;
|
|
3629
|
+
}
|
|
3630
|
+
</script>
|
|
3631
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
3632
|
+
</div>
|
|
3633
|
+
|
|
3634
|
+
|
|
3635
|
+
</div>
|
|
3636
|
+
|
|
3637
|
+
</div>
|
|
3638
|
+
</div>
|
|
3639
|
+
|
|
3640
|
+
|
|
3641
|
+
<div id="onmouseleave" class="member">
|
|
3642
|
+
<div class="member-link">
|
|
3643
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
3644
|
+
</div>
|
|
3645
|
+
<div class="member-description hidden">
|
|
3646
|
+
|
|
3647
|
+
<div class="member-text">
|
|
3648
|
+
<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>
|
|
3649
|
+
|
|
3650
|
+
|
|
3651
|
+
|
|
3652
|
+
<ul class="member-list">
|
|
3653
|
+
<h4>Type:</h4>
|
|
3654
|
+
<li>
|
|
3655
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3656
|
+
</li>
|
|
3657
|
+
</ul>
|
|
3658
|
+
|
|
3659
|
+
|
|
3660
|
+
<ul class="member-list">
|
|
3661
|
+
<h4>See also:</h4>
|
|
3662
|
+
|
|
3663
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
3664
|
+
|
|
3665
|
+
</ul>
|
|
3666
|
+
|
|
3667
|
+
<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>
|
|
3668
|
+
|
|
3669
|
+
<div class="paperscript split">
|
|
3670
|
+
|
|
3671
|
+
<div class="buttons">
|
|
3672
|
+
<div class="button run">Run</div>
|
|
3673
|
+
</div>
|
|
3674
|
+
|
|
3675
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
3676
|
+
// Create a circle shaped path at the center of the view:
|
|
3677
|
+
var path = new Path.Circle({
|
|
3678
|
+
center: view.center,
|
|
3679
|
+
radius: 25,
|
|
3680
|
+
fillColor: 'black'
|
|
3681
|
+
});
|
|
3682
|
+
|
|
3683
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
3684
|
+
path.onMouseLeave = function(event) {
|
|
3685
|
+
this.fillColor = 'red';
|
|
3686
|
+
}
|
|
3687
|
+
</script>
|
|
3688
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
3689
|
+
</div>
|
|
3690
|
+
|
|
3691
|
+
|
|
3692
|
+
</div>
|
|
3693
|
+
|
|
3694
|
+
</div>
|
|
3695
|
+
</div>
|
|
3696
|
+
|
|
3697
|
+
|
|
3698
|
+
<div id="ondraw" class="member">
|
|
3699
|
+
<div class="member-link">
|
|
3700
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
3701
|
+
</div>
|
|
3702
|
+
<div class="member-description hidden">
|
|
3703
|
+
|
|
3704
|
+
<div class="member-text">
|
|
3705
|
+
<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>
|
|
3706
|
+
|
|
3707
|
+
|
|
3708
|
+
|
|
3709
|
+
<ul class="member-list">
|
|
3710
|
+
<h4>Type:</h4>
|
|
3711
|
+
<li>
|
|
3712
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3713
|
+
</li>
|
|
3714
|
+
</ul>
|
|
3715
|
+
<ul class="member-list">
|
|
3716
|
+
<h4>Options:</h4>
|
|
3717
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
3718
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
3719
|
+
<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>
|
|
3720
|
+
<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>
|
|
3721
|
+
<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>()
|
|
3722
|
+
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>
|
|
3723
|
+
</ul>
|
|
3724
|
+
|
|
3725
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
3726
|
+
|
|
3727
|
+
<div class="paperscript split">
|
|
3728
|
+
|
|
3729
|
+
<div class="buttons">
|
|
3730
|
+
<div class="button run">Run</div>
|
|
3731
|
+
</div>
|
|
3732
|
+
|
|
3733
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
3734
|
+
var path = new Path.Circle({
|
|
3735
|
+
center: view.center,
|
|
3736
|
+
radius: 25,
|
|
3737
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3738
|
+
});
|
|
3739
|
+
|
|
3740
|
+
path.onDraw = function(event) {
|
|
3741
|
+
var ctx = event.context,
|
|
3742
|
+
center = this.position,
|
|
3743
|
+
scale = event.matrix.scaling.x;
|
|
3744
|
+
ctx.beginPath();
|
|
3745
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3746
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3747
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3748
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3749
|
+
ctx.lineWidth = 1 / scale;
|
|
3750
|
+
ctx.stroke();
|
|
3751
|
+
}
|
|
3752
|
+
</script>
|
|
3753
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
3754
|
+
</div>
|
|
3755
|
+
|
|
3756
|
+
|
|
3757
|
+
</div>
|
|
3758
|
+
|
|
3759
|
+
</div>
|
|
3760
|
+
</div>
|
|
3761
|
+
|
|
3762
|
+
|
|
3763
|
+
<div id="ondrawselection" class="member">
|
|
3764
|
+
<div class="member-link">
|
|
3765
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3766
|
+
</div>
|
|
3767
|
+
<div class="member-description hidden">
|
|
3768
|
+
|
|
3769
|
+
<div class="member-text">
|
|
3770
|
+
<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>
|
|
3771
|
+
|
|
3772
|
+
|
|
3773
|
+
|
|
3774
|
+
<ul class="member-list">
|
|
3775
|
+
<h4>Type:</h4>
|
|
3776
|
+
<li>
|
|
3777
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3778
|
+
</li>
|
|
3779
|
+
</ul>
|
|
3780
|
+
<ul class="member-list">
|
|
3781
|
+
<h4>Options:</h4>
|
|
3782
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3783
|
+
<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>
|
|
3784
|
+
<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>
|
|
3785
|
+
<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>
|
|
3786
|
+
<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>
|
|
3787
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3788
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3789
|
+
</ul>
|
|
3790
|
+
|
|
3791
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3792
|
+
|
|
3793
|
+
<div class="paperscript split">
|
|
3794
|
+
|
|
3795
|
+
<div class="buttons">
|
|
3796
|
+
<div class="button run">Run</div>
|
|
3797
|
+
</div>
|
|
3798
|
+
|
|
3799
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
3800
|
+
var path = new Path.Star({
|
|
3801
|
+
center: view.center,
|
|
3802
|
+
points: 5,
|
|
3803
|
+
radius1: 20,
|
|
3804
|
+
radius2: 40,
|
|
3805
|
+
strokeColor: 'black',
|
|
3806
|
+
selected: true
|
|
3807
|
+
});
|
|
3808
|
+
|
|
3809
|
+
path.onDrawSelection = function(event) {
|
|
3810
|
+
var ctx = event.context;
|
|
3811
|
+
this.segments.forEach(function(segment) {
|
|
3812
|
+
var point = event.matrix.transform(segment.point);
|
|
3813
|
+
ctx.beginPath();
|
|
3814
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3815
|
+
ctx.fill();
|
|
3816
|
+
});
|
|
3817
|
+
return false;
|
|
3818
|
+
}
|
|
3819
|
+
</script>
|
|
3820
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
3821
|
+
</div>
|
|
3822
|
+
|
|
3823
|
+
|
|
3824
|
+
</div>
|
|
3825
|
+
|
|
3826
|
+
</div>
|
|
3827
|
+
</div>
|
|
3828
|
+
|
|
3829
|
+
</div>
|
|
3830
|
+
|
|
3831
|
+
|
|
3832
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3833
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3834
|
+
|
|
3835
|
+
|
|
3836
|
+
<div id="addeffect-effect" class="member">
|
|
3837
|
+
<div class="member-link">
|
|
3838
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3839
|
+
</div>
|
|
3840
|
+
<div class="member-description hidden">
|
|
3841
|
+
<div class="member-text">
|
|
3842
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3843
|
+
|
|
3844
|
+
|
|
3845
|
+
<ul class="member-list">
|
|
3846
|
+
<h4>Parameters:</h4>
|
|
3847
|
+
|
|
3848
|
+
<li>
|
|
3849
|
+
<tt>effect:</tt>
|
|
3850
|
+
<tt>Object</tt>
|
|
3851
|
+
— the plain object describing the effect
|
|
3852
|
+
|
|
3853
|
+
</li>
|
|
3854
|
+
|
|
3855
|
+
</ul>
|
|
3856
|
+
|
|
3857
|
+
|
|
3858
|
+
<ul class="member-list">
|
|
3859
|
+
<h4>Returns:</h4>
|
|
3860
|
+
|
|
3861
|
+
<li>
|
|
3862
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3863
|
+
</li>
|
|
3864
|
+
|
|
3865
|
+
|
|
3866
|
+
</ul>
|
|
3867
|
+
|
|
3868
|
+
|
|
3869
|
+
|
|
3870
|
+
|
|
3871
|
+
|
|
3872
|
+
</div>
|
|
3873
|
+
</div>
|
|
3874
|
+
</div>
|
|
3875
|
+
|
|
3876
|
+
|
|
3877
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3878
|
+
<div class="member-link">
|
|
3879
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3880
|
+
</div>
|
|
3881
|
+
<div class="member-description hidden">
|
|
3882
|
+
<div class="member-text">
|
|
3883
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3884
|
+
|
|
3885
|
+
|
|
3886
|
+
<ul class="member-list">
|
|
3887
|
+
<h4>Parameters:</h4>
|
|
3888
|
+
|
|
3889
|
+
<li>
|
|
3890
|
+
<tt>index:</tt>
|
|
3891
|
+
<tt>Number</tt>
|
|
3892
|
+
— the index at which to insert the effect
|
|
3893
|
+
|
|
3894
|
+
</li>
|
|
3895
|
+
|
|
3896
|
+
<li>
|
|
3897
|
+
<tt>effect:</tt>
|
|
3898
|
+
<tt>Object</tt>
|
|
3899
|
+
— the plain object describing the effect
|
|
3900
|
+
|
|
3901
|
+
</li>
|
|
3902
|
+
|
|
3903
|
+
</ul>
|
|
3904
|
+
|
|
3905
|
+
|
|
3906
|
+
<ul class="member-list">
|
|
3907
|
+
<h4>Returns:</h4>
|
|
3908
|
+
|
|
3909
|
+
<li>
|
|
3910
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3911
|
+
</li>
|
|
3912
|
+
|
|
3913
|
+
|
|
3914
|
+
</ul>
|
|
3915
|
+
|
|
3916
|
+
|
|
3917
|
+
|
|
3918
|
+
|
|
3919
|
+
|
|
3920
|
+
</div>
|
|
3921
|
+
</div>
|
|
3922
|
+
</div>
|
|
3923
|
+
|
|
3924
|
+
|
|
3925
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3926
|
+
<div class="member-link">
|
|
3927
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3928
|
+
</div>
|
|
3929
|
+
<div class="member-description hidden">
|
|
3930
|
+
<div class="member-text">
|
|
3931
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3932
|
+
|
|
3933
|
+
|
|
3934
|
+
<ul class="member-list">
|
|
3935
|
+
<h4>Parameters:</h4>
|
|
3936
|
+
|
|
3937
|
+
<li>
|
|
3938
|
+
<tt>index:</tt>
|
|
3939
|
+
<tt>Number</tt>
|
|
3940
|
+
— the index at which to insert the effects
|
|
3941
|
+
|
|
3942
|
+
</li>
|
|
3943
|
+
|
|
3944
|
+
<li>
|
|
3945
|
+
<tt>effects:</tt>
|
|
3946
|
+
Array of <tt>Object</tt> objects
|
|
3947
|
+
— the plain objects describing the effects
|
|
3948
|
+
|
|
3949
|
+
</li>
|
|
3950
|
+
|
|
3951
|
+
</ul>
|
|
3952
|
+
|
|
3953
|
+
|
|
3954
|
+
<ul class="member-list">
|
|
3955
|
+
<h4>Returns:</h4>
|
|
3956
|
+
|
|
3957
|
+
<li>
|
|
3958
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3959
|
+
</li>
|
|
3960
|
+
|
|
3961
|
+
|
|
3962
|
+
</ul>
|
|
3416
3963
|
|
|
3417
3964
|
|
|
3418
|
-
</div>
|
|
3419
3965
|
|
|
3966
|
+
|
|
3967
|
+
|
|
3968
|
+
</div>
|
|
3420
3969
|
</div>
|
|
3421
3970
|
</div>
|
|
3422
3971
|
|
|
3423
3972
|
|
|
3424
|
-
<div id="
|
|
3973
|
+
<div id="removeeffect-index" class="member">
|
|
3425
3974
|
<div class="member-link">
|
|
3426
|
-
<a name="
|
|
3975
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
3427
3976
|
</div>
|
|
3428
3977
|
<div class="member-description hidden">
|
|
3429
|
-
|
|
3430
3978
|
<div class="member-text">
|
|
3431
|
-
<p>
|
|
3979
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3980
|
+
|
|
3432
3981
|
|
|
3982
|
+
<ul class="member-list">
|
|
3983
|
+
<h4>Parameters:</h4>
|
|
3433
3984
|
|
|
3985
|
+
<li>
|
|
3986
|
+
<tt>index:</tt>
|
|
3987
|
+
<tt>Number</tt>
|
|
3988
|
+
— the index of the effect to remove
|
|
3989
|
+
|
|
3990
|
+
</li>
|
|
3434
3991
|
|
|
3435
|
-
|
|
3436
|
-
|
|
3437
|
-
<li>
|
|
3438
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3439
|
-
</li>
|
|
3440
|
-
</ul>
|
|
3441
|
-
|
|
3992
|
+
</ul>
|
|
3993
|
+
|
|
3442
3994
|
|
|
3443
3995
|
<ul class="member-list">
|
|
3444
|
-
<h4>
|
|
3996
|
+
<h4>Returns:</h4>
|
|
3445
3997
|
|
|
3446
|
-
<li
|
|
3998
|
+
<li>
|
|
3999
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
4000
|
+
</li>
|
|
4001
|
+
|
|
3447
4002
|
|
|
3448
4003
|
</ul>
|
|
3449
4004
|
|
|
3450
|
-
<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>
|
|
3451
4005
|
|
|
3452
|
-
<div class="paperscript split">
|
|
3453
4006
|
|
|
3454
|
-
|
|
3455
|
-
|
|
4007
|
+
|
|
4008
|
+
|
|
3456
4009
|
</div>
|
|
3457
|
-
|
|
3458
|
-
<script type="text/paperscript" canvas="canvas-44">
|
|
3459
|
-
// Create a circle shaped path at the center of the view:
|
|
3460
|
-
var path = new Path.Circle({
|
|
3461
|
-
center: view.center,
|
|
3462
|
-
radius: 25,
|
|
3463
|
-
fillColor: 'black'
|
|
3464
|
-
});
|
|
3465
|
-
|
|
3466
|
-
// When the mouse enters the item, set its fill color to red:
|
|
3467
|
-
path.onMouseEnter = function(event) {
|
|
3468
|
-
this.fillColor = 'red';
|
|
3469
|
-
}
|
|
3470
|
-
|
|
3471
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3472
|
-
path.onMouseLeave = function(event) {
|
|
3473
|
-
this.fillColor = 'black';
|
|
3474
|
-
}
|
|
3475
|
-
</script>
|
|
3476
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
3477
4010
|
</div>
|
|
3478
|
-
|
|
3479
|
-
|
|
3480
|
-
<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>
|
|
3481
|
-
|
|
3482
|
-
<div class="paperscript split">
|
|
3483
|
-
|
|
3484
|
-
<div class="buttons">
|
|
3485
|
-
<div class="button run">Run</div>
|
|
3486
4011
|
</div>
|
|
3487
4012
|
|
|
3488
|
-
|
|
3489
|
-
|
|
3490
|
-
|
|
3491
|
-
|
|
3492
|
-
|
|
3493
|
-
|
|
3494
|
-
|
|
3495
|
-
|
|
4013
|
+
|
|
4014
|
+
<div id="removeeffects" class="member">
|
|
4015
|
+
<div class="member-link">
|
|
4016
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
4017
|
+
</div>
|
|
4018
|
+
<div class="member-description hidden">
|
|
4019
|
+
<div class="member-text">
|
|
4020
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
4021
|
+
|
|
4022
|
+
|
|
4023
|
+
<ul class="member-list">
|
|
4024
|
+
<h4>Parameters:</h4>
|
|
4025
|
+
|
|
4026
|
+
<li>
|
|
4027
|
+
<tt>start:</tt>
|
|
4028
|
+
<tt>Number</tt>
|
|
4029
|
+
— the index of the first effect to remove
|
|
4030
|
+
— optional, default: <tt>0</tt>
|
|
4031
|
+
</li>
|
|
4032
|
+
|
|
4033
|
+
<li>
|
|
4034
|
+
<tt>end:</tt>
|
|
4035
|
+
<tt>Number</tt>
|
|
4036
|
+
— the index after the last one
|
|
4037
|
+
— optional, default: <tt>effects.length</tt>
|
|
4038
|
+
</li>
|
|
4039
|
+
|
|
4040
|
+
</ul>
|
|
3496
4041
|
|
|
3497
|
-
|
|
3498
|
-
|
|
3499
|
-
|
|
3500
|
-
|
|
3501
|
-
|
|
4042
|
+
|
|
4043
|
+
<ul class="member-list">
|
|
4044
|
+
<h4>Returns:</h4>
|
|
4045
|
+
|
|
4046
|
+
<li>
|
|
4047
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
4048
|
+
</li>
|
|
3502
4049
|
|
|
3503
|
-
|
|
3504
|
-
|
|
4050
|
+
|
|
4051
|
+
</ul>
|
|
3505
4052
|
|
|
3506
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3507
|
-
path.onMouseLeave = leave;
|
|
3508
|
-
}
|
|
3509
|
-
</script>
|
|
3510
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
3511
|
-
</div>
|
|
3512
4053
|
|
|
3513
4054
|
|
|
4055
|
+
|
|
4056
|
+
|
|
3514
4057
|
</div>
|
|
3515
|
-
|
|
3516
4058
|
</div>
|
|
3517
4059
|
</div>
|
|
3518
4060
|
|
|
3519
4061
|
|
|
3520
|
-
<div id="
|
|
4062
|
+
<div id="geteffectoutput" class="member">
|
|
3521
4063
|
<div class="member-link">
|
|
3522
|
-
<a name="
|
|
4064
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
3523
4065
|
</div>
|
|
3524
4066
|
<div class="member-description hidden">
|
|
3525
|
-
|
|
3526
4067
|
<div class="member-text">
|
|
3527
|
-
<p>
|
|
3528
|
-
|
|
3529
|
-
|
|
3530
|
-
|
|
3531
|
-
<ul class="member-list">
|
|
3532
|
-
<h4>Type:</h4>
|
|
3533
|
-
<li>
|
|
3534
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3535
|
-
</li>
|
|
3536
|
-
</ul>
|
|
4068
|
+
<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>
|
|
3537
4069
|
|
|
3538
4070
|
|
|
4071
|
+
|
|
3539
4072
|
<ul class="member-list">
|
|
3540
|
-
<h4>
|
|
4073
|
+
<h4>Returns:</h4>
|
|
3541
4074
|
|
|
3542
|
-
<li
|
|
4075
|
+
<li>
|
|
4076
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
4077
|
+
</li>
|
|
4078
|
+
|
|
3543
4079
|
|
|
3544
4080
|
</ul>
|
|
3545
4081
|
|
|
3546
|
-
<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>
|
|
3547
|
-
|
|
3548
|
-
<div class="paperscript split">
|
|
3549
|
-
|
|
3550
|
-
<div class="buttons">
|
|
3551
|
-
<div class="button run">Run</div>
|
|
3552
|
-
</div>
|
|
3553
|
-
|
|
3554
|
-
<script type="text/paperscript" canvas="canvas-46">
|
|
3555
|
-
// Create a circle shaped path at the center of the view:
|
|
3556
|
-
var path = new Path.Circle({
|
|
3557
|
-
center: view.center,
|
|
3558
|
-
radius: 25,
|
|
3559
|
-
fillColor: 'black'
|
|
3560
|
-
});
|
|
3561
|
-
|
|
3562
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
3563
|
-
path.onMouseLeave = function(event) {
|
|
3564
|
-
this.fillColor = 'red';
|
|
3565
|
-
}
|
|
3566
|
-
</script>
|
|
3567
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
3568
|
-
</div>
|
|
3569
|
-
|
|
3570
4082
|
|
|
3571
|
-
</div>
|
|
3572
4083
|
|
|
4084
|
+
|
|
4085
|
+
|
|
3573
4086
|
</div>
|
|
3574
4087
|
</div>
|
|
3575
|
-
|
|
3576
4088
|
</div>
|
|
3577
4089
|
|
|
3578
|
-
|
|
3579
|
-
<!-- =========================== inherited methods ========================= -->
|
|
3580
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3581
|
-
|
|
3582
4090
|
|
|
3583
4091
|
<div id="set-props" class="member">
|
|
3584
4092
|
<div class="member-link">
|
|
@@ -3623,7 +4131,7 @@ path.onMouseLeave = function(event) {
|
|
|
3623
4131
|
<div class="button run">Run</div>
|
|
3624
4132
|
</div>
|
|
3625
4133
|
|
|
3626
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4134
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
3627
4135
|
var circle = new Path.Circle({
|
|
3628
4136
|
center: [80, 50],
|
|
3629
4137
|
radius: 35
|
|
@@ -3636,7 +4144,7 @@ circle.set({
|
|
|
3636
4144
|
selected: true
|
|
3637
4145
|
});
|
|
3638
4146
|
</script>
|
|
3639
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4147
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
3640
4148
|
</div>
|
|
3641
4149
|
|
|
3642
4150
|
|
|
@@ -3692,7 +4200,7 @@ circle.set({
|
|
|
3692
4200
|
<div class="button run">Run</div>
|
|
3693
4201
|
</div>
|
|
3694
4202
|
|
|
3695
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4203
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
3696
4204
|
var circle = new Path.Circle({
|
|
3697
4205
|
center: [50, 50],
|
|
3698
4206
|
radius: 10,
|
|
@@ -3707,7 +4215,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3707
4215
|
copy.position.x += i * copy.bounds.width;
|
|
3708
4216
|
}
|
|
3709
4217
|
</script>
|
|
3710
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4218
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
3711
4219
|
</div>
|
|
3712
4220
|
|
|
3713
4221
|
|
|
@@ -3833,7 +4341,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3833
4341
|
<div class="button run">Run</div>
|
|
3834
4342
|
</div>
|
|
3835
4343
|
|
|
3836
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4344
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
3837
4345
|
var circle = new Path.Circle({
|
|
3838
4346
|
center: [50, 50],
|
|
3839
4347
|
radius: 5,
|
|
@@ -3850,7 +4358,7 @@ raster.position.x += 100;
|
|
|
3850
4358
|
circle.scale(5);
|
|
3851
4359
|
raster.scale(5);
|
|
3852
4360
|
</script>
|
|
3853
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4361
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
3854
4362
|
</div>
|
|
3855
4363
|
|
|
3856
4364
|
|
|
@@ -3904,7 +4412,7 @@ raster.scale(5);
|
|
|
3904
4412
|
<div class="button run">Run</div>
|
|
3905
4413
|
</div>
|
|
3906
4414
|
|
|
3907
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4415
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
3908
4416
|
var path = new Path.Star({
|
|
3909
4417
|
center: [50, 50],
|
|
3910
4418
|
points: 12,
|
|
@@ -3925,7 +4433,7 @@ function onMouseDown(event) {
|
|
|
3925
4433
|
}
|
|
3926
4434
|
}
|
|
3927
4435
|
</script>
|
|
3928
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4436
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
|
|
3929
4437
|
</div>
|
|
3930
4438
|
|
|
3931
4439
|
|
|
@@ -4443,11 +4951,17 @@ function onMouseDown(event) {
|
|
|
4443
4951
|
</div>
|
|
4444
4952
|
<div class="member-description hidden">
|
|
4445
4953
|
<div class="member-text">
|
|
4446
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4954
|
+
<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>
|
|
4447
4955
|
<ul class="member-list">
|
|
4448
4956
|
<h4>Options:</h4>
|
|
4449
|
-
<li
|
|
4450
|
-
|
|
4957
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4958
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4959
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4960
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4961
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4962
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4963
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4964
|
+
`options.bounds` the identity matrix is used.</li>
|
|
4451
4965
|
<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>
|
|
4452
4966
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
4453
4967
|
<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>
|
|
@@ -4455,6 +4969,12 @@ function onMouseDown(event) {
|
|
|
4455
4969
|
<li><tt>options.reuseImages: <tt>Boolean</tt></tt> — whether raster images with the same content should only be exported once into the <code><defs></code> element, and placed through <code><use></code> elements referencing it — default: <tt>false</tt></li>
|
|
4456
4970
|
<li><tt>options.idPrefix: <tt>String</tt></tt> — a prefix for the ids generated for definitions such as gradients, clip paths and symbols, to keep them unique when several exported SVGs are placed in one document — default: <tt>’’</tt></li>
|
|
4457
4971
|
<li><tt>options.reduceAttributes: <tt>Boolean</tt></tt> — wether to only include style attributes in the SVG output that differ from their parents, or to always include them (much faster but leading to redundancies). — default: <tt>true</tt></li>
|
|
4972
|
+
<li>[options.processNode] {Function} the function to process the
|
|
4973
|
+
SVG node made for each exported item, receiving an object with the
|
|
4974
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
4975
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
4976
|
+
is called before the item's name, style, visibility and data are set
|
|
4977
|
+
on the node, which replace attributes of the same names.</li>
|
|
4458
4978
|
</ul>
|
|
4459
4979
|
|
|
4460
4980
|
<ul class="member-list">
|
|
@@ -4497,6 +5017,7 @@ function onMouseDown(event) {
|
|
|
4497
5017
|
<div class="member-text">
|
|
4498
5018
|
<p>Converts the provided SVG content into Paper.js items and adds them to the this item’s children list. Note that the item is not cleared first. You can call <a href="../classes/Item.html#removechildren"><tt>item.removeChildren</tt></a>() to do so.</p>
|
|
4499
5019
|
<p><code><symbol></code> elements are imported as <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> items, and the <code><use></code> elements that place them as <a href="../classes/SymbolItem.html"><tt>SymbolItem</tt></a> items. The styles that <code><use></code> elements inherit don’t reach the symbols’ content.</p>
|
|
5020
|
+
<p>The layers in SVG content that Paper.js exported come back as <a href="../classes/Layer.html"><tt>Layer</tt></a> items inside the imported group. To make the layers of a project’s SVG the layers of a project again, add them to it with <code>item.children.slice().forEach(project.addLayer, project)</code>.</p>
|
|
4500
5021
|
<p>URLs are fetched as they are, so validate URLs that come from untrusted sources first, especially on servers, where they could reach internal addresses.</p>
|
|
4501
5022
|
<ul class="member-list">
|
|
4502
5023
|
<h4>Options:</h4>
|
|
@@ -4508,6 +5029,13 @@ function onMouseDown(event) {
|
|
|
4508
5029
|
<li><tt>options.onError: <tt>Function</tt></tt> — the callback function to call if an error occurs during loading. Only required when loading from external resources.</li>
|
|
4509
5030
|
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the imported items should be added to the item that <code>importSVG()</code> is called on — default: <tt>true</tt></li>
|
|
4510
5031
|
<li><tt>options.applyMatrix: <tt>Boolean</tt></tt> — whether the imported items should have their transformation matrices applied to their contents or not — default: <tt><a href="../classes/PaperScope.html#settings"><tt>paperScope.settings</tt></a>.applyMatrix</tt></li>
|
|
5032
|
+
<li>[options.processItem] {Function} the function to process the
|
|
5033
|
+
item made for each imported SVG element, receiving an object with
|
|
5034
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
5035
|
+
doesn't import, or return an item to replace it with. It is called
|
|
5036
|
+
after the element's attributes and data are applied to the item, so
|
|
5037
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
5038
|
+
copy them over from `item` as needed.</li>
|
|
4511
5039
|
</ul>
|
|
4512
5040
|
|
|
4513
5041
|
<ul class="member-list">
|
|
@@ -5787,7 +6315,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5787
6315
|
<div class="button run">Run</div>
|
|
5788
6316
|
</div>
|
|
5789
6317
|
|
|
5790
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6318
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
5791
6319
|
// Create a rectangle shaped path with its top left
|
|
5792
6320
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5793
6321
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5796,7 +6324,7 @@ path.fillColor = 'black';
|
|
|
5796
6324
|
// Rotate the path by 30 degrees:
|
|
5797
6325
|
path.rotate(30);
|
|
5798
6326
|
</script>
|
|
5799
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6327
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
|
|
5800
6328
|
</div>
|
|
5801
6329
|
|
|
5802
6330
|
|
|
@@ -5808,7 +6336,7 @@ path.rotate(30);
|
|
|
5808
6336
|
<div class="button run">Run</div>
|
|
5809
6337
|
</div>
|
|
5810
6338
|
|
|
5811
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6339
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
5812
6340
|
// Create a rectangle shaped path with its top left
|
|
5813
6341
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5814
6342
|
var topLeft = new Point(175, 50);
|
|
@@ -5830,7 +6358,7 @@ function onFrame(event) {
|
|
|
5830
6358
|
path.rotate(3, view.center);
|
|
5831
6359
|
}
|
|
5832
6360
|
</script>
|
|
5833
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6361
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
5834
6362
|
</div>
|
|
5835
6363
|
|
|
5836
6364
|
|
|
@@ -5879,7 +6407,7 @@ function onFrame(event) {
|
|
|
5879
6407
|
<div class="button run">Run</div>
|
|
5880
6408
|
</div>
|
|
5881
6409
|
|
|
5882
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6410
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
5883
6411
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5884
6412
|
// with a radius of 20:
|
|
5885
6413
|
var circle = new Path.Circle({
|
|
@@ -5891,7 +6419,7 @@ var circle = new Path.Circle({
|
|
|
5891
6419
|
// Scale the path by 150% from its center point
|
|
5892
6420
|
circle.scale(1.5);
|
|
5893
6421
|
</script>
|
|
5894
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6422
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
|
|
5895
6423
|
</div>
|
|
5896
6424
|
|
|
5897
6425
|
|
|
@@ -5903,7 +6431,7 @@ circle.scale(1.5);
|
|
|
5903
6431
|
<div class="button run">Run</div>
|
|
5904
6432
|
</div>
|
|
5905
6433
|
|
|
5906
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6434
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
5907
6435
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5908
6436
|
// with a radius of 20:
|
|
5909
6437
|
var circle = new Path.Circle({
|
|
@@ -5915,7 +6443,7 @@ var circle = new Path.Circle({
|
|
|
5915
6443
|
// Scale the path 150% from its bottom left corner
|
|
5916
6444
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5917
6445
|
</script>
|
|
5918
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6446
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
|
|
5919
6447
|
</div>
|
|
5920
6448
|
|
|
5921
6449
|
|
|
@@ -5971,7 +6499,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5971
6499
|
<div class="button run">Run</div>
|
|
5972
6500
|
</div>
|
|
5973
6501
|
|
|
5974
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6502
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
5975
6503
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5976
6504
|
// with a radius of 20:
|
|
5977
6505
|
var circle = new Path.Circle({
|
|
@@ -5983,7 +6511,7 @@ var circle = new Path.Circle({
|
|
|
5983
6511
|
// Scale the path horizontally by 300%
|
|
5984
6512
|
circle.scale(3, 1);
|
|
5985
6513
|
</script>
|
|
5986
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6514
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
5987
6515
|
</div>
|
|
5988
6516
|
|
|
5989
6517
|
|
|
@@ -6421,7 +6949,7 @@ circle.scale(3, 1);
|
|
|
6421
6949
|
<div class="button run">Run</div>
|
|
6422
6950
|
</div>
|
|
6423
6951
|
|
|
6424
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6952
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6425
6953
|
// Create a rectangle shaped path with its top left corner
|
|
6426
6954
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6427
6955
|
var path = new Path.Rectangle({
|
|
@@ -6442,7 +6970,7 @@ var circlePath = new Path.Circle({
|
|
|
6442
6970
|
// the rectangular path:
|
|
6443
6971
|
circlePath.fitBounds(path.bounds);
|
|
6444
6972
|
</script>
|
|
6445
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6973
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
6446
6974
|
</div>
|
|
6447
6975
|
|
|
6448
6976
|
|
|
@@ -6454,7 +6982,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
6454
6982
|
<div class="button run">Run</div>
|
|
6455
6983
|
</div>
|
|
6456
6984
|
|
|
6457
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6985
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6458
6986
|
// Create a rectangle shaped path with its top left corner
|
|
6459
6987
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6460
6988
|
var path = new Path.Rectangle({
|
|
@@ -6475,7 +7003,7 @@ var circlePath = new Path.Circle({
|
|
|
6475
7003
|
// the rectangular path:
|
|
6476
7004
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
6477
7005
|
</script>
|
|
6478
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7006
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
|
|
6479
7007
|
</div>
|
|
6480
7008
|
|
|
6481
7009
|
|
|
@@ -6487,7 +7015,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
6487
7015
|
<div class="button run">Run</div>
|
|
6488
7016
|
</div>
|
|
6489
7017
|
|
|
6490
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7018
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6491
7019
|
var path = new Path.Circle({
|
|
6492
7020
|
center: [80, 50],
|
|
6493
7021
|
radius: 30,
|
|
@@ -6497,7 +7025,7 @@ var path = new Path.Circle({
|
|
|
6497
7025
|
// Fit the path to the bounding rectangle of the view:
|
|
6498
7026
|
path.fitBounds(view.bounds);
|
|
6499
7027
|
</script>
|
|
6500
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7028
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
|
|
6501
7029
|
</div>
|
|
6502
7030
|
|
|
6503
7031
|
|
|
@@ -6523,7 +7051,7 @@ path.fitBounds(view.bounds);
|
|
|
6523
7051
|
<li>
|
|
6524
7052
|
<tt>type:</tt>
|
|
6525
7053
|
<tt>String</tt>
|
|
6526
|
-
— 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>
|
|
7054
|
+
— 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>
|
|
6527
7055
|
|
|
6528
7056
|
</li>
|
|
6529
7057
|
|
|
@@ -6558,7 +7086,7 @@ path.fitBounds(view.bounds);
|
|
|
6558
7086
|
<div class="button run">Run</div>
|
|
6559
7087
|
</div>
|
|
6560
7088
|
|
|
6561
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7089
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
6562
7090
|
// Create a circle shaped path at the center of the view:
|
|
6563
7091
|
var path = new Path.Circle({
|
|
6564
7092
|
center: view.center,
|
|
@@ -6576,7 +7104,7 @@ path.on('mouseleave', function() {
|
|
|
6576
7104
|
this.fillColor = 'black';
|
|
6577
7105
|
});
|
|
6578
7106
|
</script>
|
|
6579
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7107
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
6580
7108
|
</div>
|
|
6581
7109
|
|
|
6582
7110
|
|
|
@@ -6600,7 +7128,7 @@ path.on('mouseleave', function() {
|
|
|
6600
7128
|
<li>
|
|
6601
7129
|
<tt>object:</tt>
|
|
6602
7130
|
<tt>Object</tt>
|
|
6603
|
-
— 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>
|
|
7131
|
+
— 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>
|
|
6604
7132
|
|
|
6605
7133
|
</li>
|
|
6606
7134
|
|
|
@@ -6628,7 +7156,7 @@ path.on('mouseleave', function() {
|
|
|
6628
7156
|
<div class="button run">Run</div>
|
|
6629
7157
|
</div>
|
|
6630
7158
|
|
|
6631
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7159
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
6632
7160
|
// Create a circle shaped path at the center of the view:
|
|
6633
7161
|
var path = new Path.Circle({
|
|
6634
7162
|
center: view.center,
|
|
@@ -6646,7 +7174,7 @@ path.on({
|
|
|
6646
7174
|
}
|
|
6647
7175
|
});
|
|
6648
7176
|
</script>
|
|
6649
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7177
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
6650
7178
|
</div>
|
|
6651
7179
|
|
|
6652
7180
|
|
|
@@ -6658,7 +7186,7 @@ path.on({
|
|
|
6658
7186
|
<div class="button run">Run</div>
|
|
6659
7187
|
</div>
|
|
6660
7188
|
|
|
6661
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7189
|
+
<script type="text/paperscript" canvas="canvas-64">
|
|
6662
7190
|
var pathHandlers = {
|
|
6663
7191
|
mouseenter: function(event) {
|
|
6664
7192
|
this.fillColor = 'red';
|
|
@@ -6681,7 +7209,7 @@ function onMouseDown(event) {
|
|
|
6681
7209
|
path.on(pathHandlers);
|
|
6682
7210
|
}
|
|
6683
7211
|
</script>
|
|
6684
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7212
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
|
|
6685
7213
|
</div>
|
|
6686
7214
|
|
|
6687
7215
|
|
|
@@ -6705,7 +7233,7 @@ function onMouseDown(event) {
|
|
|
6705
7233
|
<li>
|
|
6706
7234
|
<tt>type:</tt>
|
|
6707
7235
|
<tt>String</tt>
|
|
6708
|
-
— 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>
|
|
7236
|
+
— 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>
|
|
6709
7237
|
|
|
6710
7238
|
</li>
|
|
6711
7239
|
|
|
@@ -6753,7 +7281,7 @@ function onMouseDown(event) {
|
|
|
6753
7281
|
<li>
|
|
6754
7282
|
<tt>object:</tt>
|
|
6755
7283
|
<tt>Object</tt>
|
|
6756
|
-
— 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>
|
|
7284
|
+
— 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>
|
|
6757
7285
|
|
|
6758
7286
|
</li>
|
|
6759
7287
|
|
|
@@ -6794,7 +7322,7 @@ function onMouseDown(event) {
|
|
|
6794
7322
|
<li>
|
|
6795
7323
|
<tt>type:</tt>
|
|
6796
7324
|
<tt>String</tt>
|
|
6797
|
-
— 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>
|
|
7325
|
+
— 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>
|
|
6798
7326
|
|
|
6799
7327
|
</li>
|
|
6800
7328
|
|
|
@@ -6842,7 +7370,7 @@ function onMouseDown(event) {
|
|
|
6842
7370
|
<li>
|
|
6843
7371
|
<tt>type:</tt>
|
|
6844
7372
|
<tt>String</tt>
|
|
6845
|
-
— 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>
|
|
7373
|
+
— 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>
|
|
6846
7374
|
|
|
6847
7375
|
</li>
|
|
6848
7376
|
|
|
@@ -6909,7 +7437,7 @@ function onMouseDown(event) {
|
|
|
6909
7437
|
<div class="button run">Run</div>
|
|
6910
7438
|
</div>
|
|
6911
7439
|
|
|
6912
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7440
|
+
<script type="text/paperscript" canvas="canvas-65">
|
|
6913
7441
|
function onMouseDrag(event) {
|
|
6914
7442
|
// Create a circle shaped path at the mouse position,
|
|
6915
7443
|
// with a radius of 10:
|
|
@@ -6926,7 +7454,7 @@ function onMouseDrag(event) {
|
|
|
6926
7454
|
});
|
|
6927
7455
|
}
|
|
6928
7456
|
</script>
|
|
6929
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7457
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-65"></canvas></div>
|
|
6930
7458
|
</div>
|
|
6931
7459
|
|
|
6932
7460
|
|
|
@@ -6956,7 +7484,7 @@ function onMouseDrag(event) {
|
|
|
6956
7484
|
<div class="button run">Run</div>
|
|
6957
7485
|
</div>
|
|
6958
7486
|
|
|
6959
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7487
|
+
<script type="text/paperscript" canvas="canvas-66">
|
|
6960
7488
|
function onMouseMove(event) {
|
|
6961
7489
|
// Create a circle shaped path at the mouse position,
|
|
6962
7490
|
// with a radius of 10:
|
|
@@ -6970,7 +7498,7 @@ function onMouseMove(event) {
|
|
|
6970
7498
|
path.removeOnMove();
|
|
6971
7499
|
}
|
|
6972
7500
|
</script>
|
|
6973
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7501
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-66"></canvas></div>
|
|
6974
7502
|
</div>
|
|
6975
7503
|
|
|
6976
7504
|
|
|
@@ -7000,7 +7528,7 @@ function onMouseMove(event) {
|
|
|
7000
7528
|
<div class="button run">Run</div>
|
|
7001
7529
|
</div>
|
|
7002
7530
|
|
|
7003
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7531
|
+
<script type="text/paperscript" canvas="canvas-67">
|
|
7004
7532
|
function onMouseDown(event) {
|
|
7005
7533
|
// Create a circle shaped path at the mouse position,
|
|
7006
7534
|
// with a radius of 10:
|
|
@@ -7014,7 +7542,7 @@ function onMouseDown(event) {
|
|
|
7014
7542
|
path.removeOnDown();
|
|
7015
7543
|
}
|
|
7016
7544
|
</script>
|
|
7017
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7545
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-67"></canvas></div>
|
|
7018
7546
|
</div>
|
|
7019
7547
|
|
|
7020
7548
|
|
|
@@ -7044,7 +7572,7 @@ function onMouseDown(event) {
|
|
|
7044
7572
|
<div class="button run">Run</div>
|
|
7045
7573
|
</div>
|
|
7046
7574
|
|
|
7047
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7575
|
+
<script type="text/paperscript" canvas="canvas-68">
|
|
7048
7576
|
function onMouseDrag(event) {
|
|
7049
7577
|
// Create a circle shaped path at the mouse position,
|
|
7050
7578
|
// with a radius of 10:
|
|
@@ -7058,7 +7586,7 @@ function onMouseDrag(event) {
|
|
|
7058
7586
|
path.removeOnDrag();
|
|
7059
7587
|
}
|
|
7060
7588
|
</script>
|
|
7061
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7589
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-68"></canvas></div>
|
|
7062
7590
|
</div>
|
|
7063
7591
|
|
|
7064
7592
|
|
|
@@ -7088,7 +7616,7 @@ function onMouseDrag(event) {
|
|
|
7088
7616
|
<div class="button run">Run</div>
|
|
7089
7617
|
</div>
|
|
7090
7618
|
|
|
7091
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7619
|
+
<script type="text/paperscript" canvas="canvas-69">
|
|
7092
7620
|
function onMouseDown(event) {
|
|
7093
7621
|
// Create a circle shaped path at the mouse position,
|
|
7094
7622
|
// with a radius of 10:
|
|
@@ -7102,7 +7630,7 @@ function onMouseDown(event) {
|
|
|
7102
7630
|
path.removeOnUp();
|
|
7103
7631
|
}
|
|
7104
7632
|
</script>
|
|
7105
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7633
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-69"></canvas></div>
|
|
7106
7634
|
</div>
|
|
7107
7635
|
|
|
7108
7636
|
|
|
@@ -7175,7 +7703,7 @@ function onMouseDown(event) {
|
|
|
7175
7703
|
<div class="button run">Run</div>
|
|
7176
7704
|
</div>
|
|
7177
7705
|
|
|
7178
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7706
|
+
<script type="text/paperscript" canvas="canvas-70">
|
|
7179
7707
|
var path = new Path.Circle({
|
|
7180
7708
|
radius: view.bounds.height * 0.4,
|
|
7181
7709
|
center: view.center
|
|
@@ -7186,7 +7714,7 @@ path.tween(
|
|
|
7186
7714
|
3000
|
|
7187
7715
|
);
|
|
7188
7716
|
</script>
|
|
7189
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7717
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
|
|
7190
7718
|
</div>
|
|
7191
7719
|
|
|
7192
7720
|
|
|
@@ -7198,7 +7726,7 @@ path.tween(
|
|
|
7198
7726
|
<div class="button run">Run</div>
|
|
7199
7727
|
</div>
|
|
7200
7728
|
|
|
7201
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7729
|
+
<script type="text/paperscript" canvas="canvas-71">
|
|
7202
7730
|
var path = new Shape.Rectangle({
|
|
7203
7731
|
fillColor: 'red',
|
|
7204
7732
|
center: [50, view.center.y],
|
|
@@ -7213,7 +7741,7 @@ path.tween({
|
|
|
7213
7741
|
duration: 2000
|
|
7214
7742
|
});
|
|
7215
7743
|
</script>
|
|
7216
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7744
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-71"></canvas></div>
|
|
7217
7745
|
</div>
|
|
7218
7746
|
|
|
7219
7747
|
|
|
@@ -7279,7 +7807,7 @@ path.tween({
|
|
|
7279
7807
|
<div class="button run">Run</div>
|
|
7280
7808
|
</div>
|
|
7281
7809
|
|
|
7282
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7810
|
+
<script type="text/paperscript" canvas="canvas-72">
|
|
7283
7811
|
var path = new Path.Rectangle({
|
|
7284
7812
|
size: [100, 100],
|
|
7285
7813
|
position: view.center,
|
|
@@ -7293,7 +7821,7 @@ path.tween({
|
|
|
7293
7821
|
'segments[2].point.x': '-= 50'
|
|
7294
7822
|
}, 3000);
|
|
7295
7823
|
</script>
|
|
7296
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7824
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-72"></canvas></div>
|
|
7297
7825
|
</div>
|
|
7298
7826
|
|
|
7299
7827
|
|
|
@@ -7352,7 +7880,7 @@ path.tween({
|
|
|
7352
7880
|
<div class="button run">Run</div>
|
|
7353
7881
|
</div>
|
|
7354
7882
|
|
|
7355
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7883
|
+
<script type="text/paperscript" canvas="canvas-73">
|
|
7356
7884
|
var path = new Path.Circle({
|
|
7357
7885
|
fillColor: 'blue',
|
|
7358
7886
|
radius: view.bounds.height * 0.4,
|
|
@@ -7368,7 +7896,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7368
7896
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
7369
7897
|
};
|
|
7370
7898
|
</script>
|
|
7371
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7899
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-73"></canvas></div>
|
|
7372
7900
|
</div>
|
|
7373
7901
|
|
|
7374
7902
|
|
|
@@ -7489,7 +8017,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7489
8017
|
<div class="button run">Run</div>
|
|
7490
8018
|
</div>
|
|
7491
8019
|
|
|
7492
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8020
|
+
<script type="text/paperscript" canvas="canvas-74">
|
|
7493
8021
|
var path = new Path.Circle({
|
|
7494
8022
|
fillColor: 'blue',
|
|
7495
8023
|
radius: view.bounds.height * 0.4,
|
|
@@ -7497,7 +8025,7 @@ var path = new Path.Circle({
|
|
|
7497
8025
|
});
|
|
7498
8026
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
7499
8027
|
</script>
|
|
7500
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8028
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
|
|
7501
8029
|
</div>
|
|
7502
8030
|
|
|
7503
8031
|
|
|
@@ -7511,7 +8039,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
7511
8039
|
|
|
7512
8040
|
<!-- =========================== copyright notice ========================== -->
|
|
7513
8041
|
<p class="footer">
|
|
7514
|
-
Paper.js v0.
|
|
8042
|
+
Paper.js v0.17.0<br>
|
|
7515
8043
|
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>
|
|
7516
8044
|
<div class="content-end"></div>
|
|
7517
8045
|
|