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
|
@@ -37,6 +37,91 @@
|
|
|
37
37
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
38
38
|
|
|
39
39
|
|
|
40
|
+
<div id="effects" class="member">
|
|
41
|
+
<div class="member-link">
|
|
42
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
43
|
+
</div>
|
|
44
|
+
<div class="member-description hidden">
|
|
45
|
+
|
|
46
|
+
<div class="member-text">
|
|
47
|
+
<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,
|
|
48
|
+
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>
|
|
49
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
50
|
+
<ul>
|
|
51
|
+
<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>
|
|
52
|
+
<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>
|
|
53
|
+
</ul>
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<ul class="member-list">
|
|
58
|
+
<h4>Type:</h4>
|
|
59
|
+
<li>
|
|
60
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
61
|
+
</li>
|
|
62
|
+
</ul>
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
<h4>Example:</h4>
|
|
66
|
+
|
|
67
|
+
<div class="paperscript split">
|
|
68
|
+
|
|
69
|
+
<div class="buttons">
|
|
70
|
+
<div class="button run">Run</div>
|
|
71
|
+
</div>
|
|
72
|
+
|
|
73
|
+
<script type="text/paperscript" canvas="canvas-0">
|
|
74
|
+
var path = new Path.Star({
|
|
75
|
+
center: view.center,
|
|
76
|
+
points: 5,
|
|
77
|
+
radius1: 20,
|
|
78
|
+
radius2: 40,
|
|
79
|
+
strokeColor: 'black',
|
|
80
|
+
strokeWidth: 8
|
|
81
|
+
});
|
|
82
|
+
path.effects = [
|
|
83
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
84
|
+
{ type: 'outline' }
|
|
85
|
+
];
|
|
86
|
+
</script>
|
|
87
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
|
|
88
|
+
</div>
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
</div>
|
|
92
|
+
|
|
93
|
+
</div>
|
|
94
|
+
</div>
|
|
95
|
+
|
|
96
|
+
|
|
97
|
+
<div id="previewbounds-matrix" class="member">
|
|
98
|
+
<div class="member-link">
|
|
99
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
100
|
+
</div>
|
|
101
|
+
<div class="member-description hidden">
|
|
102
|
+
|
|
103
|
+
<div class="member-text">
|
|
104
|
+
<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>
|
|
105
|
+
|
|
106
|
+
<p>Read only.</p>
|
|
107
|
+
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
<ul class="member-list">
|
|
111
|
+
<h4>Type:</h4>
|
|
112
|
+
<li>
|
|
113
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
114
|
+
</li>
|
|
115
|
+
</ul>
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
|
|
119
|
+
</div>
|
|
120
|
+
|
|
121
|
+
</div>
|
|
122
|
+
</div>
|
|
123
|
+
|
|
124
|
+
|
|
40
125
|
<div id="key" class="member">
|
|
41
126
|
<div class="member-link">
|
|
42
127
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -149,7 +234,7 @@
|
|
|
149
234
|
<div class="button run">Run</div>
|
|
150
235
|
</div>
|
|
151
236
|
|
|
152
|
-
<script type="text/paperscript" canvas="canvas-
|
|
237
|
+
<script type="text/paperscript" canvas="canvas-1">
|
|
153
238
|
var path = new Path.Circle({
|
|
154
239
|
center: [80, 50],
|
|
155
240
|
radius: 35
|
|
@@ -164,7 +249,7 @@ group.addChild(path);
|
|
|
164
249
|
// The path can be accessed by name:
|
|
165
250
|
group.children['example'].fillColor = 'red';
|
|
166
251
|
</script>
|
|
167
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
252
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
|
|
168
253
|
</div>
|
|
169
254
|
|
|
170
255
|
|
|
@@ -202,7 +287,7 @@ group.children['example'].fillColor = 'red';
|
|
|
202
287
|
<div class="button run">Run</div>
|
|
203
288
|
</div>
|
|
204
289
|
|
|
205
|
-
<script type="text/paperscript" canvas="canvas-
|
|
290
|
+
<script type="text/paperscript" canvas="canvas-2">
|
|
206
291
|
var circle = new Path.Circle({
|
|
207
292
|
center: [80, 50],
|
|
208
293
|
radius: 30
|
|
@@ -213,7 +298,7 @@ circle.style = {
|
|
|
213
298
|
strokeWidth: 5
|
|
214
299
|
};
|
|
215
300
|
</script>
|
|
216
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
301
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
|
|
217
302
|
</div>
|
|
218
303
|
|
|
219
304
|
|
|
@@ -225,7 +310,7 @@ circle.style = {
|
|
|
225
310
|
<div class="button run">Run</div>
|
|
226
311
|
</div>
|
|
227
312
|
|
|
228
|
-
<script type="text/paperscript" canvas="canvas-
|
|
313
|
+
<script type="text/paperscript" canvas="canvas-3">
|
|
229
314
|
var path = new Path.Circle({
|
|
230
315
|
center: [50, 50],
|
|
231
316
|
radius: 30,
|
|
@@ -240,7 +325,7 @@ var path2 = new Path.Circle({
|
|
|
240
325
|
// Copy the path style of path:
|
|
241
326
|
path2.style = path.style;
|
|
242
327
|
</script>
|
|
243
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
328
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
|
|
244
329
|
</div>
|
|
245
330
|
|
|
246
331
|
|
|
@@ -252,7 +337,7 @@ path2.style = path.style;
|
|
|
252
337
|
<div class="button run">Run</div>
|
|
253
338
|
</div>
|
|
254
339
|
|
|
255
|
-
<script type="text/paperscript" canvas="canvas-
|
|
340
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
256
341
|
var myStyle = {
|
|
257
342
|
fillColor: 'red',
|
|
258
343
|
strokeColor: 'blue',
|
|
@@ -271,7 +356,7 @@ var path2 = new Path.Circle({
|
|
|
271
356
|
});
|
|
272
357
|
path2.style = myStyle;
|
|
273
358
|
</script>
|
|
274
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
359
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
|
|
275
360
|
</div>
|
|
276
361
|
|
|
277
362
|
|
|
@@ -313,7 +398,7 @@ path2.style = myStyle;
|
|
|
313
398
|
<div class="button run">Run</div>
|
|
314
399
|
</div>
|
|
315
400
|
|
|
316
|
-
<script type="text/paperscript" canvas="canvas-
|
|
401
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
317
402
|
var unlockedItem = new Path.Circle({
|
|
318
403
|
center: view.center - [35, 0],
|
|
319
404
|
radius: 30,
|
|
@@ -340,7 +425,7 @@ new PointText({
|
|
|
340
425
|
justification: 'center'
|
|
341
426
|
});
|
|
342
427
|
</script>
|
|
343
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
428
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
344
429
|
</div>
|
|
345
430
|
|
|
346
431
|
|
|
@@ -382,7 +467,7 @@ new PointText({
|
|
|
382
467
|
<div class="button run">Run</div>
|
|
383
468
|
</div>
|
|
384
469
|
|
|
385
|
-
<script type="text/paperscript" canvas="canvas-
|
|
470
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
386
471
|
var path = new Path.Circle({
|
|
387
472
|
center: [50, 50],
|
|
388
473
|
radius: 20,
|
|
@@ -392,7 +477,7 @@ var path = new Path.Circle({
|
|
|
392
477
|
// Hide the path:
|
|
393
478
|
path.visible = false;
|
|
394
479
|
</script>
|
|
395
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
480
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
396
481
|
</div>
|
|
397
482
|
|
|
398
483
|
|
|
@@ -440,7 +525,7 @@ path.visible = false;
|
|
|
440
525
|
<div class="button run">Run</div>
|
|
441
526
|
</div>
|
|
442
527
|
|
|
443
|
-
<script type="text/paperscript" canvas="canvas-
|
|
528
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
444
529
|
// Create a white rectangle in the background
|
|
445
530
|
// with the same dimensions as the view:
|
|
446
531
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -461,7 +546,7 @@ var circle2 = new Path.Circle({
|
|
|
461
546
|
// Set the blend mode of circle2:
|
|
462
547
|
circle2.blendMode = 'multiply';
|
|
463
548
|
</script>
|
|
464
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
549
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
465
550
|
</div>
|
|
466
551
|
|
|
467
552
|
|
|
@@ -503,7 +588,7 @@ circle2.blendMode = 'multiply';
|
|
|
503
588
|
<div class="button run">Run</div>
|
|
504
589
|
</div>
|
|
505
590
|
|
|
506
|
-
<script type="text/paperscript" canvas="canvas-
|
|
591
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
507
592
|
var circle = new Path.Circle({
|
|
508
593
|
center: [80, 50],
|
|
509
594
|
radius: 35,
|
|
@@ -521,7 +606,7 @@ var circle2 = new Path.Circle({
|
|
|
521
606
|
// Make circle2 50% transparent:
|
|
522
607
|
circle2.opacity = 0.5;
|
|
523
608
|
</script>
|
|
524
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
609
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
525
610
|
</div>
|
|
526
611
|
|
|
527
612
|
|
|
@@ -644,14 +729,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
644
729
|
<div class="button run">Run</div>
|
|
645
730
|
</div>
|
|
646
731
|
|
|
647
|
-
<script type="text/paperscript" canvas="canvas-
|
|
732
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
648
733
|
var path = new Path.Circle({
|
|
649
734
|
center: [80, 50],
|
|
650
735
|
radius: 35
|
|
651
736
|
});
|
|
652
737
|
path.selected = true; // Select the path
|
|
653
738
|
</script>
|
|
654
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
739
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
655
740
|
</div>
|
|
656
741
|
|
|
657
742
|
|
|
@@ -808,7 +893,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
808
893
|
<div class="button run">Run</div>
|
|
809
894
|
</div>
|
|
810
895
|
|
|
811
|
-
<script type="text/paperscript" canvas="canvas-
|
|
896
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
812
897
|
// Create a circle at position { x: 10, y: 10 }
|
|
813
898
|
var circle = new Path.Circle({
|
|
814
899
|
center: new Point(10, 10),
|
|
@@ -822,7 +907,7 @@ circle.position = new Point(20, 20);
|
|
|
822
907
|
// Move the circle 100 points to the right and 50 points down
|
|
823
908
|
circle.position += new Point(100, 50);
|
|
824
909
|
</script>
|
|
825
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
910
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
826
911
|
</div>
|
|
827
912
|
|
|
828
913
|
|
|
@@ -834,7 +919,7 @@ circle.position += new Point(100, 50);
|
|
|
834
919
|
<div class="button run">Run</div>
|
|
835
920
|
</div>
|
|
836
921
|
|
|
837
|
-
<script type="text/paperscript" canvas="canvas-
|
|
922
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
838
923
|
// Create a circle at position { x: 20, y: 20 }
|
|
839
924
|
var circle = new Path.Circle({
|
|
840
925
|
center: new Point(20, 20),
|
|
@@ -845,7 +930,7 @@ var circle = new Path.Circle({
|
|
|
845
930
|
// Move the circle 100 points to the right
|
|
846
931
|
circle.position.x += 100;
|
|
847
932
|
</script>
|
|
848
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
933
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
849
934
|
</div>
|
|
850
935
|
|
|
851
936
|
|
|
@@ -1371,7 +1456,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1371
1456
|
<div class="button run">Run</div>
|
|
1372
1457
|
</div>
|
|
1373
1458
|
|
|
1374
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1459
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
1375
1460
|
var path = new Path.Circle({
|
|
1376
1461
|
center: [80, 50],
|
|
1377
1462
|
radius: 35
|
|
@@ -1384,7 +1469,7 @@ group.addChild(path);
|
|
|
1384
1469
|
// Access the path through the group's children array:
|
|
1385
1470
|
group.children[0].fillColor = 'red';
|
|
1386
1471
|
</script>
|
|
1387
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1472
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
1388
1473
|
</div>
|
|
1389
1474
|
|
|
1390
1475
|
|
|
@@ -1396,7 +1481,7 @@ group.children[0].fillColor = 'red';
|
|
|
1396
1481
|
<div class="button run">Run</div>
|
|
1397
1482
|
</div>
|
|
1398
1483
|
|
|
1399
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1484
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1400
1485
|
var path = new Path.Circle({
|
|
1401
1486
|
center: [80, 50],
|
|
1402
1487
|
radius: 35
|
|
@@ -1411,7 +1496,7 @@ group.addChild(path);
|
|
|
1411
1496
|
// The path can be accessed by name:
|
|
1412
1497
|
group.children['example'].fillColor = 'orange';
|
|
1413
1498
|
</script>
|
|
1414
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1499
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1415
1500
|
</div>
|
|
1416
1501
|
|
|
1417
1502
|
|
|
@@ -1423,7 +1508,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1423
1508
|
<div class="button run">Run</div>
|
|
1424
1509
|
</div>
|
|
1425
1510
|
|
|
1426
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1511
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1427
1512
|
var path = new Path.Circle({
|
|
1428
1513
|
center: [80, 50],
|
|
1429
1514
|
radius: 35
|
|
@@ -1435,7 +1520,7 @@ group.children = [path];
|
|
|
1435
1520
|
// The path is the first child of the group:
|
|
1436
1521
|
group.firstChild.fillColor = 'green';
|
|
1437
1522
|
</script>
|
|
1438
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1523
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1439
1524
|
</div>
|
|
1440
1525
|
|
|
1441
1526
|
|
|
@@ -1612,7 +1697,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1612
1697
|
<div class="button run">Run</div>
|
|
1613
1698
|
</div>
|
|
1614
1699
|
|
|
1615
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1700
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1616
1701
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1617
1702
|
// with a radius of 35:
|
|
1618
1703
|
var circle = new Path.Circle({
|
|
@@ -1623,7 +1708,7 @@ var circle = new Path.Circle({
|
|
|
1623
1708
|
// Set its stroke color to RGB red:
|
|
1624
1709
|
circle.strokeColor = new Color(1, 0, 0);
|
|
1625
1710
|
</script>
|
|
1626
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1711
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1627
1712
|
</div>
|
|
1628
1713
|
|
|
1629
1714
|
|
|
@@ -1660,7 +1745,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
1660
1745
|
<div class="button run">Run</div>
|
|
1661
1746
|
</div>
|
|
1662
1747
|
|
|
1663
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1748
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1664
1749
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1665
1750
|
// with a radius of 35:
|
|
1666
1751
|
var circle = new Path.Circle({
|
|
@@ -1672,7 +1757,7 @@ var circle = new Path.Circle({
|
|
|
1672
1757
|
// Set its stroke width to 10:
|
|
1673
1758
|
circle.strokeWidth = 10;
|
|
1674
1759
|
</script>
|
|
1675
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1760
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1676
1761
|
</div>
|
|
1677
1762
|
|
|
1678
1763
|
|
|
@@ -1719,7 +1804,7 @@ circle.strokeWidth = 10;
|
|
|
1719
1804
|
<div class="button run">Run</div>
|
|
1720
1805
|
</div>
|
|
1721
1806
|
|
|
1722
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1807
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1723
1808
|
var line = new Path({
|
|
1724
1809
|
segments: [[80, 50], [420, 50]],
|
|
1725
1810
|
strokeColor: 'black',
|
|
@@ -1740,7 +1825,7 @@ var line2 = line.clone();
|
|
|
1740
1825
|
line2.position.y += 100;
|
|
1741
1826
|
line2.strokeCap = 'butt';
|
|
1742
1827
|
</script>
|
|
1743
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
1828
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-17"></canvas></div>
|
|
1744
1829
|
</div>
|
|
1745
1830
|
|
|
1746
1831
|
|
|
@@ -1787,7 +1872,7 @@ line2.strokeCap = 'butt';
|
|
|
1787
1872
|
<div class="button run">Run</div>
|
|
1788
1873
|
</div>
|
|
1789
1874
|
|
|
1790
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1875
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1791
1876
|
var path = new Path({
|
|
1792
1877
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
1793
1878
|
strokeColor: 'black',
|
|
@@ -1804,7 +1889,7 @@ var path3 = path2.clone();
|
|
|
1804
1889
|
path3.position.x += path3.bounds.width * 1.5;
|
|
1805
1890
|
path3.strokeJoin = 'bevel';
|
|
1806
1891
|
</script>
|
|
1807
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
1892
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-18"></canvas></div>
|
|
1808
1893
|
</div>
|
|
1809
1894
|
|
|
1810
1895
|
|
|
@@ -1908,7 +1993,7 @@ path3.strokeJoin = 'bevel';
|
|
|
1908
1993
|
<div class="button run">Run</div>
|
|
1909
1994
|
</div>
|
|
1910
1995
|
|
|
1911
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1996
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1912
1997
|
var path = new Path.Circle({
|
|
1913
1998
|
center: [80, 50],
|
|
1914
1999
|
radius: 40,
|
|
@@ -1919,7 +2004,7 @@ var path = new Path.Circle({
|
|
|
1919
2004
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
1920
2005
|
path.dashArray = [10, 4];
|
|
1921
2006
|
</script>
|
|
1922
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2007
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
|
|
1923
2008
|
</div>
|
|
1924
2009
|
|
|
1925
2010
|
|
|
@@ -1954,6 +2039,42 @@ path.dashArray = [10, 4];
|
|
|
1954
2039
|
|
|
1955
2040
|
|
|
1956
2041
|
|
|
2042
|
+
</div>
|
|
2043
|
+
|
|
2044
|
+
</div>
|
|
2045
|
+
</div>
|
|
2046
|
+
|
|
2047
|
+
|
|
2048
|
+
<div id="paintorder" class="member">
|
|
2049
|
+
<div class="member-link">
|
|
2050
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
2051
|
+
</div>
|
|
2052
|
+
<div class="member-description hidden">
|
|
2053
|
+
|
|
2054
|
+
<div class="member-text">
|
|
2055
|
+
<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>
|
|
2056
|
+
|
|
2057
|
+
|
|
2058
|
+
<ul class="member-list">
|
|
2059
|
+
<h4>Values:</h4>
|
|
2060
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
2061
|
+
</ul>
|
|
2062
|
+
|
|
2063
|
+
|
|
2064
|
+
<ul class="member-list">
|
|
2065
|
+
<h4>Default:</h4>
|
|
2066
|
+
<li><tt>'fill'</tt></li>
|
|
2067
|
+
</ul>
|
|
2068
|
+
|
|
2069
|
+
<ul class="member-list">
|
|
2070
|
+
<h4>Type:</h4>
|
|
2071
|
+
<li>
|
|
2072
|
+
<tt>String</tt>
|
|
2073
|
+
</li>
|
|
2074
|
+
</ul>
|
|
2075
|
+
|
|
2076
|
+
|
|
2077
|
+
|
|
1957
2078
|
</div>
|
|
1958
2079
|
|
|
1959
2080
|
</div>
|
|
@@ -1989,7 +2110,7 @@ path.dashArray = [10, 4];
|
|
|
1989
2110
|
<div class="button run">Run</div>
|
|
1990
2111
|
</div>
|
|
1991
2112
|
|
|
1992
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2113
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
1993
2114
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1994
2115
|
// with a radius of 35:
|
|
1995
2116
|
var circle = new Path.Circle({
|
|
@@ -2000,7 +2121,7 @@ var circle = new Path.Circle({
|
|
|
2000
2121
|
// Set the fill color of the circle to RGB red:
|
|
2001
2122
|
circle.fillColor = new Color(1, 0, 0);
|
|
2002
2123
|
</script>
|
|
2003
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2124
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
2004
2125
|
</div>
|
|
2005
2126
|
|
|
2006
2127
|
|
|
@@ -2075,7 +2196,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2075
2196
|
<div class="button run">Run</div>
|
|
2076
2197
|
</div>
|
|
2077
2198
|
|
|
2078
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2199
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2079
2200
|
var circle = new Path.Circle({
|
|
2080
2201
|
center: [80, 50],
|
|
2081
2202
|
radius: 35,
|
|
@@ -2088,7 +2209,7 @@ var circle = new Path.Circle({
|
|
|
2088
2209
|
shadowOffset: new Point(5, 5)
|
|
2089
2210
|
});
|
|
2090
2211
|
</script>
|
|
2091
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2212
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2092
2213
|
</div>
|
|
2093
2214
|
|
|
2094
2215
|
|
|
@@ -2229,7 +2350,7 @@ var circle = new Path.Circle({
|
|
|
2229
2350
|
<div class="button run">Run</div>
|
|
2230
2351
|
</div>
|
|
2231
2352
|
|
|
2232
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2353
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2233
2354
|
// Create a rectangle shaped path with its top left point at:
|
|
2234
2355
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2235
2356
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2240,7 +2361,7 @@ path.onFrame = function(event) {
|
|
|
2240
2361
|
this.rotate(3);
|
|
2241
2362
|
}
|
|
2242
2363
|
</script>
|
|
2243
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2364
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2244
2365
|
</div>
|
|
2245
2366
|
|
|
2246
2367
|
|
|
@@ -2284,7 +2405,7 @@ path.onFrame = function(event) {
|
|
|
2284
2405
|
<div class="button run">Run</div>
|
|
2285
2406
|
</div>
|
|
2286
2407
|
|
|
2287
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2408
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2288
2409
|
// Create a circle shaped path at the center of the view:
|
|
2289
2410
|
var path = new Path.Circle({
|
|
2290
2411
|
center: view.center,
|
|
@@ -2298,7 +2419,7 @@ path.onMouseDown = function(event) {
|
|
|
2298
2419
|
this.fillColor = 'red';
|
|
2299
2420
|
}
|
|
2300
2421
|
</script>
|
|
2301
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2422
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2302
2423
|
</div>
|
|
2303
2424
|
|
|
2304
2425
|
|
|
@@ -2310,7 +2431,7 @@ path.onMouseDown = function(event) {
|
|
|
2310
2431
|
<div class="button run">Run</div>
|
|
2311
2432
|
</div>
|
|
2312
2433
|
|
|
2313
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2434
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2314
2435
|
// Loop 30 times:
|
|
2315
2436
|
for (var i = 0; i < 30; i++) {
|
|
2316
2437
|
// Create a circle shaped path at a random position
|
|
@@ -2328,7 +2449,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2328
2449
|
}
|
|
2329
2450
|
}
|
|
2330
2451
|
</script>
|
|
2331
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2452
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2332
2453
|
</div>
|
|
2333
2454
|
|
|
2334
2455
|
|
|
@@ -2372,7 +2493,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2372
2493
|
<div class="button run">Run</div>
|
|
2373
2494
|
</div>
|
|
2374
2495
|
|
|
2375
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2496
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2376
2497
|
// Create a circle shaped path at the center of the view:
|
|
2377
2498
|
var path = new Path.Circle({
|
|
2378
2499
|
center: view.center,
|
|
@@ -2385,7 +2506,7 @@ path.onMouseDrag = function(event) {
|
|
|
2385
2506
|
path.position += event.delta;
|
|
2386
2507
|
}
|
|
2387
2508
|
</script>
|
|
2388
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2509
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-25"></canvas></div>
|
|
2389
2510
|
</div>
|
|
2390
2511
|
|
|
2391
2512
|
|
|
@@ -2429,7 +2550,7 @@ path.onMouseDrag = function(event) {
|
|
|
2429
2550
|
<div class="button run">Run</div>
|
|
2430
2551
|
</div>
|
|
2431
2552
|
|
|
2432
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2553
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2433
2554
|
// Create a circle shaped path at the center of the view:
|
|
2434
2555
|
var path = new Path.Circle({
|
|
2435
2556
|
center: view.center,
|
|
@@ -2443,7 +2564,7 @@ path.onMouseUp = function(event) {
|
|
|
2443
2564
|
this.fillColor = 'red';
|
|
2444
2565
|
}
|
|
2445
2566
|
</script>
|
|
2446
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2567
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
2447
2568
|
</div>
|
|
2448
2569
|
|
|
2449
2570
|
|
|
@@ -2487,7 +2608,7 @@ path.onMouseUp = function(event) {
|
|
|
2487
2608
|
<div class="button run">Run</div>
|
|
2488
2609
|
</div>
|
|
2489
2610
|
|
|
2490
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2611
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2491
2612
|
// Create a circle shaped path at the center of the view:
|
|
2492
2613
|
var path = new Path.Circle({
|
|
2493
2614
|
center: view.center,
|
|
@@ -2501,7 +2622,7 @@ path.onClick = function(event) {
|
|
|
2501
2622
|
this.fillColor = 'red';
|
|
2502
2623
|
}
|
|
2503
2624
|
</script>
|
|
2504
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2625
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2505
2626
|
</div>
|
|
2506
2627
|
|
|
2507
2628
|
|
|
@@ -2513,7 +2634,7 @@ path.onClick = function(event) {
|
|
|
2513
2634
|
<div class="button run">Run</div>
|
|
2514
2635
|
</div>
|
|
2515
2636
|
|
|
2516
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2637
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2517
2638
|
// Loop 30 times:
|
|
2518
2639
|
for (var i = 0; i < 30; i++) {
|
|
2519
2640
|
// Create a circle shaped path at a random position
|
|
@@ -2531,7 +2652,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2531
2652
|
}
|
|
2532
2653
|
}
|
|
2533
2654
|
</script>
|
|
2534
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2655
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2535
2656
|
</div>
|
|
2536
2657
|
|
|
2537
2658
|
|
|
@@ -2575,7 +2696,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2575
2696
|
<div class="button run">Run</div>
|
|
2576
2697
|
</div>
|
|
2577
2698
|
|
|
2578
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2699
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2579
2700
|
// Create a circle shaped path at the center of the view:
|
|
2580
2701
|
var path = new Path.Circle({
|
|
2581
2702
|
center: view.center,
|
|
@@ -2589,7 +2710,7 @@ path.onDoubleClick = function(event) {
|
|
|
2589
2710
|
this.fillColor = 'red';
|
|
2590
2711
|
}
|
|
2591
2712
|
</script>
|
|
2592
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2713
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2593
2714
|
</div>
|
|
2594
2715
|
|
|
2595
2716
|
|
|
@@ -2601,7 +2722,7 @@ path.onDoubleClick = function(event) {
|
|
|
2601
2722
|
<div class="button run">Run</div>
|
|
2602
2723
|
</div>
|
|
2603
2724
|
|
|
2604
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2725
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2605
2726
|
// Loop 30 times:
|
|
2606
2727
|
for (var i = 0; i < 30; i++) {
|
|
2607
2728
|
// Create a circle shaped path at a random position
|
|
@@ -2619,7 +2740,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2619
2740
|
}
|
|
2620
2741
|
}
|
|
2621
2742
|
</script>
|
|
2622
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2743
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2623
2744
|
</div>
|
|
2624
2745
|
|
|
2625
2746
|
|
|
@@ -2663,7 +2784,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2663
2784
|
<div class="button run">Run</div>
|
|
2664
2785
|
</div>
|
|
2665
2786
|
|
|
2666
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2787
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2667
2788
|
// Create a circle shaped path at the center of the view:
|
|
2668
2789
|
var path = new Path.Circle({
|
|
2669
2790
|
center: view.center,
|
|
@@ -2671,180 +2792,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
2671
2792
|
fillColor: 'black'
|
|
2672
2793
|
});
|
|
2673
2794
|
|
|
2674
|
-
// When the mouse moves on top of the item, set its opacity
|
|
2675
|
-
// to a random value between 0 and 1:
|
|
2676
|
-
path.onMouseMove = function(event) {
|
|
2677
|
-
this.opacity = Math.random();
|
|
2678
|
-
}
|
|
2679
|
-
</script>
|
|
2680
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2681
|
-
</div>
|
|
2795
|
+
// When the mouse moves on top of the item, set its opacity
|
|
2796
|
+
// to a random value between 0 and 1:
|
|
2797
|
+
path.onMouseMove = function(event) {
|
|
2798
|
+
this.opacity = Math.random();
|
|
2799
|
+
}
|
|
2800
|
+
</script>
|
|
2801
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2802
|
+
</div>
|
|
2803
|
+
|
|
2804
|
+
|
|
2805
|
+
</div>
|
|
2806
|
+
|
|
2807
|
+
</div>
|
|
2808
|
+
</div>
|
|
2809
|
+
|
|
2810
|
+
|
|
2811
|
+
<div id="onmouseenter" class="member">
|
|
2812
|
+
<div class="member-link">
|
|
2813
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
2814
|
+
</div>
|
|
2815
|
+
<div class="member-description hidden">
|
|
2816
|
+
|
|
2817
|
+
<div class="member-text">
|
|
2818
|
+
<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>
|
|
2819
|
+
|
|
2820
|
+
|
|
2821
|
+
|
|
2822
|
+
<ul class="member-list">
|
|
2823
|
+
<h4>Type:</h4>
|
|
2824
|
+
<li>
|
|
2825
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2826
|
+
</li>
|
|
2827
|
+
</ul>
|
|
2828
|
+
|
|
2829
|
+
|
|
2830
|
+
<ul class="member-list">
|
|
2831
|
+
<h4>See also:</h4>
|
|
2832
|
+
|
|
2833
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
2834
|
+
|
|
2835
|
+
</ul>
|
|
2836
|
+
|
|
2837
|
+
<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>
|
|
2838
|
+
|
|
2839
|
+
<div class="paperscript split">
|
|
2840
|
+
|
|
2841
|
+
<div class="buttons">
|
|
2842
|
+
<div class="button run">Run</div>
|
|
2843
|
+
</div>
|
|
2844
|
+
|
|
2845
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2846
|
+
// Create a circle shaped path at the center of the view:
|
|
2847
|
+
var path = new Path.Circle({
|
|
2848
|
+
center: view.center,
|
|
2849
|
+
radius: 25,
|
|
2850
|
+
fillColor: 'black'
|
|
2851
|
+
});
|
|
2852
|
+
|
|
2853
|
+
// When the mouse enters the item, set its fill color to red:
|
|
2854
|
+
path.onMouseEnter = function(event) {
|
|
2855
|
+
this.fillColor = 'red';
|
|
2856
|
+
}
|
|
2857
|
+
|
|
2858
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
2859
|
+
path.onMouseLeave = function(event) {
|
|
2860
|
+
this.fillColor = 'black';
|
|
2861
|
+
}
|
|
2862
|
+
</script>
|
|
2863
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2864
|
+
</div>
|
|
2865
|
+
|
|
2866
|
+
|
|
2867
|
+
<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>
|
|
2868
|
+
|
|
2869
|
+
<div class="paperscript split">
|
|
2870
|
+
|
|
2871
|
+
<div class="buttons">
|
|
2872
|
+
<div class="button run">Run</div>
|
|
2873
|
+
</div>
|
|
2874
|
+
|
|
2875
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2876
|
+
function enter(event) {
|
|
2877
|
+
this.fillColor = 'red';
|
|
2878
|
+
}
|
|
2879
|
+
|
|
2880
|
+
function leave(event) {
|
|
2881
|
+
this.fillColor = 'black';
|
|
2882
|
+
}
|
|
2883
|
+
|
|
2884
|
+
// When the mouse is pressed:
|
|
2885
|
+
function onMouseDown(event) {
|
|
2886
|
+
// Create a circle shaped path at the position of the mouse:
|
|
2887
|
+
var path = new Path.Circle(event.point, 25);
|
|
2888
|
+
path.fillColor = 'black';
|
|
2889
|
+
|
|
2890
|
+
// When the mouse enters the item, set its fill color to red:
|
|
2891
|
+
path.onMouseEnter = enter;
|
|
2892
|
+
|
|
2893
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
2894
|
+
path.onMouseLeave = leave;
|
|
2895
|
+
}
|
|
2896
|
+
</script>
|
|
2897
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2898
|
+
</div>
|
|
2899
|
+
|
|
2900
|
+
|
|
2901
|
+
</div>
|
|
2902
|
+
|
|
2903
|
+
</div>
|
|
2904
|
+
</div>
|
|
2905
|
+
|
|
2906
|
+
|
|
2907
|
+
<div id="onmouseleave" class="member">
|
|
2908
|
+
<div class="member-link">
|
|
2909
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
2910
|
+
</div>
|
|
2911
|
+
<div class="member-description hidden">
|
|
2912
|
+
|
|
2913
|
+
<div class="member-text">
|
|
2914
|
+
<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>
|
|
2915
|
+
|
|
2916
|
+
|
|
2917
|
+
|
|
2918
|
+
<ul class="member-list">
|
|
2919
|
+
<h4>Type:</h4>
|
|
2920
|
+
<li>
|
|
2921
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2922
|
+
</li>
|
|
2923
|
+
</ul>
|
|
2924
|
+
|
|
2925
|
+
|
|
2926
|
+
<ul class="member-list">
|
|
2927
|
+
<h4>See also:</h4>
|
|
2928
|
+
|
|
2929
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
2930
|
+
|
|
2931
|
+
</ul>
|
|
2932
|
+
|
|
2933
|
+
<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>
|
|
2934
|
+
|
|
2935
|
+
<div class="paperscript split">
|
|
2936
|
+
|
|
2937
|
+
<div class="buttons">
|
|
2938
|
+
<div class="button run">Run</div>
|
|
2939
|
+
</div>
|
|
2940
|
+
|
|
2941
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
2942
|
+
// Create a circle shaped path at the center of the view:
|
|
2943
|
+
var path = new Path.Circle({
|
|
2944
|
+
center: view.center,
|
|
2945
|
+
radius: 25,
|
|
2946
|
+
fillColor: 'black'
|
|
2947
|
+
});
|
|
2948
|
+
|
|
2949
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
2950
|
+
path.onMouseLeave = function(event) {
|
|
2951
|
+
this.fillColor = 'red';
|
|
2952
|
+
}
|
|
2953
|
+
</script>
|
|
2954
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2955
|
+
</div>
|
|
2956
|
+
|
|
2957
|
+
|
|
2958
|
+
</div>
|
|
2959
|
+
|
|
2960
|
+
</div>
|
|
2961
|
+
</div>
|
|
2962
|
+
|
|
2963
|
+
|
|
2964
|
+
<div id="ondraw" class="member">
|
|
2965
|
+
<div class="member-link">
|
|
2966
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
2967
|
+
</div>
|
|
2968
|
+
<div class="member-description hidden">
|
|
2969
|
+
|
|
2970
|
+
<div class="member-text">
|
|
2971
|
+
<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>
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
|
|
2975
|
+
<ul class="member-list">
|
|
2976
|
+
<h4>Type:</h4>
|
|
2977
|
+
<li>
|
|
2978
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2979
|
+
</li>
|
|
2980
|
+
</ul>
|
|
2981
|
+
<ul class="member-list">
|
|
2982
|
+
<h4>Options:</h4>
|
|
2983
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
2984
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
2985
|
+
<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>
|
|
2986
|
+
<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>
|
|
2987
|
+
<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>()
|
|
2988
|
+
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>
|
|
2989
|
+
</ul>
|
|
2990
|
+
|
|
2991
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
2992
|
+
|
|
2993
|
+
<div class="paperscript split">
|
|
2994
|
+
|
|
2995
|
+
<div class="buttons">
|
|
2996
|
+
<div class="button run">Run</div>
|
|
2997
|
+
</div>
|
|
2998
|
+
|
|
2999
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
3000
|
+
var path = new Path.Circle({
|
|
3001
|
+
center: view.center,
|
|
3002
|
+
radius: 25,
|
|
3003
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3004
|
+
});
|
|
3005
|
+
|
|
3006
|
+
path.onDraw = function(event) {
|
|
3007
|
+
var ctx = event.context,
|
|
3008
|
+
center = this.position,
|
|
3009
|
+
scale = event.matrix.scaling.x;
|
|
3010
|
+
ctx.beginPath();
|
|
3011
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3012
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3013
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3014
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3015
|
+
ctx.lineWidth = 1 / scale;
|
|
3016
|
+
ctx.stroke();
|
|
3017
|
+
}
|
|
3018
|
+
</script>
|
|
3019
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3020
|
+
</div>
|
|
3021
|
+
|
|
3022
|
+
|
|
3023
|
+
</div>
|
|
3024
|
+
|
|
3025
|
+
</div>
|
|
3026
|
+
</div>
|
|
3027
|
+
|
|
3028
|
+
|
|
3029
|
+
<div id="ondrawselection" class="member">
|
|
3030
|
+
<div class="member-link">
|
|
3031
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3032
|
+
</div>
|
|
3033
|
+
<div class="member-description hidden">
|
|
3034
|
+
|
|
3035
|
+
<div class="member-text">
|
|
3036
|
+
<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>
|
|
3037
|
+
|
|
3038
|
+
|
|
3039
|
+
|
|
3040
|
+
<ul class="member-list">
|
|
3041
|
+
<h4>Type:</h4>
|
|
3042
|
+
<li>
|
|
3043
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3044
|
+
</li>
|
|
3045
|
+
</ul>
|
|
3046
|
+
<ul class="member-list">
|
|
3047
|
+
<h4>Options:</h4>
|
|
3048
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3049
|
+
<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>
|
|
3050
|
+
<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>
|
|
3051
|
+
<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>
|
|
3052
|
+
<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>
|
|
3053
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3054
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3055
|
+
</ul>
|
|
3056
|
+
|
|
3057
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3058
|
+
|
|
3059
|
+
<div class="paperscript split">
|
|
3060
|
+
|
|
3061
|
+
<div class="buttons">
|
|
3062
|
+
<div class="button run">Run</div>
|
|
3063
|
+
</div>
|
|
3064
|
+
|
|
3065
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3066
|
+
var path = new Path.Star({
|
|
3067
|
+
center: view.center,
|
|
3068
|
+
points: 5,
|
|
3069
|
+
radius1: 20,
|
|
3070
|
+
radius2: 40,
|
|
3071
|
+
strokeColor: 'black',
|
|
3072
|
+
selected: true
|
|
3073
|
+
});
|
|
3074
|
+
|
|
3075
|
+
path.onDrawSelection = function(event) {
|
|
3076
|
+
var ctx = event.context;
|
|
3077
|
+
this.segments.forEach(function(segment) {
|
|
3078
|
+
var point = event.matrix.transform(segment.point);
|
|
3079
|
+
ctx.beginPath();
|
|
3080
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3081
|
+
ctx.fill();
|
|
3082
|
+
});
|
|
3083
|
+
return false;
|
|
3084
|
+
}
|
|
3085
|
+
</script>
|
|
3086
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3087
|
+
</div>
|
|
3088
|
+
|
|
3089
|
+
|
|
3090
|
+
</div>
|
|
3091
|
+
|
|
3092
|
+
</div>
|
|
3093
|
+
</div>
|
|
3094
|
+
|
|
3095
|
+
</div>
|
|
3096
|
+
|
|
3097
|
+
|
|
3098
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3099
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3100
|
+
|
|
3101
|
+
|
|
3102
|
+
<div id="addeffect-effect" class="member">
|
|
3103
|
+
<div class="member-link">
|
|
3104
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3105
|
+
</div>
|
|
3106
|
+
<div class="member-description hidden">
|
|
3107
|
+
<div class="member-text">
|
|
3108
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3109
|
+
|
|
3110
|
+
|
|
3111
|
+
<ul class="member-list">
|
|
3112
|
+
<h4>Parameters:</h4>
|
|
3113
|
+
|
|
3114
|
+
<li>
|
|
3115
|
+
<tt>effect:</tt>
|
|
3116
|
+
<tt>Object</tt>
|
|
3117
|
+
— the plain object describing the effect
|
|
3118
|
+
|
|
3119
|
+
</li>
|
|
3120
|
+
|
|
3121
|
+
</ul>
|
|
3122
|
+
|
|
3123
|
+
|
|
3124
|
+
<ul class="member-list">
|
|
3125
|
+
<h4>Returns:</h4>
|
|
3126
|
+
|
|
3127
|
+
<li>
|
|
3128
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3129
|
+
</li>
|
|
3130
|
+
|
|
3131
|
+
|
|
3132
|
+
</ul>
|
|
3133
|
+
|
|
3134
|
+
|
|
3135
|
+
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
</div>
|
|
3139
|
+
</div>
|
|
3140
|
+
</div>
|
|
3141
|
+
|
|
3142
|
+
|
|
3143
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3144
|
+
<div class="member-link">
|
|
3145
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3146
|
+
</div>
|
|
3147
|
+
<div class="member-description hidden">
|
|
3148
|
+
<div class="member-text">
|
|
3149
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3150
|
+
|
|
3151
|
+
|
|
3152
|
+
<ul class="member-list">
|
|
3153
|
+
<h4>Parameters:</h4>
|
|
3154
|
+
|
|
3155
|
+
<li>
|
|
3156
|
+
<tt>index:</tt>
|
|
3157
|
+
<tt>Number</tt>
|
|
3158
|
+
— the index at which to insert the effect
|
|
3159
|
+
|
|
3160
|
+
</li>
|
|
3161
|
+
|
|
3162
|
+
<li>
|
|
3163
|
+
<tt>effect:</tt>
|
|
3164
|
+
<tt>Object</tt>
|
|
3165
|
+
— the plain object describing the effect
|
|
3166
|
+
|
|
3167
|
+
</li>
|
|
3168
|
+
|
|
3169
|
+
</ul>
|
|
3170
|
+
|
|
3171
|
+
|
|
3172
|
+
<ul class="member-list">
|
|
3173
|
+
<h4>Returns:</h4>
|
|
3174
|
+
|
|
3175
|
+
<li>
|
|
3176
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3177
|
+
</li>
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
</ul>
|
|
3181
|
+
|
|
3182
|
+
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
|
|
3186
|
+
</div>
|
|
3187
|
+
</div>
|
|
3188
|
+
</div>
|
|
3189
|
+
|
|
3190
|
+
|
|
3191
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3192
|
+
<div class="member-link">
|
|
3193
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3194
|
+
</div>
|
|
3195
|
+
<div class="member-description hidden">
|
|
3196
|
+
<div class="member-text">
|
|
3197
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3198
|
+
|
|
3199
|
+
|
|
3200
|
+
<ul class="member-list">
|
|
3201
|
+
<h4>Parameters:</h4>
|
|
3202
|
+
|
|
3203
|
+
<li>
|
|
3204
|
+
<tt>index:</tt>
|
|
3205
|
+
<tt>Number</tt>
|
|
3206
|
+
— the index at which to insert the effects
|
|
3207
|
+
|
|
3208
|
+
</li>
|
|
3209
|
+
|
|
3210
|
+
<li>
|
|
3211
|
+
<tt>effects:</tt>
|
|
3212
|
+
Array of <tt>Object</tt> objects
|
|
3213
|
+
— the plain objects describing the effects
|
|
3214
|
+
|
|
3215
|
+
</li>
|
|
3216
|
+
|
|
3217
|
+
</ul>
|
|
3218
|
+
|
|
3219
|
+
|
|
3220
|
+
<ul class="member-list">
|
|
3221
|
+
<h4>Returns:</h4>
|
|
3222
|
+
|
|
3223
|
+
<li>
|
|
3224
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3225
|
+
</li>
|
|
3226
|
+
|
|
3227
|
+
|
|
3228
|
+
</ul>
|
|
2682
3229
|
|
|
2683
3230
|
|
|
2684
|
-
</div>
|
|
2685
3231
|
|
|
3232
|
+
|
|
3233
|
+
|
|
3234
|
+
</div>
|
|
2686
3235
|
</div>
|
|
2687
3236
|
</div>
|
|
2688
3237
|
|
|
2689
3238
|
|
|
2690
|
-
<div id="
|
|
3239
|
+
<div id="removeeffect-index" class="member">
|
|
2691
3240
|
<div class="member-link">
|
|
2692
|
-
<a name="
|
|
3241
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
2693
3242
|
</div>
|
|
2694
3243
|
<div class="member-description hidden">
|
|
2695
|
-
|
|
2696
3244
|
<div class="member-text">
|
|
2697
|
-
<p>
|
|
3245
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3246
|
+
|
|
2698
3247
|
|
|
3248
|
+
<ul class="member-list">
|
|
3249
|
+
<h4>Parameters:</h4>
|
|
2699
3250
|
|
|
3251
|
+
<li>
|
|
3252
|
+
<tt>index:</tt>
|
|
3253
|
+
<tt>Number</tt>
|
|
3254
|
+
— the index of the effect to remove
|
|
3255
|
+
|
|
3256
|
+
</li>
|
|
2700
3257
|
|
|
2701
|
-
|
|
2702
|
-
|
|
2703
|
-
<li>
|
|
2704
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2705
|
-
</li>
|
|
2706
|
-
</ul>
|
|
2707
|
-
|
|
3258
|
+
</ul>
|
|
3259
|
+
|
|
2708
3260
|
|
|
2709
3261
|
<ul class="member-list">
|
|
2710
|
-
<h4>
|
|
3262
|
+
<h4>Returns:</h4>
|
|
2711
3263
|
|
|
2712
|
-
<li
|
|
3264
|
+
<li>
|
|
3265
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3266
|
+
</li>
|
|
3267
|
+
|
|
2713
3268
|
|
|
2714
3269
|
</ul>
|
|
2715
3270
|
|
|
2716
|
-
<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>
|
|
2717
3271
|
|
|
2718
|
-
<div class="paperscript split">
|
|
2719
3272
|
|
|
2720
|
-
|
|
2721
|
-
|
|
3273
|
+
|
|
3274
|
+
|
|
2722
3275
|
</div>
|
|
2723
|
-
|
|
2724
|
-
<script type="text/paperscript" canvas="canvas-31">
|
|
2725
|
-
// Create a circle shaped path at the center of the view:
|
|
2726
|
-
var path = new Path.Circle({
|
|
2727
|
-
center: view.center,
|
|
2728
|
-
radius: 25,
|
|
2729
|
-
fillColor: 'black'
|
|
2730
|
-
});
|
|
2731
|
-
|
|
2732
|
-
// When the mouse enters the item, set its fill color to red:
|
|
2733
|
-
path.onMouseEnter = function(event) {
|
|
2734
|
-
this.fillColor = 'red';
|
|
2735
|
-
}
|
|
2736
|
-
|
|
2737
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2738
|
-
path.onMouseLeave = function(event) {
|
|
2739
|
-
this.fillColor = 'black';
|
|
2740
|
-
}
|
|
2741
|
-
</script>
|
|
2742
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2743
3276
|
</div>
|
|
2744
|
-
|
|
2745
|
-
|
|
2746
|
-
<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>
|
|
2747
|
-
|
|
2748
|
-
<div class="paperscript split">
|
|
2749
|
-
|
|
2750
|
-
<div class="buttons">
|
|
2751
|
-
<div class="button run">Run</div>
|
|
2752
3277
|
</div>
|
|
2753
3278
|
|
|
2754
|
-
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
3279
|
+
|
|
3280
|
+
<div id="removeeffects" class="member">
|
|
3281
|
+
<div class="member-link">
|
|
3282
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
3283
|
+
</div>
|
|
3284
|
+
<div class="member-description hidden">
|
|
3285
|
+
<div class="member-text">
|
|
3286
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3287
|
+
|
|
3288
|
+
|
|
3289
|
+
<ul class="member-list">
|
|
3290
|
+
<h4>Parameters:</h4>
|
|
3291
|
+
|
|
3292
|
+
<li>
|
|
3293
|
+
<tt>start:</tt>
|
|
3294
|
+
<tt>Number</tt>
|
|
3295
|
+
— the index of the first effect to remove
|
|
3296
|
+
— optional, default: <tt>0</tt>
|
|
3297
|
+
</li>
|
|
3298
|
+
|
|
3299
|
+
<li>
|
|
3300
|
+
<tt>end:</tt>
|
|
3301
|
+
<tt>Number</tt>
|
|
3302
|
+
— the index after the last one
|
|
3303
|
+
— optional, default: <tt>effects.length</tt>
|
|
3304
|
+
</li>
|
|
3305
|
+
|
|
3306
|
+
</ul>
|
|
2762
3307
|
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
|
|
3308
|
+
|
|
3309
|
+
<ul class="member-list">
|
|
3310
|
+
<h4>Returns:</h4>
|
|
3311
|
+
|
|
3312
|
+
<li>
|
|
3313
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3314
|
+
</li>
|
|
2768
3315
|
|
|
2769
|
-
|
|
2770
|
-
|
|
3316
|
+
|
|
3317
|
+
</ul>
|
|
2771
3318
|
|
|
2772
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2773
|
-
path.onMouseLeave = leave;
|
|
2774
|
-
}
|
|
2775
|
-
</script>
|
|
2776
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2777
|
-
</div>
|
|
2778
3319
|
|
|
2779
3320
|
|
|
3321
|
+
|
|
3322
|
+
|
|
2780
3323
|
</div>
|
|
2781
|
-
|
|
2782
3324
|
</div>
|
|
2783
3325
|
</div>
|
|
2784
3326
|
|
|
2785
3327
|
|
|
2786
|
-
<div id="
|
|
3328
|
+
<div id="geteffectoutput" class="member">
|
|
2787
3329
|
<div class="member-link">
|
|
2788
|
-
<a name="
|
|
3330
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
2789
3331
|
</div>
|
|
2790
3332
|
<div class="member-description hidden">
|
|
2791
|
-
|
|
2792
3333
|
<div class="member-text">
|
|
2793
|
-
<p>
|
|
2794
|
-
|
|
2795
|
-
|
|
2796
|
-
|
|
2797
|
-
<ul class="member-list">
|
|
2798
|
-
<h4>Type:</h4>
|
|
2799
|
-
<li>
|
|
2800
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2801
|
-
</li>
|
|
2802
|
-
</ul>
|
|
3334
|
+
<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>
|
|
2803
3335
|
|
|
2804
3336
|
|
|
3337
|
+
|
|
2805
3338
|
<ul class="member-list">
|
|
2806
|
-
<h4>
|
|
3339
|
+
<h4>Returns:</h4>
|
|
2807
3340
|
|
|
2808
|
-
<li
|
|
3341
|
+
<li>
|
|
3342
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3343
|
+
</li>
|
|
3344
|
+
|
|
2809
3345
|
|
|
2810
3346
|
</ul>
|
|
2811
3347
|
|
|
2812
|
-
<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>
|
|
2813
|
-
|
|
2814
|
-
<div class="paperscript split">
|
|
2815
|
-
|
|
2816
|
-
<div class="buttons">
|
|
2817
|
-
<div class="button run">Run</div>
|
|
2818
|
-
</div>
|
|
2819
|
-
|
|
2820
|
-
<script type="text/paperscript" canvas="canvas-33">
|
|
2821
|
-
// Create a circle shaped path at the center of the view:
|
|
2822
|
-
var path = new Path.Circle({
|
|
2823
|
-
center: view.center,
|
|
2824
|
-
radius: 25,
|
|
2825
|
-
fillColor: 'black'
|
|
2826
|
-
});
|
|
2827
|
-
|
|
2828
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
2829
|
-
path.onMouseLeave = function(event) {
|
|
2830
|
-
this.fillColor = 'red';
|
|
2831
|
-
}
|
|
2832
|
-
</script>
|
|
2833
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2834
|
-
</div>
|
|
2835
|
-
|
|
2836
3348
|
|
|
2837
|
-
</div>
|
|
2838
3349
|
|
|
3350
|
+
|
|
3351
|
+
|
|
2839
3352
|
</div>
|
|
2840
3353
|
</div>
|
|
2841
|
-
|
|
2842
3354
|
</div>
|
|
2843
3355
|
|
|
2844
|
-
|
|
2845
|
-
<!-- =========================== inherited methods ========================= -->
|
|
2846
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
2847
|
-
|
|
2848
3356
|
|
|
2849
3357
|
<div id="set-props" class="member">
|
|
2850
3358
|
<div class="member-link">
|
|
@@ -2889,7 +3397,7 @@ path.onMouseLeave = function(event) {
|
|
|
2889
3397
|
<div class="button run">Run</div>
|
|
2890
3398
|
</div>
|
|
2891
3399
|
|
|
2892
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3400
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
2893
3401
|
var circle = new Path.Circle({
|
|
2894
3402
|
center: [80, 50],
|
|
2895
3403
|
radius: 35
|
|
@@ -2902,7 +3410,7 @@ circle.set({
|
|
|
2902
3410
|
selected: true
|
|
2903
3411
|
});
|
|
2904
3412
|
</script>
|
|
2905
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3413
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
2906
3414
|
</div>
|
|
2907
3415
|
|
|
2908
3416
|
|
|
@@ -2958,7 +3466,7 @@ circle.set({
|
|
|
2958
3466
|
<div class="button run">Run</div>
|
|
2959
3467
|
</div>
|
|
2960
3468
|
|
|
2961
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3469
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
2962
3470
|
var circle = new Path.Circle({
|
|
2963
3471
|
center: [50, 50],
|
|
2964
3472
|
radius: 10,
|
|
@@ -2973,7 +3481,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
2973
3481
|
copy.position.x += i * copy.bounds.width;
|
|
2974
3482
|
}
|
|
2975
3483
|
</script>
|
|
2976
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3484
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
2977
3485
|
</div>
|
|
2978
3486
|
|
|
2979
3487
|
|
|
@@ -3099,7 +3607,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3099
3607
|
<div class="button run">Run</div>
|
|
3100
3608
|
</div>
|
|
3101
3609
|
|
|
3102
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3610
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3103
3611
|
var circle = new Path.Circle({
|
|
3104
3612
|
center: [50, 50],
|
|
3105
3613
|
radius: 5,
|
|
@@ -3116,7 +3624,7 @@ raster.position.x += 100;
|
|
|
3116
3624
|
circle.scale(5);
|
|
3117
3625
|
raster.scale(5);
|
|
3118
3626
|
</script>
|
|
3119
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3627
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3120
3628
|
</div>
|
|
3121
3629
|
|
|
3122
3630
|
|
|
@@ -3170,7 +3678,7 @@ raster.scale(5);
|
|
|
3170
3678
|
<div class="button run">Run</div>
|
|
3171
3679
|
</div>
|
|
3172
3680
|
|
|
3173
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3681
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3174
3682
|
var path = new Path.Star({
|
|
3175
3683
|
center: [50, 50],
|
|
3176
3684
|
points: 12,
|
|
@@ -3191,7 +3699,7 @@ function onMouseDown(event) {
|
|
|
3191
3699
|
}
|
|
3192
3700
|
}
|
|
3193
3701
|
</script>
|
|
3194
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3702
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3195
3703
|
</div>
|
|
3196
3704
|
|
|
3197
3705
|
|
|
@@ -3709,11 +4217,17 @@ function onMouseDown(event) {
|
|
|
3709
4217
|
</div>
|
|
3710
4218
|
<div class="member-description hidden">
|
|
3711
4219
|
<div class="member-text">
|
|
3712
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4220
|
+
<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>
|
|
3713
4221
|
<ul class="member-list">
|
|
3714
4222
|
<h4>Options:</h4>
|
|
3715
|
-
<li
|
|
3716
|
-
|
|
4223
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4224
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4225
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4226
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4227
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4228
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4229
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4230
|
+
`options.bounds` the identity matrix is used.</li>
|
|
3717
4231
|
<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>
|
|
3718
4232
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
3719
4233
|
<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>
|
|
@@ -3721,6 +4235,12 @@ function onMouseDown(event) {
|
|
|
3721
4235
|
<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>
|
|
3722
4236
|
<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>
|
|
3723
4237
|
<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>
|
|
4238
|
+
<li>[options.processNode] {Function} the function to process the
|
|
4239
|
+
SVG node made for each exported item, receiving an object with the
|
|
4240
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
4241
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
4242
|
+
is called before the item's name, style, visibility and data are set
|
|
4243
|
+
on the node, which replace attributes of the same names.</li>
|
|
3724
4244
|
</ul>
|
|
3725
4245
|
|
|
3726
4246
|
<ul class="member-list">
|
|
@@ -3763,6 +4283,7 @@ function onMouseDown(event) {
|
|
|
3763
4283
|
<div class="member-text">
|
|
3764
4284
|
<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>
|
|
3765
4285
|
<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>
|
|
4286
|
+
<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>
|
|
3766
4287
|
<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>
|
|
3767
4288
|
<ul class="member-list">
|
|
3768
4289
|
<h4>Options:</h4>
|
|
@@ -3774,6 +4295,13 @@ function onMouseDown(event) {
|
|
|
3774
4295
|
<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>
|
|
3775
4296
|
<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>
|
|
3776
4297
|
<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>
|
|
4298
|
+
<li>[options.processItem] {Function} the function to process the
|
|
4299
|
+
item made for each imported SVG element, receiving an object with
|
|
4300
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
4301
|
+
doesn't import, or return an item to replace it with. It is called
|
|
4302
|
+
after the element's attributes and data are applied to the item, so
|
|
4303
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
4304
|
+
copy them over from `item` as needed.</li>
|
|
3777
4305
|
</ul>
|
|
3778
4306
|
|
|
3779
4307
|
<ul class="member-list">
|
|
@@ -5053,7 +5581,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5053
5581
|
<div class="button run">Run</div>
|
|
5054
5582
|
</div>
|
|
5055
5583
|
|
|
5056
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5584
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
5057
5585
|
// Create a rectangle shaped path with its top left
|
|
5058
5586
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5059
5587
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5062,7 +5590,7 @@ path.fillColor = 'black';
|
|
|
5062
5590
|
// Rotate the path by 30 degrees:
|
|
5063
5591
|
path.rotate(30);
|
|
5064
5592
|
</script>
|
|
5065
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5593
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
5066
5594
|
</div>
|
|
5067
5595
|
|
|
5068
5596
|
|
|
@@ -5074,7 +5602,7 @@ path.rotate(30);
|
|
|
5074
5602
|
<div class="button run">Run</div>
|
|
5075
5603
|
</div>
|
|
5076
5604
|
|
|
5077
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5605
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
5078
5606
|
// Create a rectangle shaped path with its top left
|
|
5079
5607
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5080
5608
|
var topLeft = new Point(175, 50);
|
|
@@ -5096,7 +5624,7 @@ function onFrame(event) {
|
|
|
5096
5624
|
path.rotate(3, view.center);
|
|
5097
5625
|
}
|
|
5098
5626
|
</script>
|
|
5099
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5627
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-42"></canvas></div>
|
|
5100
5628
|
</div>
|
|
5101
5629
|
|
|
5102
5630
|
|
|
@@ -5145,7 +5673,7 @@ function onFrame(event) {
|
|
|
5145
5673
|
<div class="button run">Run</div>
|
|
5146
5674
|
</div>
|
|
5147
5675
|
|
|
5148
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5676
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5149
5677
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5150
5678
|
// with a radius of 20:
|
|
5151
5679
|
var circle = new Path.Circle({
|
|
@@ -5157,7 +5685,7 @@ var circle = new Path.Circle({
|
|
|
5157
5685
|
// Scale the path by 150% from its center point
|
|
5158
5686
|
circle.scale(1.5);
|
|
5159
5687
|
</script>
|
|
5160
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5688
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
5161
5689
|
</div>
|
|
5162
5690
|
|
|
5163
5691
|
|
|
@@ -5169,7 +5697,7 @@ circle.scale(1.5);
|
|
|
5169
5697
|
<div class="button run">Run</div>
|
|
5170
5698
|
</div>
|
|
5171
5699
|
|
|
5172
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5700
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5173
5701
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5174
5702
|
// with a radius of 20:
|
|
5175
5703
|
var circle = new Path.Circle({
|
|
@@ -5181,7 +5709,7 @@ var circle = new Path.Circle({
|
|
|
5181
5709
|
// Scale the path 150% from its bottom left corner
|
|
5182
5710
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5183
5711
|
</script>
|
|
5184
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5712
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
5185
5713
|
</div>
|
|
5186
5714
|
|
|
5187
5715
|
|
|
@@ -5237,7 +5765,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5237
5765
|
<div class="button run">Run</div>
|
|
5238
5766
|
</div>
|
|
5239
5767
|
|
|
5240
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5768
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5241
5769
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5242
5770
|
// with a radius of 20:
|
|
5243
5771
|
var circle = new Path.Circle({
|
|
@@ -5249,7 +5777,7 @@ var circle = new Path.Circle({
|
|
|
5249
5777
|
// Scale the path horizontally by 300%
|
|
5250
5778
|
circle.scale(3, 1);
|
|
5251
5779
|
</script>
|
|
5252
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5780
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5253
5781
|
</div>
|
|
5254
5782
|
|
|
5255
5783
|
|
|
@@ -5687,7 +6215,7 @@ circle.scale(3, 1);
|
|
|
5687
6215
|
<div class="button run">Run</div>
|
|
5688
6216
|
</div>
|
|
5689
6217
|
|
|
5690
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6218
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5691
6219
|
// Create a rectangle shaped path with its top left corner
|
|
5692
6220
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5693
6221
|
var path = new Path.Rectangle({
|
|
@@ -5708,7 +6236,7 @@ var circlePath = new Path.Circle({
|
|
|
5708
6236
|
// the rectangular path:
|
|
5709
6237
|
circlePath.fitBounds(path.bounds);
|
|
5710
6238
|
</script>
|
|
5711
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6239
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5712
6240
|
</div>
|
|
5713
6241
|
|
|
5714
6242
|
|
|
@@ -5720,7 +6248,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5720
6248
|
<div class="button run">Run</div>
|
|
5721
6249
|
</div>
|
|
5722
6250
|
|
|
5723
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6251
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5724
6252
|
// Create a rectangle shaped path with its top left corner
|
|
5725
6253
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5726
6254
|
var path = new Path.Rectangle({
|
|
@@ -5741,7 +6269,7 @@ var circlePath = new Path.Circle({
|
|
|
5741
6269
|
// the rectangular path:
|
|
5742
6270
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
5743
6271
|
</script>
|
|
5744
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6272
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5745
6273
|
</div>
|
|
5746
6274
|
|
|
5747
6275
|
|
|
@@ -5753,7 +6281,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
5753
6281
|
<div class="button run">Run</div>
|
|
5754
6282
|
</div>
|
|
5755
6283
|
|
|
5756
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6284
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5757
6285
|
var path = new Path.Circle({
|
|
5758
6286
|
center: [80, 50],
|
|
5759
6287
|
radius: 30,
|
|
@@ -5763,7 +6291,7 @@ var path = new Path.Circle({
|
|
|
5763
6291
|
// Fit the path to the bounding rectangle of the view:
|
|
5764
6292
|
path.fitBounds(view.bounds);
|
|
5765
6293
|
</script>
|
|
5766
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6294
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-48"></canvas></div>
|
|
5767
6295
|
</div>
|
|
5768
6296
|
|
|
5769
6297
|
|
|
@@ -5789,7 +6317,7 @@ path.fitBounds(view.bounds);
|
|
|
5789
6317
|
<li>
|
|
5790
6318
|
<tt>type:</tt>
|
|
5791
6319
|
<tt>String</tt>
|
|
5792
|
-
— 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>
|
|
6320
|
+
— 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>
|
|
5793
6321
|
|
|
5794
6322
|
</li>
|
|
5795
6323
|
|
|
@@ -5824,7 +6352,7 @@ path.fitBounds(view.bounds);
|
|
|
5824
6352
|
<div class="button run">Run</div>
|
|
5825
6353
|
</div>
|
|
5826
6354
|
|
|
5827
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6355
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
5828
6356
|
// Create a circle shaped path at the center of the view:
|
|
5829
6357
|
var path = new Path.Circle({
|
|
5830
6358
|
center: view.center,
|
|
@@ -5842,7 +6370,7 @@ path.on('mouseleave', function() {
|
|
|
5842
6370
|
this.fillColor = 'black';
|
|
5843
6371
|
});
|
|
5844
6372
|
</script>
|
|
5845
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6373
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
5846
6374
|
</div>
|
|
5847
6375
|
|
|
5848
6376
|
|
|
@@ -5866,7 +6394,7 @@ path.on('mouseleave', function() {
|
|
|
5866
6394
|
<li>
|
|
5867
6395
|
<tt>object:</tt>
|
|
5868
6396
|
<tt>Object</tt>
|
|
5869
|
-
— 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>
|
|
6397
|
+
— 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>
|
|
5870
6398
|
|
|
5871
6399
|
</li>
|
|
5872
6400
|
|
|
@@ -5894,7 +6422,7 @@ path.on('mouseleave', function() {
|
|
|
5894
6422
|
<div class="button run">Run</div>
|
|
5895
6423
|
</div>
|
|
5896
6424
|
|
|
5897
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6425
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
5898
6426
|
// Create a circle shaped path at the center of the view:
|
|
5899
6427
|
var path = new Path.Circle({
|
|
5900
6428
|
center: view.center,
|
|
@@ -5912,7 +6440,7 @@ path.on({
|
|
|
5912
6440
|
}
|
|
5913
6441
|
});
|
|
5914
6442
|
</script>
|
|
5915
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6443
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
5916
6444
|
</div>
|
|
5917
6445
|
|
|
5918
6446
|
|
|
@@ -5924,7 +6452,7 @@ path.on({
|
|
|
5924
6452
|
<div class="button run">Run</div>
|
|
5925
6453
|
</div>
|
|
5926
6454
|
|
|
5927
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6455
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
5928
6456
|
var pathHandlers = {
|
|
5929
6457
|
mouseenter: function(event) {
|
|
5930
6458
|
this.fillColor = 'red';
|
|
@@ -5947,7 +6475,7 @@ function onMouseDown(event) {
|
|
|
5947
6475
|
path.on(pathHandlers);
|
|
5948
6476
|
}
|
|
5949
6477
|
</script>
|
|
5950
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6478
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
5951
6479
|
</div>
|
|
5952
6480
|
|
|
5953
6481
|
|
|
@@ -5971,7 +6499,7 @@ function onMouseDown(event) {
|
|
|
5971
6499
|
<li>
|
|
5972
6500
|
<tt>type:</tt>
|
|
5973
6501
|
<tt>String</tt>
|
|
5974
|
-
— 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>
|
|
6502
|
+
— 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>
|
|
5975
6503
|
|
|
5976
6504
|
</li>
|
|
5977
6505
|
|
|
@@ -6019,7 +6547,7 @@ function onMouseDown(event) {
|
|
|
6019
6547
|
<li>
|
|
6020
6548
|
<tt>object:</tt>
|
|
6021
6549
|
<tt>Object</tt>
|
|
6022
|
-
— 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>
|
|
6550
|
+
— 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>
|
|
6023
6551
|
|
|
6024
6552
|
</li>
|
|
6025
6553
|
|
|
@@ -6060,7 +6588,7 @@ function onMouseDown(event) {
|
|
|
6060
6588
|
<li>
|
|
6061
6589
|
<tt>type:</tt>
|
|
6062
6590
|
<tt>String</tt>
|
|
6063
|
-
— 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>
|
|
6591
|
+
— 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>
|
|
6064
6592
|
|
|
6065
6593
|
</li>
|
|
6066
6594
|
|
|
@@ -6108,7 +6636,7 @@ function onMouseDown(event) {
|
|
|
6108
6636
|
<li>
|
|
6109
6637
|
<tt>type:</tt>
|
|
6110
6638
|
<tt>String</tt>
|
|
6111
|
-
— 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>
|
|
6639
|
+
— 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>
|
|
6112
6640
|
|
|
6113
6641
|
</li>
|
|
6114
6642
|
|
|
@@ -6175,7 +6703,7 @@ function onMouseDown(event) {
|
|
|
6175
6703
|
<div class="button run">Run</div>
|
|
6176
6704
|
</div>
|
|
6177
6705
|
|
|
6178
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6706
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6179
6707
|
function onMouseDrag(event) {
|
|
6180
6708
|
// Create a circle shaped path at the mouse position,
|
|
6181
6709
|
// with a radius of 10:
|
|
@@ -6192,7 +6720,7 @@ function onMouseDrag(event) {
|
|
|
6192
6720
|
});
|
|
6193
6721
|
}
|
|
6194
6722
|
</script>
|
|
6195
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6723
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
|
|
6196
6724
|
</div>
|
|
6197
6725
|
|
|
6198
6726
|
|
|
@@ -6222,7 +6750,7 @@ function onMouseDrag(event) {
|
|
|
6222
6750
|
<div class="button run">Run</div>
|
|
6223
6751
|
</div>
|
|
6224
6752
|
|
|
6225
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6753
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6226
6754
|
function onMouseMove(event) {
|
|
6227
6755
|
// Create a circle shaped path at the mouse position,
|
|
6228
6756
|
// with a radius of 10:
|
|
@@ -6236,7 +6764,7 @@ function onMouseMove(event) {
|
|
|
6236
6764
|
path.removeOnMove();
|
|
6237
6765
|
}
|
|
6238
6766
|
</script>
|
|
6239
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6767
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
|
|
6240
6768
|
</div>
|
|
6241
6769
|
|
|
6242
6770
|
|
|
@@ -6266,7 +6794,7 @@ function onMouseMove(event) {
|
|
|
6266
6794
|
<div class="button run">Run</div>
|
|
6267
6795
|
</div>
|
|
6268
6796
|
|
|
6269
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6797
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6270
6798
|
function onMouseDown(event) {
|
|
6271
6799
|
// Create a circle shaped path at the mouse position,
|
|
6272
6800
|
// with a radius of 10:
|
|
@@ -6280,7 +6808,7 @@ function onMouseDown(event) {
|
|
|
6280
6808
|
path.removeOnDown();
|
|
6281
6809
|
}
|
|
6282
6810
|
</script>
|
|
6283
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6811
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6284
6812
|
</div>
|
|
6285
6813
|
|
|
6286
6814
|
|
|
@@ -6310,7 +6838,7 @@ function onMouseDown(event) {
|
|
|
6310
6838
|
<div class="button run">Run</div>
|
|
6311
6839
|
</div>
|
|
6312
6840
|
|
|
6313
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6841
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6314
6842
|
function onMouseDrag(event) {
|
|
6315
6843
|
// Create a circle shaped path at the mouse position,
|
|
6316
6844
|
// with a radius of 10:
|
|
@@ -6324,7 +6852,7 @@ function onMouseDrag(event) {
|
|
|
6324
6852
|
path.removeOnDrag();
|
|
6325
6853
|
}
|
|
6326
6854
|
</script>
|
|
6327
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6855
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6328
6856
|
</div>
|
|
6329
6857
|
|
|
6330
6858
|
|
|
@@ -6354,7 +6882,7 @@ function onMouseDrag(event) {
|
|
|
6354
6882
|
<div class="button run">Run</div>
|
|
6355
6883
|
</div>
|
|
6356
6884
|
|
|
6357
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6885
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6358
6886
|
function onMouseDown(event) {
|
|
6359
6887
|
// Create a circle shaped path at the mouse position,
|
|
6360
6888
|
// with a radius of 10:
|
|
@@ -6368,7 +6896,7 @@ function onMouseDown(event) {
|
|
|
6368
6896
|
path.removeOnUp();
|
|
6369
6897
|
}
|
|
6370
6898
|
</script>
|
|
6371
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6899
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6372
6900
|
</div>
|
|
6373
6901
|
|
|
6374
6902
|
|
|
@@ -6441,7 +6969,7 @@ function onMouseDown(event) {
|
|
|
6441
6969
|
<div class="button run">Run</div>
|
|
6442
6970
|
</div>
|
|
6443
6971
|
|
|
6444
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6972
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6445
6973
|
var path = new Path.Circle({
|
|
6446
6974
|
radius: view.bounds.height * 0.4,
|
|
6447
6975
|
center: view.center
|
|
@@ -6452,7 +6980,7 @@ path.tween(
|
|
|
6452
6980
|
3000
|
|
6453
6981
|
);
|
|
6454
6982
|
</script>
|
|
6455
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6983
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
|
|
6456
6984
|
</div>
|
|
6457
6985
|
|
|
6458
6986
|
|
|
@@ -6464,7 +6992,7 @@ path.tween(
|
|
|
6464
6992
|
<div class="button run">Run</div>
|
|
6465
6993
|
</div>
|
|
6466
6994
|
|
|
6467
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6995
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6468
6996
|
var path = new Shape.Rectangle({
|
|
6469
6997
|
fillColor: 'red',
|
|
6470
6998
|
center: [50, view.center.y],
|
|
@@ -6479,7 +7007,7 @@ path.tween({
|
|
|
6479
7007
|
duration: 2000
|
|
6480
7008
|
});
|
|
6481
7009
|
</script>
|
|
6482
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7010
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
6483
7011
|
</div>
|
|
6484
7012
|
|
|
6485
7013
|
|
|
@@ -6545,7 +7073,7 @@ path.tween({
|
|
|
6545
7073
|
<div class="button run">Run</div>
|
|
6546
7074
|
</div>
|
|
6547
7075
|
|
|
6548
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7076
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6549
7077
|
var path = new Path.Rectangle({
|
|
6550
7078
|
size: [100, 100],
|
|
6551
7079
|
position: view.center,
|
|
@@ -6559,7 +7087,7 @@ path.tween({
|
|
|
6559
7087
|
'segments[2].point.x': '-= 50'
|
|
6560
7088
|
}, 3000);
|
|
6561
7089
|
</script>
|
|
6562
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7090
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
|
|
6563
7091
|
</div>
|
|
6564
7092
|
|
|
6565
7093
|
|
|
@@ -6618,7 +7146,7 @@ path.tween({
|
|
|
6618
7146
|
<div class="button run">Run</div>
|
|
6619
7147
|
</div>
|
|
6620
7148
|
|
|
6621
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7149
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6622
7150
|
var path = new Path.Circle({
|
|
6623
7151
|
fillColor: 'blue',
|
|
6624
7152
|
radius: view.bounds.height * 0.4,
|
|
@@ -6634,7 +7162,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6634
7162
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6635
7163
|
};
|
|
6636
7164
|
</script>
|
|
6637
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7165
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
|
|
6638
7166
|
</div>
|
|
6639
7167
|
|
|
6640
7168
|
|
|
@@ -6755,7 +7283,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6755
7283
|
<div class="button run">Run</div>
|
|
6756
7284
|
</div>
|
|
6757
7285
|
|
|
6758
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7286
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6759
7287
|
var path = new Path.Circle({
|
|
6760
7288
|
fillColor: 'blue',
|
|
6761
7289
|
radius: view.bounds.height * 0.4,
|
|
@@ -6763,7 +7291,7 @@ var path = new Path.Circle({
|
|
|
6763
7291
|
});
|
|
6764
7292
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
6765
7293
|
</script>
|
|
6766
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7294
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
6767
7295
|
</div>
|
|
6768
7296
|
|
|
6769
7297
|
|
|
@@ -6777,7 +7305,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
6777
7305
|
|
|
6778
7306
|
<!-- =========================== copyright notice ========================== -->
|
|
6779
7307
|
<p class="footer">
|
|
6780
|
-
Paper.js v0.
|
|
7308
|
+
Paper.js v0.17.0<br>
|
|
6781
7309
|
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>
|
|
6782
7310
|
<div class="content-end"></div>
|
|
6783
7311
|
|