paper 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/dist/docs/assets/js/paper.js +4565 -733
- package/dist/docs/classes/AreaText.html +720 -242
- package/dist/docs/classes/ChangeFlag.html +1 -1
- package/dist/docs/classes/Color.html +218 -21
- package/dist/docs/classes/CompoundPath.html +1146 -296
- package/dist/docs/classes/Curve.html +1 -1
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/DrawEvent.html +69 -0
- package/dist/docs/classes/Effect.html +434 -0
- package/dist/docs/classes/EffectInstance.html +304 -0
- package/dist/docs/classes/Event.html +1 -1
- package/dist/docs/classes/Gradient.html +1 -1
- package/dist/docs/classes/GradientStop.html +1 -1
- package/dist/docs/classes/Group.html +792 -243
- package/dist/docs/classes/HitResult.html +1 -1
- package/dist/docs/classes/HostItem.html +720 -242
- package/dist/docs/classes/Item.html +777 -242
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +734 -185
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +1 -1
- package/dist/docs/classes/PaperScript.html +4 -2
- package/dist/docs/classes/Path.html +1195 -252
- package/dist/docs/classes/PathItem.html +1148 -298
- package/dist/docs/classes/PathText.html +720 -242
- package/dist/docs/classes/PatternDefinition.html +367 -0
- package/dist/docs/classes/Point.html +1 -1
- package/dist/docs/classes/PointText.html +720 -242
- package/dist/docs/classes/Project.html +177 -7
- package/dist/docs/classes/Raster.html +720 -242
- package/dist/docs/classes/Rectangle.html +1 -1
- package/dist/docs/classes/Segment.html +3 -3
- package/dist/docs/classes/Shape.html +720 -242
- package/dist/docs/classes/Size.html +1 -1
- package/dist/docs/classes/StrokeProfileStop.html +346 -0
- package/dist/docs/classes/Style.html +1 -1
- package/dist/docs/classes/SymbolDefinition.html +28 -2
- package/dist/docs/classes/SymbolItem.html +720 -242
- package/dist/docs/classes/TextItem.html +720 -242
- package/dist/docs/classes/TextRange.html +1 -1
- package/dist/docs/classes/TextStory.html +1 -1
- package/dist/docs/classes/Tool.html +2 -2
- package/dist/docs/classes/ToolEvent.html +1 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +2 -2
- package/dist/docs/classes/global.html +1 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/node/browser.js +15 -0
- package/dist/paper-core.js +4476 -674
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +4565 -733
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +5111 -823
- package/dist/paper.d.ts +898 -47
- package/examples/Paperjs.org/LiveEffects.html +366 -0
- package/examples/Paperjs.org/Offsetting.html +379 -0
- package/examples/Paperjs.org/StrokeProfiles.html +706 -0
- package/examples/Scripts/Patterns.html +57 -0
- package/package.json +5 -3
|
@@ -29,6 +29,91 @@
|
|
|
29
29
|
<h2>Properties</h2>
|
|
30
30
|
|
|
31
31
|
|
|
32
|
+
<div id="effects" class="member">
|
|
33
|
+
<div class="member-link">
|
|
34
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
35
|
+
</div>
|
|
36
|
+
<div class="member-description hidden">
|
|
37
|
+
|
|
38
|
+
<div class="member-text">
|
|
39
|
+
<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,
|
|
40
|
+
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>
|
|
41
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
42
|
+
<ul>
|
|
43
|
+
<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>
|
|
44
|
+
<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>
|
|
45
|
+
</ul>
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
|
|
49
|
+
<ul class="member-list">
|
|
50
|
+
<h4>Type:</h4>
|
|
51
|
+
<li>
|
|
52
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
53
|
+
</li>
|
|
54
|
+
</ul>
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
<h4>Example:</h4>
|
|
58
|
+
|
|
59
|
+
<div class="paperscript split">
|
|
60
|
+
|
|
61
|
+
<div class="buttons">
|
|
62
|
+
<div class="button run">Run</div>
|
|
63
|
+
</div>
|
|
64
|
+
|
|
65
|
+
<script type="text/paperscript" canvas="canvas-0">
|
|
66
|
+
var path = new Path.Star({
|
|
67
|
+
center: view.center,
|
|
68
|
+
points: 5,
|
|
69
|
+
radius1: 20,
|
|
70
|
+
radius2: 40,
|
|
71
|
+
strokeColor: 'black',
|
|
72
|
+
strokeWidth: 8
|
|
73
|
+
});
|
|
74
|
+
path.effects = [
|
|
75
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
76
|
+
{ type: 'outline' }
|
|
77
|
+
];
|
|
78
|
+
</script>
|
|
79
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-0"></canvas></div>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
|
|
83
|
+
</div>
|
|
84
|
+
|
|
85
|
+
</div>
|
|
86
|
+
</div>
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
<div id="previewbounds-matrix" class="member">
|
|
90
|
+
<div class="member-link">
|
|
91
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
92
|
+
</div>
|
|
93
|
+
<div class="member-description hidden">
|
|
94
|
+
|
|
95
|
+
<div class="member-text">
|
|
96
|
+
<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>
|
|
97
|
+
|
|
98
|
+
<p>Read only.</p>
|
|
99
|
+
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
<ul class="member-list">
|
|
103
|
+
<h4>Type:</h4>
|
|
104
|
+
<li>
|
|
105
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
106
|
+
</li>
|
|
107
|
+
</ul>
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
</div>
|
|
114
|
+
</div>
|
|
115
|
+
|
|
116
|
+
|
|
32
117
|
<div id="key" class="member">
|
|
33
118
|
<div class="member-link">
|
|
34
119
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -141,7 +226,7 @@
|
|
|
141
226
|
<div class="button run">Run</div>
|
|
142
227
|
</div>
|
|
143
228
|
|
|
144
|
-
<script type="text/paperscript" canvas="canvas-
|
|
229
|
+
<script type="text/paperscript" canvas="canvas-1">
|
|
145
230
|
var path = new Path.Circle({
|
|
146
231
|
center: [80, 50],
|
|
147
232
|
radius: 35
|
|
@@ -156,7 +241,7 @@ group.addChild(path);
|
|
|
156
241
|
// The path can be accessed by name:
|
|
157
242
|
group.children['example'].fillColor = 'red';
|
|
158
243
|
</script>
|
|
159
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
244
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
|
|
160
245
|
</div>
|
|
161
246
|
|
|
162
247
|
|
|
@@ -194,7 +279,7 @@ group.children['example'].fillColor = 'red';
|
|
|
194
279
|
<div class="button run">Run</div>
|
|
195
280
|
</div>
|
|
196
281
|
|
|
197
|
-
<script type="text/paperscript" canvas="canvas-
|
|
282
|
+
<script type="text/paperscript" canvas="canvas-2">
|
|
198
283
|
var circle = new Path.Circle({
|
|
199
284
|
center: [80, 50],
|
|
200
285
|
radius: 30
|
|
@@ -205,7 +290,7 @@ circle.style = {
|
|
|
205
290
|
strokeWidth: 5
|
|
206
291
|
};
|
|
207
292
|
</script>
|
|
208
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
293
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
|
|
209
294
|
</div>
|
|
210
295
|
|
|
211
296
|
|
|
@@ -217,7 +302,7 @@ circle.style = {
|
|
|
217
302
|
<div class="button run">Run</div>
|
|
218
303
|
</div>
|
|
219
304
|
|
|
220
|
-
<script type="text/paperscript" canvas="canvas-
|
|
305
|
+
<script type="text/paperscript" canvas="canvas-3">
|
|
221
306
|
var path = new Path.Circle({
|
|
222
307
|
center: [50, 50],
|
|
223
308
|
radius: 30,
|
|
@@ -232,7 +317,7 @@ var path2 = new Path.Circle({
|
|
|
232
317
|
// Copy the path style of path:
|
|
233
318
|
path2.style = path.style;
|
|
234
319
|
</script>
|
|
235
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
320
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
|
|
236
321
|
</div>
|
|
237
322
|
|
|
238
323
|
|
|
@@ -244,7 +329,7 @@ path2.style = path.style;
|
|
|
244
329
|
<div class="button run">Run</div>
|
|
245
330
|
</div>
|
|
246
331
|
|
|
247
|
-
<script type="text/paperscript" canvas="canvas-
|
|
332
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
248
333
|
var myStyle = {
|
|
249
334
|
fillColor: 'red',
|
|
250
335
|
strokeColor: 'blue',
|
|
@@ -263,7 +348,7 @@ var path2 = new Path.Circle({
|
|
|
263
348
|
});
|
|
264
349
|
path2.style = myStyle;
|
|
265
350
|
</script>
|
|
266
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
351
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
|
|
267
352
|
</div>
|
|
268
353
|
|
|
269
354
|
|
|
@@ -305,7 +390,7 @@ path2.style = myStyle;
|
|
|
305
390
|
<div class="button run">Run</div>
|
|
306
391
|
</div>
|
|
307
392
|
|
|
308
|
-
<script type="text/paperscript" canvas="canvas-
|
|
393
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
309
394
|
var unlockedItem = new Path.Circle({
|
|
310
395
|
center: view.center - [35, 0],
|
|
311
396
|
radius: 30,
|
|
@@ -332,7 +417,7 @@ new PointText({
|
|
|
332
417
|
justification: 'center'
|
|
333
418
|
});
|
|
334
419
|
</script>
|
|
335
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
420
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
336
421
|
</div>
|
|
337
422
|
|
|
338
423
|
|
|
@@ -374,7 +459,7 @@ new PointText({
|
|
|
374
459
|
<div class="button run">Run</div>
|
|
375
460
|
</div>
|
|
376
461
|
|
|
377
|
-
<script type="text/paperscript" canvas="canvas-
|
|
462
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
378
463
|
var path = new Path.Circle({
|
|
379
464
|
center: [50, 50],
|
|
380
465
|
radius: 20,
|
|
@@ -384,7 +469,7 @@ var path = new Path.Circle({
|
|
|
384
469
|
// Hide the path:
|
|
385
470
|
path.visible = false;
|
|
386
471
|
</script>
|
|
387
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
472
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
388
473
|
</div>
|
|
389
474
|
|
|
390
475
|
|
|
@@ -432,7 +517,7 @@ path.visible = false;
|
|
|
432
517
|
<div class="button run">Run</div>
|
|
433
518
|
</div>
|
|
434
519
|
|
|
435
|
-
<script type="text/paperscript" canvas="canvas-
|
|
520
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
436
521
|
// Create a white rectangle in the background
|
|
437
522
|
// with the same dimensions as the view:
|
|
438
523
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -453,7 +538,7 @@ var circle2 = new Path.Circle({
|
|
|
453
538
|
// Set the blend mode of circle2:
|
|
454
539
|
circle2.blendMode = 'multiply';
|
|
455
540
|
</script>
|
|
456
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
541
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
457
542
|
</div>
|
|
458
543
|
|
|
459
544
|
|
|
@@ -495,7 +580,7 @@ circle2.blendMode = 'multiply';
|
|
|
495
580
|
<div class="button run">Run</div>
|
|
496
581
|
</div>
|
|
497
582
|
|
|
498
|
-
<script type="text/paperscript" canvas="canvas-
|
|
583
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
499
584
|
var circle = new Path.Circle({
|
|
500
585
|
center: [80, 50],
|
|
501
586
|
radius: 35,
|
|
@@ -513,7 +598,7 @@ var circle2 = new Path.Circle({
|
|
|
513
598
|
// Make circle2 50% transparent:
|
|
514
599
|
circle2.opacity = 0.5;
|
|
515
600
|
</script>
|
|
516
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
601
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
517
602
|
</div>
|
|
518
603
|
|
|
519
604
|
|
|
@@ -636,14 +721,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
636
721
|
<div class="button run">Run</div>
|
|
637
722
|
</div>
|
|
638
723
|
|
|
639
|
-
<script type="text/paperscript" canvas="canvas-
|
|
724
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
640
725
|
var path = new Path.Circle({
|
|
641
726
|
center: [80, 50],
|
|
642
727
|
radius: 35
|
|
643
728
|
});
|
|
644
729
|
path.selected = true; // Select the path
|
|
645
730
|
</script>
|
|
646
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
731
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
647
732
|
</div>
|
|
648
733
|
|
|
649
734
|
|
|
@@ -800,7 +885,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
800
885
|
<div class="button run">Run</div>
|
|
801
886
|
</div>
|
|
802
887
|
|
|
803
|
-
<script type="text/paperscript" canvas="canvas-
|
|
888
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
804
889
|
// Create a circle at position { x: 10, y: 10 }
|
|
805
890
|
var circle = new Path.Circle({
|
|
806
891
|
center: new Point(10, 10),
|
|
@@ -814,7 +899,7 @@ circle.position = new Point(20, 20);
|
|
|
814
899
|
// Move the circle 100 points to the right and 50 points down
|
|
815
900
|
circle.position += new Point(100, 50);
|
|
816
901
|
</script>
|
|
817
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
902
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
818
903
|
</div>
|
|
819
904
|
|
|
820
905
|
|
|
@@ -826,7 +911,7 @@ circle.position += new Point(100, 50);
|
|
|
826
911
|
<div class="button run">Run</div>
|
|
827
912
|
</div>
|
|
828
913
|
|
|
829
|
-
<script type="text/paperscript" canvas="canvas-
|
|
914
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
830
915
|
// Create a circle at position { x: 20, y: 20 }
|
|
831
916
|
var circle = new Path.Circle({
|
|
832
917
|
center: new Point(20, 20),
|
|
@@ -837,7 +922,7 @@ var circle = new Path.Circle({
|
|
|
837
922
|
// Move the circle 100 points to the right
|
|
838
923
|
circle.position.x += 100;
|
|
839
924
|
</script>
|
|
840
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
925
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
841
926
|
</div>
|
|
842
927
|
|
|
843
928
|
|
|
@@ -1363,7 +1448,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1363
1448
|
<div class="button run">Run</div>
|
|
1364
1449
|
</div>
|
|
1365
1450
|
|
|
1366
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1451
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
1367
1452
|
var path = new Path.Circle({
|
|
1368
1453
|
center: [80, 50],
|
|
1369
1454
|
radius: 35
|
|
@@ -1376,7 +1461,7 @@ group.addChild(path);
|
|
|
1376
1461
|
// Access the path through the group's children array:
|
|
1377
1462
|
group.children[0].fillColor = 'red';
|
|
1378
1463
|
</script>
|
|
1379
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1464
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
1380
1465
|
</div>
|
|
1381
1466
|
|
|
1382
1467
|
|
|
@@ -1388,7 +1473,7 @@ group.children[0].fillColor = 'red';
|
|
|
1388
1473
|
<div class="button run">Run</div>
|
|
1389
1474
|
</div>
|
|
1390
1475
|
|
|
1391
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1476
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1392
1477
|
var path = new Path.Circle({
|
|
1393
1478
|
center: [80, 50],
|
|
1394
1479
|
radius: 35
|
|
@@ -1403,7 +1488,7 @@ group.addChild(path);
|
|
|
1403
1488
|
// The path can be accessed by name:
|
|
1404
1489
|
group.children['example'].fillColor = 'orange';
|
|
1405
1490
|
</script>
|
|
1406
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1491
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1407
1492
|
</div>
|
|
1408
1493
|
|
|
1409
1494
|
|
|
@@ -1415,7 +1500,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1415
1500
|
<div class="button run">Run</div>
|
|
1416
1501
|
</div>
|
|
1417
1502
|
|
|
1418
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1503
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1419
1504
|
var path = new Path.Circle({
|
|
1420
1505
|
center: [80, 50],
|
|
1421
1506
|
radius: 35
|
|
@@ -1427,7 +1512,7 @@ group.children = [path];
|
|
|
1427
1512
|
// The path is the first child of the group:
|
|
1428
1513
|
group.firstChild.fillColor = 'green';
|
|
1429
1514
|
</script>
|
|
1430
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1515
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1431
1516
|
</div>
|
|
1432
1517
|
|
|
1433
1518
|
|
|
@@ -1604,7 +1689,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1604
1689
|
<div class="button run">Run</div>
|
|
1605
1690
|
</div>
|
|
1606
1691
|
|
|
1607
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1692
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1608
1693
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1609
1694
|
// with a radius of 35:
|
|
1610
1695
|
var circle = new Path.Circle({
|
|
@@ -1615,7 +1700,7 @@ var circle = new Path.Circle({
|
|
|
1615
1700
|
// Set its stroke color to RGB red:
|
|
1616
1701
|
circle.strokeColor = new Color(1, 0, 0);
|
|
1617
1702
|
</script>
|
|
1618
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1703
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1619
1704
|
</div>
|
|
1620
1705
|
|
|
1621
1706
|
|
|
@@ -1652,7 +1737,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
1652
1737
|
<div class="button run">Run</div>
|
|
1653
1738
|
</div>
|
|
1654
1739
|
|
|
1655
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1740
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1656
1741
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1657
1742
|
// with a radius of 35:
|
|
1658
1743
|
var circle = new Path.Circle({
|
|
@@ -1664,7 +1749,7 @@ var circle = new Path.Circle({
|
|
|
1664
1749
|
// Set its stroke width to 10:
|
|
1665
1750
|
circle.strokeWidth = 10;
|
|
1666
1751
|
</script>
|
|
1667
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1752
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1668
1753
|
</div>
|
|
1669
1754
|
|
|
1670
1755
|
|
|
@@ -1711,7 +1796,7 @@ circle.strokeWidth = 10;
|
|
|
1711
1796
|
<div class="button run">Run</div>
|
|
1712
1797
|
</div>
|
|
1713
1798
|
|
|
1714
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1799
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1715
1800
|
var line = new Path({
|
|
1716
1801
|
segments: [[80, 50], [420, 50]],
|
|
1717
1802
|
strokeColor: 'black',
|
|
@@ -1732,7 +1817,7 @@ var line2 = line.clone();
|
|
|
1732
1817
|
line2.position.y += 100;
|
|
1733
1818
|
line2.strokeCap = 'butt';
|
|
1734
1819
|
</script>
|
|
1735
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
1820
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-17"></canvas></div>
|
|
1736
1821
|
</div>
|
|
1737
1822
|
|
|
1738
1823
|
|
|
@@ -1779,7 +1864,7 @@ line2.strokeCap = 'butt';
|
|
|
1779
1864
|
<div class="button run">Run</div>
|
|
1780
1865
|
</div>
|
|
1781
1866
|
|
|
1782
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1867
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1783
1868
|
var path = new Path({
|
|
1784
1869
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
1785
1870
|
strokeColor: 'black',
|
|
@@ -1796,7 +1881,7 @@ var path3 = path2.clone();
|
|
|
1796
1881
|
path3.position.x += path3.bounds.width * 1.5;
|
|
1797
1882
|
path3.strokeJoin = 'bevel';
|
|
1798
1883
|
</script>
|
|
1799
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
1884
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-18"></canvas></div>
|
|
1800
1885
|
</div>
|
|
1801
1886
|
|
|
1802
1887
|
|
|
@@ -1900,7 +1985,7 @@ path3.strokeJoin = 'bevel';
|
|
|
1900
1985
|
<div class="button run">Run</div>
|
|
1901
1986
|
</div>
|
|
1902
1987
|
|
|
1903
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1988
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1904
1989
|
var path = new Path.Circle({
|
|
1905
1990
|
center: [80, 50],
|
|
1906
1991
|
radius: 40,
|
|
@@ -1911,7 +1996,7 @@ var path = new Path.Circle({
|
|
|
1911
1996
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
1912
1997
|
path.dashArray = [10, 4];
|
|
1913
1998
|
</script>
|
|
1914
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1999
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
|
|
1915
2000
|
</div>
|
|
1916
2001
|
|
|
1917
2002
|
|
|
@@ -2017,7 +2102,7 @@ path.dashArray = [10, 4];
|
|
|
2017
2102
|
<div class="button run">Run</div>
|
|
2018
2103
|
</div>
|
|
2019
2104
|
|
|
2020
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2105
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
2021
2106
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2022
2107
|
// with a radius of 35:
|
|
2023
2108
|
var circle = new Path.Circle({
|
|
@@ -2028,7 +2113,7 @@ var circle = new Path.Circle({
|
|
|
2028
2113
|
// Set the fill color of the circle to RGB red:
|
|
2029
2114
|
circle.fillColor = new Color(1, 0, 0);
|
|
2030
2115
|
</script>
|
|
2031
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2116
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
2032
2117
|
</div>
|
|
2033
2118
|
|
|
2034
2119
|
|
|
@@ -2103,7 +2188,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2103
2188
|
<div class="button run">Run</div>
|
|
2104
2189
|
</div>
|
|
2105
2190
|
|
|
2106
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2191
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2107
2192
|
var circle = new Path.Circle({
|
|
2108
2193
|
center: [80, 50],
|
|
2109
2194
|
radius: 35,
|
|
@@ -2116,7 +2201,7 @@ var circle = new Path.Circle({
|
|
|
2116
2201
|
shadowOffset: new Point(5, 5)
|
|
2117
2202
|
});
|
|
2118
2203
|
</script>
|
|
2119
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2204
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2120
2205
|
</div>
|
|
2121
2206
|
|
|
2122
2207
|
|
|
@@ -2257,7 +2342,7 @@ var circle = new Path.Circle({
|
|
|
2257
2342
|
<div class="button run">Run</div>
|
|
2258
2343
|
</div>
|
|
2259
2344
|
|
|
2260
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2345
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2261
2346
|
// Create a rectangle shaped path with its top left point at:
|
|
2262
2347
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2263
2348
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2268,7 +2353,7 @@ path.onFrame = function(event) {
|
|
|
2268
2353
|
this.rotate(3);
|
|
2269
2354
|
}
|
|
2270
2355
|
</script>
|
|
2271
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2356
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2272
2357
|
</div>
|
|
2273
2358
|
|
|
2274
2359
|
|
|
@@ -2312,7 +2397,7 @@ path.onFrame = function(event) {
|
|
|
2312
2397
|
<div class="button run">Run</div>
|
|
2313
2398
|
</div>
|
|
2314
2399
|
|
|
2315
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2400
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2316
2401
|
// Create a circle shaped path at the center of the view:
|
|
2317
2402
|
var path = new Path.Circle({
|
|
2318
2403
|
center: view.center,
|
|
@@ -2326,7 +2411,7 @@ path.onMouseDown = function(event) {
|
|
|
2326
2411
|
this.fillColor = 'red';
|
|
2327
2412
|
}
|
|
2328
2413
|
</script>
|
|
2329
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2414
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2330
2415
|
</div>
|
|
2331
2416
|
|
|
2332
2417
|
|
|
@@ -2338,7 +2423,7 @@ path.onMouseDown = function(event) {
|
|
|
2338
2423
|
<div class="button run">Run</div>
|
|
2339
2424
|
</div>
|
|
2340
2425
|
|
|
2341
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2426
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2342
2427
|
// Loop 30 times:
|
|
2343
2428
|
for (var i = 0; i < 30; i++) {
|
|
2344
2429
|
// Create a circle shaped path at a random position
|
|
@@ -2356,7 +2441,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2356
2441
|
}
|
|
2357
2442
|
}
|
|
2358
2443
|
</script>
|
|
2359
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2444
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2360
2445
|
</div>
|
|
2361
2446
|
|
|
2362
2447
|
|
|
@@ -2400,7 +2485,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2400
2485
|
<div class="button run">Run</div>
|
|
2401
2486
|
</div>
|
|
2402
2487
|
|
|
2403
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2488
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2404
2489
|
// Create a circle shaped path at the center of the view:
|
|
2405
2490
|
var path = new Path.Circle({
|
|
2406
2491
|
center: view.center,
|
|
@@ -2413,7 +2498,7 @@ path.onMouseDrag = function(event) {
|
|
|
2413
2498
|
path.position += event.delta;
|
|
2414
2499
|
}
|
|
2415
2500
|
</script>
|
|
2416
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2501
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-25"></canvas></div>
|
|
2417
2502
|
</div>
|
|
2418
2503
|
|
|
2419
2504
|
|
|
@@ -2457,7 +2542,7 @@ path.onMouseDrag = function(event) {
|
|
|
2457
2542
|
<div class="button run">Run</div>
|
|
2458
2543
|
</div>
|
|
2459
2544
|
|
|
2460
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2545
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2461
2546
|
// Create a circle shaped path at the center of the view:
|
|
2462
2547
|
var path = new Path.Circle({
|
|
2463
2548
|
center: view.center,
|
|
@@ -2471,7 +2556,7 @@ path.onMouseUp = function(event) {
|
|
|
2471
2556
|
this.fillColor = 'red';
|
|
2472
2557
|
}
|
|
2473
2558
|
</script>
|
|
2474
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2559
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
2475
2560
|
</div>
|
|
2476
2561
|
|
|
2477
2562
|
|
|
@@ -2515,7 +2600,7 @@ path.onMouseUp = function(event) {
|
|
|
2515
2600
|
<div class="button run">Run</div>
|
|
2516
2601
|
</div>
|
|
2517
2602
|
|
|
2518
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2603
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2519
2604
|
// Create a circle shaped path at the center of the view:
|
|
2520
2605
|
var path = new Path.Circle({
|
|
2521
2606
|
center: view.center,
|
|
@@ -2529,7 +2614,7 @@ path.onClick = function(event) {
|
|
|
2529
2614
|
this.fillColor = 'red';
|
|
2530
2615
|
}
|
|
2531
2616
|
</script>
|
|
2532
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2617
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2533
2618
|
</div>
|
|
2534
2619
|
|
|
2535
2620
|
|
|
@@ -2541,7 +2626,7 @@ path.onClick = function(event) {
|
|
|
2541
2626
|
<div class="button run">Run</div>
|
|
2542
2627
|
</div>
|
|
2543
2628
|
|
|
2544
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2629
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2545
2630
|
// Loop 30 times:
|
|
2546
2631
|
for (var i = 0; i < 30; i++) {
|
|
2547
2632
|
// Create a circle shaped path at a random position
|
|
@@ -2559,7 +2644,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2559
2644
|
}
|
|
2560
2645
|
}
|
|
2561
2646
|
</script>
|
|
2562
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2647
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2563
2648
|
</div>
|
|
2564
2649
|
|
|
2565
2650
|
|
|
@@ -2603,7 +2688,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2603
2688
|
<div class="button run">Run</div>
|
|
2604
2689
|
</div>
|
|
2605
2690
|
|
|
2606
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2691
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2607
2692
|
// Create a circle shaped path at the center of the view:
|
|
2608
2693
|
var path = new Path.Circle({
|
|
2609
2694
|
center: view.center,
|
|
@@ -2617,7 +2702,7 @@ path.onDoubleClick = function(event) {
|
|
|
2617
2702
|
this.fillColor = 'red';
|
|
2618
2703
|
}
|
|
2619
2704
|
</script>
|
|
2620
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2705
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2621
2706
|
</div>
|
|
2622
2707
|
|
|
2623
2708
|
|
|
@@ -2629,7 +2714,7 @@ path.onDoubleClick = function(event) {
|
|
|
2629
2714
|
<div class="button run">Run</div>
|
|
2630
2715
|
</div>
|
|
2631
2716
|
|
|
2632
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2717
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2633
2718
|
// Loop 30 times:
|
|
2634
2719
|
for (var i = 0; i < 30; i++) {
|
|
2635
2720
|
// Create a circle shaped path at a random position
|
|
@@ -2647,7 +2732,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2647
2732
|
}
|
|
2648
2733
|
}
|
|
2649
2734
|
</script>
|
|
2650
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2735
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2651
2736
|
</div>
|
|
2652
2737
|
|
|
2653
2738
|
|
|
@@ -2691,7 +2776,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2691
2776
|
<div class="button run">Run</div>
|
|
2692
2777
|
</div>
|
|
2693
2778
|
|
|
2694
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2779
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2695
2780
|
// Create a circle shaped path at the center of the view:
|
|
2696
2781
|
var path = new Path.Circle({
|
|
2697
2782
|
center: view.center,
|
|
@@ -2705,178 +2790,622 @@ path.onMouseMove = function(event) {
|
|
|
2705
2790
|
this.opacity = Math.random();
|
|
2706
2791
|
}
|
|
2707
2792
|
</script>
|
|
2708
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2793
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2794
|
+
</div>
|
|
2795
|
+
|
|
2796
|
+
|
|
2797
|
+
</div>
|
|
2798
|
+
|
|
2799
|
+
</div>
|
|
2800
|
+
</div>
|
|
2801
|
+
|
|
2802
|
+
|
|
2803
|
+
<div id="onmouseenter" class="member">
|
|
2804
|
+
<div class="member-link">
|
|
2805
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
2806
|
+
</div>
|
|
2807
|
+
<div class="member-description hidden">
|
|
2808
|
+
|
|
2809
|
+
<div class="member-text">
|
|
2810
|
+
<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>
|
|
2811
|
+
|
|
2812
|
+
|
|
2813
|
+
|
|
2814
|
+
<ul class="member-list">
|
|
2815
|
+
<h4>Type:</h4>
|
|
2816
|
+
<li>
|
|
2817
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2818
|
+
</li>
|
|
2819
|
+
</ul>
|
|
2820
|
+
|
|
2821
|
+
|
|
2822
|
+
<ul class="member-list">
|
|
2823
|
+
<h4>See also:</h4>
|
|
2824
|
+
|
|
2825
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
2826
|
+
|
|
2827
|
+
</ul>
|
|
2828
|
+
|
|
2829
|
+
<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>
|
|
2830
|
+
|
|
2831
|
+
<div class="paperscript split">
|
|
2832
|
+
|
|
2833
|
+
<div class="buttons">
|
|
2834
|
+
<div class="button run">Run</div>
|
|
2835
|
+
</div>
|
|
2836
|
+
|
|
2837
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2838
|
+
// Create a circle shaped path at the center of the view:
|
|
2839
|
+
var path = new Path.Circle({
|
|
2840
|
+
center: view.center,
|
|
2841
|
+
radius: 25,
|
|
2842
|
+
fillColor: 'black'
|
|
2843
|
+
});
|
|
2844
|
+
|
|
2845
|
+
// When the mouse enters the item, set its fill color to red:
|
|
2846
|
+
path.onMouseEnter = function(event) {
|
|
2847
|
+
this.fillColor = 'red';
|
|
2848
|
+
}
|
|
2849
|
+
|
|
2850
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
2851
|
+
path.onMouseLeave = function(event) {
|
|
2852
|
+
this.fillColor = 'black';
|
|
2853
|
+
}
|
|
2854
|
+
</script>
|
|
2855
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2856
|
+
</div>
|
|
2857
|
+
|
|
2858
|
+
|
|
2859
|
+
<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>
|
|
2860
|
+
|
|
2861
|
+
<div class="paperscript split">
|
|
2862
|
+
|
|
2863
|
+
<div class="buttons">
|
|
2864
|
+
<div class="button run">Run</div>
|
|
2709
2865
|
</div>
|
|
2710
2866
|
|
|
2867
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2868
|
+
function enter(event) {
|
|
2869
|
+
this.fillColor = 'red';
|
|
2870
|
+
}
|
|
2871
|
+
|
|
2872
|
+
function leave(event) {
|
|
2873
|
+
this.fillColor = 'black';
|
|
2874
|
+
}
|
|
2875
|
+
|
|
2876
|
+
// When the mouse is pressed:
|
|
2877
|
+
function onMouseDown(event) {
|
|
2878
|
+
// Create a circle shaped path at the position of the mouse:
|
|
2879
|
+
var path = new Path.Circle(event.point, 25);
|
|
2880
|
+
path.fillColor = 'black';
|
|
2881
|
+
|
|
2882
|
+
// When the mouse enters the item, set its fill color to red:
|
|
2883
|
+
path.onMouseEnter = enter;
|
|
2884
|
+
|
|
2885
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
2886
|
+
path.onMouseLeave = leave;
|
|
2887
|
+
}
|
|
2888
|
+
</script>
|
|
2889
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2890
|
+
</div>
|
|
2891
|
+
|
|
2892
|
+
|
|
2893
|
+
</div>
|
|
2894
|
+
|
|
2895
|
+
</div>
|
|
2896
|
+
</div>
|
|
2897
|
+
|
|
2898
|
+
|
|
2899
|
+
<div id="onmouseleave" class="member">
|
|
2900
|
+
<div class="member-link">
|
|
2901
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
2902
|
+
</div>
|
|
2903
|
+
<div class="member-description hidden">
|
|
2904
|
+
|
|
2905
|
+
<div class="member-text">
|
|
2906
|
+
<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>
|
|
2907
|
+
|
|
2908
|
+
|
|
2909
|
+
|
|
2910
|
+
<ul class="member-list">
|
|
2911
|
+
<h4>Type:</h4>
|
|
2912
|
+
<li>
|
|
2913
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2914
|
+
</li>
|
|
2915
|
+
</ul>
|
|
2916
|
+
|
|
2917
|
+
|
|
2918
|
+
<ul class="member-list">
|
|
2919
|
+
<h4>See also:</h4>
|
|
2920
|
+
|
|
2921
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
2922
|
+
|
|
2923
|
+
</ul>
|
|
2924
|
+
|
|
2925
|
+
<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>
|
|
2926
|
+
|
|
2927
|
+
<div class="paperscript split">
|
|
2928
|
+
|
|
2929
|
+
<div class="buttons">
|
|
2930
|
+
<div class="button run">Run</div>
|
|
2931
|
+
</div>
|
|
2932
|
+
|
|
2933
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
2934
|
+
// Create a circle shaped path at the center of the view:
|
|
2935
|
+
var path = new Path.Circle({
|
|
2936
|
+
center: view.center,
|
|
2937
|
+
radius: 25,
|
|
2938
|
+
fillColor: 'black'
|
|
2939
|
+
});
|
|
2940
|
+
|
|
2941
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
2942
|
+
path.onMouseLeave = function(event) {
|
|
2943
|
+
this.fillColor = 'red';
|
|
2944
|
+
}
|
|
2945
|
+
</script>
|
|
2946
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2947
|
+
</div>
|
|
2948
|
+
|
|
2949
|
+
|
|
2950
|
+
</div>
|
|
2951
|
+
|
|
2952
|
+
</div>
|
|
2953
|
+
</div>
|
|
2954
|
+
|
|
2955
|
+
|
|
2956
|
+
<div id="ondraw" class="member">
|
|
2957
|
+
<div class="member-link">
|
|
2958
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
2959
|
+
</div>
|
|
2960
|
+
<div class="member-description hidden">
|
|
2961
|
+
|
|
2962
|
+
<div class="member-text">
|
|
2963
|
+
<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>
|
|
2964
|
+
|
|
2965
|
+
|
|
2966
|
+
|
|
2967
|
+
<ul class="member-list">
|
|
2968
|
+
<h4>Type:</h4>
|
|
2969
|
+
<li>
|
|
2970
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2971
|
+
</li>
|
|
2972
|
+
</ul>
|
|
2973
|
+
<ul class="member-list">
|
|
2974
|
+
<h4>Options:</h4>
|
|
2975
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
2976
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
2977
|
+
<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>
|
|
2978
|
+
<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>
|
|
2979
|
+
<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>()
|
|
2980
|
+
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>
|
|
2981
|
+
</ul>
|
|
2982
|
+
|
|
2983
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
2984
|
+
|
|
2985
|
+
<div class="paperscript split">
|
|
2986
|
+
|
|
2987
|
+
<div class="buttons">
|
|
2988
|
+
<div class="button run">Run</div>
|
|
2989
|
+
</div>
|
|
2990
|
+
|
|
2991
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
2992
|
+
var path = new Path.Circle({
|
|
2993
|
+
center: view.center,
|
|
2994
|
+
radius: 25,
|
|
2995
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
2996
|
+
});
|
|
2997
|
+
|
|
2998
|
+
path.onDraw = function(event) {
|
|
2999
|
+
var ctx = event.context,
|
|
3000
|
+
center = this.position,
|
|
3001
|
+
scale = event.matrix.scaling.x;
|
|
3002
|
+
ctx.beginPath();
|
|
3003
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3004
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3005
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3006
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3007
|
+
ctx.lineWidth = 1 / scale;
|
|
3008
|
+
ctx.stroke();
|
|
3009
|
+
}
|
|
3010
|
+
</script>
|
|
3011
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3012
|
+
</div>
|
|
3013
|
+
|
|
3014
|
+
|
|
3015
|
+
</div>
|
|
3016
|
+
|
|
3017
|
+
</div>
|
|
3018
|
+
</div>
|
|
3019
|
+
|
|
3020
|
+
|
|
3021
|
+
<div id="ondrawselection" class="member">
|
|
3022
|
+
<div class="member-link">
|
|
3023
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3024
|
+
</div>
|
|
3025
|
+
<div class="member-description hidden">
|
|
3026
|
+
|
|
3027
|
+
<div class="member-text">
|
|
3028
|
+
<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>
|
|
3029
|
+
|
|
3030
|
+
|
|
3031
|
+
|
|
3032
|
+
<ul class="member-list">
|
|
3033
|
+
<h4>Type:</h4>
|
|
3034
|
+
<li>
|
|
3035
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3036
|
+
</li>
|
|
3037
|
+
</ul>
|
|
3038
|
+
<ul class="member-list">
|
|
3039
|
+
<h4>Options:</h4>
|
|
3040
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3041
|
+
<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>
|
|
3042
|
+
<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>
|
|
3043
|
+
<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>
|
|
3044
|
+
<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>
|
|
3045
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3046
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3047
|
+
</ul>
|
|
3048
|
+
|
|
3049
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3050
|
+
|
|
3051
|
+
<div class="paperscript split">
|
|
3052
|
+
|
|
3053
|
+
<div class="buttons">
|
|
3054
|
+
<div class="button run">Run</div>
|
|
3055
|
+
</div>
|
|
3056
|
+
|
|
3057
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3058
|
+
var path = new Path.Star({
|
|
3059
|
+
center: view.center,
|
|
3060
|
+
points: 5,
|
|
3061
|
+
radius1: 20,
|
|
3062
|
+
radius2: 40,
|
|
3063
|
+
strokeColor: 'black',
|
|
3064
|
+
selected: true
|
|
3065
|
+
});
|
|
3066
|
+
|
|
3067
|
+
path.onDrawSelection = function(event) {
|
|
3068
|
+
var ctx = event.context;
|
|
3069
|
+
this.segments.forEach(function(segment) {
|
|
3070
|
+
var point = event.matrix.transform(segment.point);
|
|
3071
|
+
ctx.beginPath();
|
|
3072
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3073
|
+
ctx.fill();
|
|
3074
|
+
});
|
|
3075
|
+
return false;
|
|
3076
|
+
}
|
|
3077
|
+
</script>
|
|
3078
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3079
|
+
</div>
|
|
3080
|
+
|
|
3081
|
+
|
|
3082
|
+
</div>
|
|
3083
|
+
|
|
3084
|
+
</div>
|
|
3085
|
+
</div>
|
|
3086
|
+
|
|
3087
|
+
</div>
|
|
3088
|
+
|
|
3089
|
+
|
|
3090
|
+
|
|
3091
|
+
<div class="reference-members">
|
|
3092
|
+
<h2>Static Properties</h2>
|
|
3093
|
+
|
|
3094
|
+
|
|
3095
|
+
<div id="ondraw" class="member">
|
|
3096
|
+
<div class="member-link">
|
|
3097
|
+
<a name="ondraw" href="#ondraw"><tt><b>Item.onDraw</b></tt></a>
|
|
3098
|
+
</div>
|
|
3099
|
+
<div class="member-description hidden">
|
|
3100
|
+
|
|
3101
|
+
<div class="member-text">
|
|
3102
|
+
<p>The function to be called whenever any item of the class or of its subclasses is drawn, as <a href="../classes/Item.html#ondraw"><tt>onDraw</tt></a> is for a single item, e.g. <code>Path.onDraw</code> for all paths, including the ones created later. The item’s own handlers are called first, then the ones of its class and of the classes it inherits from, up to <code>Item</code>, with <code>this</code> set to the item. <code>Path.on('draw', handler)</code> and <code>Path.off('draw', handler)</code> attach and detach them too. Only the drawing events can be handled for classes of items. Classes are shared by all <a href="../classes/PaperScope.html"><tt>PaperScope</tt></a> objects, and so are their handlers.</p>
|
|
3103
|
+
|
|
3104
|
+
|
|
3105
|
+
|
|
3106
|
+
<ul class="member-list">
|
|
3107
|
+
<h4>Type:</h4>
|
|
3108
|
+
<li>
|
|
3109
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3110
|
+
</li>
|
|
3111
|
+
</ul>
|
|
3112
|
+
|
|
3113
|
+
|
|
3114
|
+
|
|
3115
|
+
</div>
|
|
3116
|
+
|
|
3117
|
+
</div>
|
|
3118
|
+
</div>
|
|
3119
|
+
|
|
3120
|
+
|
|
3121
|
+
<div id="ondrawselection" class="member">
|
|
3122
|
+
<div class="member-link">
|
|
3123
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>Item.onDrawSelection</b></tt></a>
|
|
3124
|
+
</div>
|
|
3125
|
+
<div class="member-description hidden">
|
|
3126
|
+
|
|
3127
|
+
<div class="member-text">
|
|
3128
|
+
<p>The function to be called when the selection of any selected item of the class or of its subclasses is drawn, as <a href="../classes/Item.html#ondrawselection"><tt>onDrawSelection</tt></a> is for a single item, e.g. <code>Path.onDrawSelection</code> for all paths, see <a href="../classes/Item.html#ondraw"><tt>Item.onDraw</tt></a>.</p>
|
|
3129
|
+
|
|
3130
|
+
|
|
3131
|
+
|
|
3132
|
+
<ul class="member-list">
|
|
3133
|
+
<h4>Type:</h4>
|
|
3134
|
+
<li>
|
|
3135
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3136
|
+
</li>
|
|
3137
|
+
</ul>
|
|
3138
|
+
|
|
3139
|
+
|
|
3140
|
+
|
|
3141
|
+
</div>
|
|
3142
|
+
|
|
3143
|
+
</div>
|
|
3144
|
+
</div>
|
|
3145
|
+
|
|
3146
|
+
</div>
|
|
3147
|
+
|
|
3148
|
+
|
|
3149
|
+
|
|
3150
|
+
<!-- ============================== methods ================================ -->
|
|
3151
|
+
<div class="reference-members">
|
|
3152
|
+
<h2>Methods</h2>
|
|
3153
|
+
|
|
3154
|
+
|
|
3155
|
+
<div id="addeffect-effect" class="member">
|
|
3156
|
+
<div class="member-link">
|
|
3157
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3158
|
+
</div>
|
|
3159
|
+
<div class="member-description hidden">
|
|
3160
|
+
<div class="member-text">
|
|
3161
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3162
|
+
|
|
3163
|
+
|
|
3164
|
+
<ul class="member-list">
|
|
3165
|
+
<h4>Parameters:</h4>
|
|
3166
|
+
|
|
3167
|
+
<li>
|
|
3168
|
+
<tt>effect:</tt>
|
|
3169
|
+
<tt>Object</tt>
|
|
3170
|
+
— the plain object describing the effect
|
|
3171
|
+
|
|
3172
|
+
</li>
|
|
3173
|
+
|
|
3174
|
+
</ul>
|
|
3175
|
+
|
|
3176
|
+
|
|
3177
|
+
<ul class="member-list">
|
|
3178
|
+
<h4>Returns:</h4>
|
|
3179
|
+
|
|
3180
|
+
<li>
|
|
3181
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3182
|
+
</li>
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
</ul>
|
|
3186
|
+
|
|
3187
|
+
|
|
3188
|
+
|
|
3189
|
+
|
|
3190
|
+
|
|
3191
|
+
</div>
|
|
3192
|
+
</div>
|
|
3193
|
+
</div>
|
|
3194
|
+
|
|
3195
|
+
|
|
3196
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3197
|
+
<div class="member-link">
|
|
3198
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3199
|
+
</div>
|
|
3200
|
+
<div class="member-description hidden">
|
|
3201
|
+
<div class="member-text">
|
|
3202
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3203
|
+
|
|
3204
|
+
|
|
3205
|
+
<ul class="member-list">
|
|
3206
|
+
<h4>Parameters:</h4>
|
|
3207
|
+
|
|
3208
|
+
<li>
|
|
3209
|
+
<tt>index:</tt>
|
|
3210
|
+
<tt>Number</tt>
|
|
3211
|
+
— the index at which to insert the effect
|
|
3212
|
+
|
|
3213
|
+
</li>
|
|
3214
|
+
|
|
3215
|
+
<li>
|
|
3216
|
+
<tt>effect:</tt>
|
|
3217
|
+
<tt>Object</tt>
|
|
3218
|
+
— the plain object describing the effect
|
|
3219
|
+
|
|
3220
|
+
</li>
|
|
3221
|
+
|
|
3222
|
+
</ul>
|
|
3223
|
+
|
|
3224
|
+
|
|
3225
|
+
<ul class="member-list">
|
|
3226
|
+
<h4>Returns:</h4>
|
|
3227
|
+
|
|
3228
|
+
<li>
|
|
3229
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3230
|
+
</li>
|
|
3231
|
+
|
|
3232
|
+
|
|
3233
|
+
</ul>
|
|
3234
|
+
|
|
3235
|
+
|
|
3236
|
+
|
|
3237
|
+
|
|
3238
|
+
|
|
3239
|
+
</div>
|
|
3240
|
+
</div>
|
|
3241
|
+
</div>
|
|
3242
|
+
|
|
3243
|
+
|
|
3244
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3245
|
+
<div class="member-link">
|
|
3246
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3247
|
+
</div>
|
|
3248
|
+
<div class="member-description hidden">
|
|
3249
|
+
<div class="member-text">
|
|
3250
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3251
|
+
|
|
3252
|
+
|
|
3253
|
+
<ul class="member-list">
|
|
3254
|
+
<h4>Parameters:</h4>
|
|
3255
|
+
|
|
3256
|
+
<li>
|
|
3257
|
+
<tt>index:</tt>
|
|
3258
|
+
<tt>Number</tt>
|
|
3259
|
+
— the index at which to insert the effects
|
|
3260
|
+
|
|
3261
|
+
</li>
|
|
3262
|
+
|
|
3263
|
+
<li>
|
|
3264
|
+
<tt>effects:</tt>
|
|
3265
|
+
Array of <tt>Object</tt> objects
|
|
3266
|
+
— the plain objects describing the effects
|
|
3267
|
+
|
|
3268
|
+
</li>
|
|
3269
|
+
|
|
3270
|
+
</ul>
|
|
3271
|
+
|
|
3272
|
+
|
|
3273
|
+
<ul class="member-list">
|
|
3274
|
+
<h4>Returns:</h4>
|
|
3275
|
+
|
|
3276
|
+
<li>
|
|
3277
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3278
|
+
</li>
|
|
3279
|
+
|
|
3280
|
+
|
|
3281
|
+
</ul>
|
|
3282
|
+
|
|
2711
3283
|
|
|
2712
|
-
</div>
|
|
2713
3284
|
|
|
3285
|
+
|
|
3286
|
+
|
|
2714
3287
|
</div>
|
|
2715
3288
|
</div>
|
|
2716
|
-
|
|
2717
|
-
|
|
2718
|
-
|
|
3289
|
+
</div>
|
|
3290
|
+
|
|
3291
|
+
|
|
3292
|
+
<div id="removeeffect-index" class="member">
|
|
2719
3293
|
<div class="member-link">
|
|
2720
|
-
<a name="
|
|
3294
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
2721
3295
|
</div>
|
|
2722
3296
|
<div class="member-description hidden">
|
|
2723
|
-
|
|
2724
3297
|
<div class="member-text">
|
|
2725
|
-
<p>
|
|
3298
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3299
|
+
|
|
2726
3300
|
|
|
3301
|
+
<ul class="member-list">
|
|
3302
|
+
<h4>Parameters:</h4>
|
|
2727
3303
|
|
|
3304
|
+
<li>
|
|
3305
|
+
<tt>index:</tt>
|
|
3306
|
+
<tt>Number</tt>
|
|
3307
|
+
— the index of the effect to remove
|
|
3308
|
+
|
|
3309
|
+
</li>
|
|
2728
3310
|
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
<li>
|
|
2732
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2733
|
-
</li>
|
|
2734
|
-
</ul>
|
|
2735
|
-
|
|
3311
|
+
</ul>
|
|
3312
|
+
|
|
2736
3313
|
|
|
2737
3314
|
<ul class="member-list">
|
|
2738
|
-
<h4>
|
|
3315
|
+
<h4>Returns:</h4>
|
|
2739
3316
|
|
|
2740
|
-
<li
|
|
3317
|
+
<li>
|
|
3318
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3319
|
+
</li>
|
|
3320
|
+
|
|
2741
3321
|
|
|
2742
3322
|
</ul>
|
|
2743
3323
|
|
|
2744
|
-
<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>
|
|
2745
|
-
|
|
2746
|
-
<div class="paperscript split">
|
|
2747
|
-
|
|
2748
|
-
<div class="buttons">
|
|
2749
|
-
<div class="button run">Run</div>
|
|
2750
|
-
</div>
|
|
2751
|
-
|
|
2752
|
-
<script type="text/paperscript" canvas="canvas-31">
|
|
2753
|
-
// Create a circle shaped path at the center of the view:
|
|
2754
|
-
var path = new Path.Circle({
|
|
2755
|
-
center: view.center,
|
|
2756
|
-
radius: 25,
|
|
2757
|
-
fillColor: 'black'
|
|
2758
|
-
});
|
|
2759
|
-
|
|
2760
|
-
// When the mouse enters the item, set its fill color to red:
|
|
2761
|
-
path.onMouseEnter = function(event) {
|
|
2762
|
-
this.fillColor = 'red';
|
|
2763
|
-
}
|
|
2764
|
-
|
|
2765
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2766
|
-
path.onMouseLeave = function(event) {
|
|
2767
|
-
this.fillColor = 'black';
|
|
2768
|
-
}
|
|
2769
|
-
</script>
|
|
2770
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2771
|
-
</div>
|
|
2772
|
-
|
|
2773
3324
|
|
|
2774
|
-
<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>
|
|
2775
|
-
|
|
2776
|
-
<div class="paperscript split">
|
|
2777
3325
|
|
|
2778
|
-
|
|
2779
|
-
|
|
3326
|
+
|
|
3327
|
+
|
|
2780
3328
|
</div>
|
|
2781
|
-
|
|
2782
|
-
<script type="text/paperscript" canvas="canvas-32">
|
|
2783
|
-
function enter(event) {
|
|
2784
|
-
this.fillColor = 'red';
|
|
2785
|
-
}
|
|
2786
|
-
|
|
2787
|
-
function leave(event) {
|
|
2788
|
-
this.fillColor = 'black';
|
|
2789
|
-
}
|
|
2790
|
-
|
|
2791
|
-
// When the mouse is pressed:
|
|
2792
|
-
function onMouseDown(event) {
|
|
2793
|
-
// Create a circle shaped path at the position of the mouse:
|
|
2794
|
-
var path = new Path.Circle(event.point, 25);
|
|
2795
|
-
path.fillColor = 'black';
|
|
2796
|
-
|
|
2797
|
-
// When the mouse enters the item, set its fill color to red:
|
|
2798
|
-
path.onMouseEnter = enter;
|
|
2799
|
-
|
|
2800
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2801
|
-
path.onMouseLeave = leave;
|
|
2802
|
-
}
|
|
2803
|
-
</script>
|
|
2804
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2805
3329
|
</div>
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
3330
|
</div>
|
|
2809
3331
|
|
|
2810
|
-
|
|
2811
|
-
|
|
2812
|
-
|
|
2813
|
-
|
|
2814
|
-
<div id="onmouseleave" class="member">
|
|
3332
|
+
|
|
3333
|
+
<div id="removeeffects" class="member">
|
|
2815
3334
|
<div class="member-link">
|
|
2816
|
-
<a name="
|
|
3335
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
2817
3336
|
</div>
|
|
2818
3337
|
<div class="member-description hidden">
|
|
2819
|
-
|
|
2820
3338
|
<div class="member-text">
|
|
2821
|
-
<p>
|
|
3339
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3340
|
+
|
|
3341
|
+
|
|
3342
|
+
<ul class="member-list">
|
|
3343
|
+
<h4>Parameters:</h4>
|
|
2822
3344
|
|
|
3345
|
+
<li>
|
|
3346
|
+
<tt>start:</tt>
|
|
3347
|
+
<tt>Number</tt>
|
|
3348
|
+
— the index of the first effect to remove
|
|
3349
|
+
— optional, default: <tt>0</tt>
|
|
3350
|
+
</li>
|
|
2823
3351
|
|
|
3352
|
+
<li>
|
|
3353
|
+
<tt>end:</tt>
|
|
3354
|
+
<tt>Number</tt>
|
|
3355
|
+
— the index after the last one
|
|
3356
|
+
— optional, default: <tt>effects.length</tt>
|
|
3357
|
+
</li>
|
|
2824
3358
|
|
|
2825
|
-
|
|
2826
|
-
|
|
2827
|
-
<li>
|
|
2828
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2829
|
-
</li>
|
|
2830
|
-
</ul>
|
|
2831
|
-
|
|
3359
|
+
</ul>
|
|
3360
|
+
|
|
2832
3361
|
|
|
2833
3362
|
<ul class="member-list">
|
|
2834
|
-
<h4>
|
|
3363
|
+
<h4>Returns:</h4>
|
|
2835
3364
|
|
|
2836
|
-
<li
|
|
3365
|
+
<li>
|
|
3366
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3367
|
+
</li>
|
|
3368
|
+
|
|
2837
3369
|
|
|
2838
3370
|
</ul>
|
|
2839
3371
|
|
|
2840
|
-
<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>
|
|
2841
3372
|
|
|
2842
|
-
<div class="paperscript split">
|
|
2843
3373
|
|
|
2844
|
-
|
|
2845
|
-
|
|
3374
|
+
|
|
3375
|
+
|
|
2846
3376
|
</div>
|
|
2847
|
-
|
|
2848
|
-
<script type="text/paperscript" canvas="canvas-33">
|
|
2849
|
-
// Create a circle shaped path at the center of the view:
|
|
2850
|
-
var path = new Path.Circle({
|
|
2851
|
-
center: view.center,
|
|
2852
|
-
radius: 25,
|
|
2853
|
-
fillColor: 'black'
|
|
2854
|
-
});
|
|
2855
|
-
|
|
2856
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
2857
|
-
path.onMouseLeave = function(event) {
|
|
2858
|
-
this.fillColor = 'red';
|
|
2859
|
-
}
|
|
2860
|
-
</script>
|
|
2861
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2862
3377
|
</div>
|
|
2863
|
-
|
|
2864
|
-
|
|
2865
3378
|
</div>
|
|
2866
3379
|
|
|
3380
|
+
|
|
3381
|
+
<div id="geteffectoutput" class="member">
|
|
3382
|
+
<div class="member-link">
|
|
3383
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
2867
3384
|
</div>
|
|
2868
|
-
|
|
3385
|
+
<div class="member-description hidden">
|
|
3386
|
+
<div class="member-text">
|
|
3387
|
+
<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>
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
<ul class="member-list">
|
|
3392
|
+
<h4>Returns:</h4>
|
|
2869
3393
|
|
|
2870
|
-
|
|
3394
|
+
<li>
|
|
3395
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3396
|
+
</li>
|
|
2871
3397
|
|
|
3398
|
+
|
|
3399
|
+
</ul>
|
|
2872
3400
|
|
|
2873
3401
|
|
|
2874
3402
|
|
|
3403
|
+
|
|
3404
|
+
|
|
3405
|
+
</div>
|
|
3406
|
+
</div>
|
|
3407
|
+
</div>
|
|
2875
3408
|
|
|
2876
|
-
<!-- ============================== methods ================================ -->
|
|
2877
|
-
<div class="reference-members">
|
|
2878
|
-
<h2>Methods</h2>
|
|
2879
|
-
|
|
2880
3409
|
|
|
2881
3410
|
<div id="set-props" class="member">
|
|
2882
3411
|
<div class="member-link">
|
|
@@ -2921,7 +3450,7 @@ path.onMouseLeave = function(event) {
|
|
|
2921
3450
|
<div class="button run">Run</div>
|
|
2922
3451
|
</div>
|
|
2923
3452
|
|
|
2924
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3453
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
2925
3454
|
var circle = new Path.Circle({
|
|
2926
3455
|
center: [80, 50],
|
|
2927
3456
|
radius: 35
|
|
@@ -2934,7 +3463,7 @@ circle.set({
|
|
|
2934
3463
|
selected: true
|
|
2935
3464
|
});
|
|
2936
3465
|
</script>
|
|
2937
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3466
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
2938
3467
|
</div>
|
|
2939
3468
|
|
|
2940
3469
|
|
|
@@ -2990,7 +3519,7 @@ circle.set({
|
|
|
2990
3519
|
<div class="button run">Run</div>
|
|
2991
3520
|
</div>
|
|
2992
3521
|
|
|
2993
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3522
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
2994
3523
|
var circle = new Path.Circle({
|
|
2995
3524
|
center: [50, 50],
|
|
2996
3525
|
radius: 10,
|
|
@@ -3005,7 +3534,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3005
3534
|
copy.position.x += i * copy.bounds.width;
|
|
3006
3535
|
}
|
|
3007
3536
|
</script>
|
|
3008
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3537
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3009
3538
|
</div>
|
|
3010
3539
|
|
|
3011
3540
|
|
|
@@ -3131,7 +3660,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3131
3660
|
<div class="button run">Run</div>
|
|
3132
3661
|
</div>
|
|
3133
3662
|
|
|
3134
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3663
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3135
3664
|
var circle = new Path.Circle({
|
|
3136
3665
|
center: [50, 50],
|
|
3137
3666
|
radius: 5,
|
|
@@ -3148,7 +3677,7 @@ raster.position.x += 100;
|
|
|
3148
3677
|
circle.scale(5);
|
|
3149
3678
|
raster.scale(5);
|
|
3150
3679
|
</script>
|
|
3151
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3680
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3152
3681
|
</div>
|
|
3153
3682
|
|
|
3154
3683
|
|
|
@@ -3202,7 +3731,7 @@ raster.scale(5);
|
|
|
3202
3731
|
<div class="button run">Run</div>
|
|
3203
3732
|
</div>
|
|
3204
3733
|
|
|
3205
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3734
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3206
3735
|
var path = new Path.Star({
|
|
3207
3736
|
center: [50, 50],
|
|
3208
3737
|
points: 12,
|
|
@@ -3223,7 +3752,7 @@ function onMouseDown(event) {
|
|
|
3223
3752
|
}
|
|
3224
3753
|
}
|
|
3225
3754
|
</script>
|
|
3226
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3755
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3227
3756
|
</div>
|
|
3228
3757
|
|
|
3229
3758
|
|
|
@@ -3741,11 +4270,17 @@ function onMouseDown(event) {
|
|
|
3741
4270
|
</div>
|
|
3742
4271
|
<div class="member-description hidden">
|
|
3743
4272
|
<div class="member-text">
|
|
3744
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4273
|
+
<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>
|
|
3745
4274
|
<ul class="member-list">
|
|
3746
4275
|
<h4>Options:</h4>
|
|
3747
|
-
<li
|
|
3748
|
-
|
|
4276
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4277
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4278
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4279
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4280
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4281
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4282
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4283
|
+
`options.bounds` the identity matrix is used.</li>
|
|
3749
4284
|
<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>
|
|
3750
4285
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
3751
4286
|
<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>
|
|
@@ -5099,7 +5634,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5099
5634
|
<div class="button run">Run</div>
|
|
5100
5635
|
</div>
|
|
5101
5636
|
|
|
5102
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5637
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
5103
5638
|
// Create a rectangle shaped path with its top left
|
|
5104
5639
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5105
5640
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5108,7 +5643,7 @@ path.fillColor = 'black';
|
|
|
5108
5643
|
// Rotate the path by 30 degrees:
|
|
5109
5644
|
path.rotate(30);
|
|
5110
5645
|
</script>
|
|
5111
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5646
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
5112
5647
|
</div>
|
|
5113
5648
|
|
|
5114
5649
|
|
|
@@ -5120,7 +5655,7 @@ path.rotate(30);
|
|
|
5120
5655
|
<div class="button run">Run</div>
|
|
5121
5656
|
</div>
|
|
5122
5657
|
|
|
5123
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5658
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
5124
5659
|
// Create a rectangle shaped path with its top left
|
|
5125
5660
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5126
5661
|
var topLeft = new Point(175, 50);
|
|
@@ -5142,7 +5677,7 @@ function onFrame(event) {
|
|
|
5142
5677
|
path.rotate(3, view.center);
|
|
5143
5678
|
}
|
|
5144
5679
|
</script>
|
|
5145
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5680
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-42"></canvas></div>
|
|
5146
5681
|
</div>
|
|
5147
5682
|
|
|
5148
5683
|
|
|
@@ -5191,7 +5726,7 @@ function onFrame(event) {
|
|
|
5191
5726
|
<div class="button run">Run</div>
|
|
5192
5727
|
</div>
|
|
5193
5728
|
|
|
5194
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5729
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5195
5730
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5196
5731
|
// with a radius of 20:
|
|
5197
5732
|
var circle = new Path.Circle({
|
|
@@ -5203,7 +5738,7 @@ var circle = new Path.Circle({
|
|
|
5203
5738
|
// Scale the path by 150% from its center point
|
|
5204
5739
|
circle.scale(1.5);
|
|
5205
5740
|
</script>
|
|
5206
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5741
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
5207
5742
|
</div>
|
|
5208
5743
|
|
|
5209
5744
|
|
|
@@ -5215,7 +5750,7 @@ circle.scale(1.5);
|
|
|
5215
5750
|
<div class="button run">Run</div>
|
|
5216
5751
|
</div>
|
|
5217
5752
|
|
|
5218
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5753
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5219
5754
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5220
5755
|
// with a radius of 20:
|
|
5221
5756
|
var circle = new Path.Circle({
|
|
@@ -5227,7 +5762,7 @@ var circle = new Path.Circle({
|
|
|
5227
5762
|
// Scale the path 150% from its bottom left corner
|
|
5228
5763
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5229
5764
|
</script>
|
|
5230
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5765
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
5231
5766
|
</div>
|
|
5232
5767
|
|
|
5233
5768
|
|
|
@@ -5283,7 +5818,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5283
5818
|
<div class="button run">Run</div>
|
|
5284
5819
|
</div>
|
|
5285
5820
|
|
|
5286
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5821
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5287
5822
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5288
5823
|
// with a radius of 20:
|
|
5289
5824
|
var circle = new Path.Circle({
|
|
@@ -5295,7 +5830,7 @@ var circle = new Path.Circle({
|
|
|
5295
5830
|
// Scale the path horizontally by 300%
|
|
5296
5831
|
circle.scale(3, 1);
|
|
5297
5832
|
</script>
|
|
5298
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5833
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5299
5834
|
</div>
|
|
5300
5835
|
|
|
5301
5836
|
|
|
@@ -5733,7 +6268,7 @@ circle.scale(3, 1);
|
|
|
5733
6268
|
<div class="button run">Run</div>
|
|
5734
6269
|
</div>
|
|
5735
6270
|
|
|
5736
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6271
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5737
6272
|
// Create a rectangle shaped path with its top left corner
|
|
5738
6273
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5739
6274
|
var path = new Path.Rectangle({
|
|
@@ -5754,7 +6289,7 @@ var circlePath = new Path.Circle({
|
|
|
5754
6289
|
// the rectangular path:
|
|
5755
6290
|
circlePath.fitBounds(path.bounds);
|
|
5756
6291
|
</script>
|
|
5757
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6292
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5758
6293
|
</div>
|
|
5759
6294
|
|
|
5760
6295
|
|
|
@@ -5766,7 +6301,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5766
6301
|
<div class="button run">Run</div>
|
|
5767
6302
|
</div>
|
|
5768
6303
|
|
|
5769
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6304
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5770
6305
|
// Create a rectangle shaped path with its top left corner
|
|
5771
6306
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5772
6307
|
var path = new Path.Rectangle({
|
|
@@ -5787,7 +6322,7 @@ var circlePath = new Path.Circle({
|
|
|
5787
6322
|
// the rectangular path:
|
|
5788
6323
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
5789
6324
|
</script>
|
|
5790
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6325
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5791
6326
|
</div>
|
|
5792
6327
|
|
|
5793
6328
|
|
|
@@ -5799,7 +6334,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
5799
6334
|
<div class="button run">Run</div>
|
|
5800
6335
|
</div>
|
|
5801
6336
|
|
|
5802
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6337
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5803
6338
|
var path = new Path.Circle({
|
|
5804
6339
|
center: [80, 50],
|
|
5805
6340
|
radius: 30,
|
|
@@ -5809,7 +6344,7 @@ var path = new Path.Circle({
|
|
|
5809
6344
|
// Fit the path to the bounding rectangle of the view:
|
|
5810
6345
|
path.fitBounds(view.bounds);
|
|
5811
6346
|
</script>
|
|
5812
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6347
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-48"></canvas></div>
|
|
5813
6348
|
</div>
|
|
5814
6349
|
|
|
5815
6350
|
|
|
@@ -5835,7 +6370,7 @@ path.fitBounds(view.bounds);
|
|
|
5835
6370
|
<li>
|
|
5836
6371
|
<tt>type:</tt>
|
|
5837
6372
|
<tt>String</tt>
|
|
5838
|
-
— 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>
|
|
6373
|
+
— 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>
|
|
5839
6374
|
|
|
5840
6375
|
</li>
|
|
5841
6376
|
|
|
@@ -5870,7 +6405,7 @@ path.fitBounds(view.bounds);
|
|
|
5870
6405
|
<div class="button run">Run</div>
|
|
5871
6406
|
</div>
|
|
5872
6407
|
|
|
5873
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6408
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
5874
6409
|
// Create a circle shaped path at the center of the view:
|
|
5875
6410
|
var path = new Path.Circle({
|
|
5876
6411
|
center: view.center,
|
|
@@ -5888,7 +6423,7 @@ path.on('mouseleave', function() {
|
|
|
5888
6423
|
this.fillColor = 'black';
|
|
5889
6424
|
});
|
|
5890
6425
|
</script>
|
|
5891
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6426
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
5892
6427
|
</div>
|
|
5893
6428
|
|
|
5894
6429
|
|
|
@@ -5912,7 +6447,7 @@ path.on('mouseleave', function() {
|
|
|
5912
6447
|
<li>
|
|
5913
6448
|
<tt>object:</tt>
|
|
5914
6449
|
<tt>Object</tt>
|
|
5915
|
-
— 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>
|
|
6450
|
+
— 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>
|
|
5916
6451
|
|
|
5917
6452
|
</li>
|
|
5918
6453
|
|
|
@@ -5940,7 +6475,7 @@ path.on('mouseleave', function() {
|
|
|
5940
6475
|
<div class="button run">Run</div>
|
|
5941
6476
|
</div>
|
|
5942
6477
|
|
|
5943
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6478
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
5944
6479
|
// Create a circle shaped path at the center of the view:
|
|
5945
6480
|
var path = new Path.Circle({
|
|
5946
6481
|
center: view.center,
|
|
@@ -5958,7 +6493,7 @@ path.on({
|
|
|
5958
6493
|
}
|
|
5959
6494
|
});
|
|
5960
6495
|
</script>
|
|
5961
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6496
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
5962
6497
|
</div>
|
|
5963
6498
|
|
|
5964
6499
|
|
|
@@ -5970,7 +6505,7 @@ path.on({
|
|
|
5970
6505
|
<div class="button run">Run</div>
|
|
5971
6506
|
</div>
|
|
5972
6507
|
|
|
5973
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6508
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
5974
6509
|
var pathHandlers = {
|
|
5975
6510
|
mouseenter: function(event) {
|
|
5976
6511
|
this.fillColor = 'red';
|
|
@@ -5993,7 +6528,7 @@ function onMouseDown(event) {
|
|
|
5993
6528
|
path.on(pathHandlers);
|
|
5994
6529
|
}
|
|
5995
6530
|
</script>
|
|
5996
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6531
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
5997
6532
|
</div>
|
|
5998
6533
|
|
|
5999
6534
|
|
|
@@ -6017,7 +6552,7 @@ function onMouseDown(event) {
|
|
|
6017
6552
|
<li>
|
|
6018
6553
|
<tt>type:</tt>
|
|
6019
6554
|
<tt>String</tt>
|
|
6020
|
-
— 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>
|
|
6555
|
+
— 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>
|
|
6021
6556
|
|
|
6022
6557
|
</li>
|
|
6023
6558
|
|
|
@@ -6065,7 +6600,7 @@ function onMouseDown(event) {
|
|
|
6065
6600
|
<li>
|
|
6066
6601
|
<tt>object:</tt>
|
|
6067
6602
|
<tt>Object</tt>
|
|
6068
|
-
— 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>
|
|
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>, <tt>draw</tt>, <tt>drawselection</tt>
|
|
6069
6604
|
|
|
6070
6605
|
</li>
|
|
6071
6606
|
|
|
@@ -6106,7 +6641,7 @@ function onMouseDown(event) {
|
|
|
6106
6641
|
<li>
|
|
6107
6642
|
<tt>type:</tt>
|
|
6108
6643
|
<tt>String</tt>
|
|
6109
|
-
— 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>
|
|
6644
|
+
— 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>
|
|
6110
6645
|
|
|
6111
6646
|
</li>
|
|
6112
6647
|
|
|
@@ -6154,7 +6689,7 @@ function onMouseDown(event) {
|
|
|
6154
6689
|
<li>
|
|
6155
6690
|
<tt>type:</tt>
|
|
6156
6691
|
<tt>String</tt>
|
|
6157
|
-
— 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>
|
|
6692
|
+
— 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>
|
|
6158
6693
|
|
|
6159
6694
|
</li>
|
|
6160
6695
|
|
|
@@ -6221,7 +6756,7 @@ function onMouseDown(event) {
|
|
|
6221
6756
|
<div class="button run">Run</div>
|
|
6222
6757
|
</div>
|
|
6223
6758
|
|
|
6224
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6759
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6225
6760
|
function onMouseDrag(event) {
|
|
6226
6761
|
// Create a circle shaped path at the mouse position,
|
|
6227
6762
|
// with a radius of 10:
|
|
@@ -6238,7 +6773,7 @@ function onMouseDrag(event) {
|
|
|
6238
6773
|
});
|
|
6239
6774
|
}
|
|
6240
6775
|
</script>
|
|
6241
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6776
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-52"></canvas></div>
|
|
6242
6777
|
</div>
|
|
6243
6778
|
|
|
6244
6779
|
|
|
@@ -6268,7 +6803,7 @@ function onMouseDrag(event) {
|
|
|
6268
6803
|
<div class="button run">Run</div>
|
|
6269
6804
|
</div>
|
|
6270
6805
|
|
|
6271
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6806
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6272
6807
|
function onMouseMove(event) {
|
|
6273
6808
|
// Create a circle shaped path at the mouse position,
|
|
6274
6809
|
// with a radius of 10:
|
|
@@ -6282,7 +6817,7 @@ function onMouseMove(event) {
|
|
|
6282
6817
|
path.removeOnMove();
|
|
6283
6818
|
}
|
|
6284
6819
|
</script>
|
|
6285
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6820
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
|
|
6286
6821
|
</div>
|
|
6287
6822
|
|
|
6288
6823
|
|
|
@@ -6312,7 +6847,7 @@ function onMouseMove(event) {
|
|
|
6312
6847
|
<div class="button run">Run</div>
|
|
6313
6848
|
</div>
|
|
6314
6849
|
|
|
6315
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6850
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6316
6851
|
function onMouseDown(event) {
|
|
6317
6852
|
// Create a circle shaped path at the mouse position,
|
|
6318
6853
|
// with a radius of 10:
|
|
@@ -6326,7 +6861,7 @@ function onMouseDown(event) {
|
|
|
6326
6861
|
path.removeOnDown();
|
|
6327
6862
|
}
|
|
6328
6863
|
</script>
|
|
6329
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6864
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6330
6865
|
</div>
|
|
6331
6866
|
|
|
6332
6867
|
|
|
@@ -6356,7 +6891,7 @@ function onMouseDown(event) {
|
|
|
6356
6891
|
<div class="button run">Run</div>
|
|
6357
6892
|
</div>
|
|
6358
6893
|
|
|
6359
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6894
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6360
6895
|
function onMouseDrag(event) {
|
|
6361
6896
|
// Create a circle shaped path at the mouse position,
|
|
6362
6897
|
// with a radius of 10:
|
|
@@ -6370,7 +6905,7 @@ function onMouseDrag(event) {
|
|
|
6370
6905
|
path.removeOnDrag();
|
|
6371
6906
|
}
|
|
6372
6907
|
</script>
|
|
6373
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6908
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6374
6909
|
</div>
|
|
6375
6910
|
|
|
6376
6911
|
|
|
@@ -6400,7 +6935,7 @@ function onMouseDrag(event) {
|
|
|
6400
6935
|
<div class="button run">Run</div>
|
|
6401
6936
|
</div>
|
|
6402
6937
|
|
|
6403
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6938
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6404
6939
|
function onMouseDown(event) {
|
|
6405
6940
|
// Create a circle shaped path at the mouse position,
|
|
6406
6941
|
// with a radius of 10:
|
|
@@ -6414,7 +6949,7 @@ function onMouseDown(event) {
|
|
|
6414
6949
|
path.removeOnUp();
|
|
6415
6950
|
}
|
|
6416
6951
|
</script>
|
|
6417
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6952
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6418
6953
|
</div>
|
|
6419
6954
|
|
|
6420
6955
|
|
|
@@ -6487,7 +7022,7 @@ function onMouseDown(event) {
|
|
|
6487
7022
|
<div class="button run">Run</div>
|
|
6488
7023
|
</div>
|
|
6489
7024
|
|
|
6490
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7025
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6491
7026
|
var path = new Path.Circle({
|
|
6492
7027
|
radius: view.bounds.height * 0.4,
|
|
6493
7028
|
center: view.center
|
|
@@ -6498,7 +7033,7 @@ path.tween(
|
|
|
6498
7033
|
3000
|
|
6499
7034
|
);
|
|
6500
7035
|
</script>
|
|
6501
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7036
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
|
|
6502
7037
|
</div>
|
|
6503
7038
|
|
|
6504
7039
|
|
|
@@ -6510,7 +7045,7 @@ path.tween(
|
|
|
6510
7045
|
<div class="button run">Run</div>
|
|
6511
7046
|
</div>
|
|
6512
7047
|
|
|
6513
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7048
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6514
7049
|
var path = new Shape.Rectangle({
|
|
6515
7050
|
fillColor: 'red',
|
|
6516
7051
|
center: [50, view.center.y],
|
|
@@ -6525,7 +7060,7 @@ path.tween({
|
|
|
6525
7060
|
duration: 2000
|
|
6526
7061
|
});
|
|
6527
7062
|
</script>
|
|
6528
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7063
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
6529
7064
|
</div>
|
|
6530
7065
|
|
|
6531
7066
|
|
|
@@ -6591,7 +7126,7 @@ path.tween({
|
|
|
6591
7126
|
<div class="button run">Run</div>
|
|
6592
7127
|
</div>
|
|
6593
7128
|
|
|
6594
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7129
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6595
7130
|
var path = new Path.Rectangle({
|
|
6596
7131
|
size: [100, 100],
|
|
6597
7132
|
position: view.center,
|
|
@@ -6605,7 +7140,7 @@ path.tween({
|
|
|
6605
7140
|
'segments[2].point.x': '-= 50'
|
|
6606
7141
|
}, 3000);
|
|
6607
7142
|
</script>
|
|
6608
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7143
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
|
|
6609
7144
|
</div>
|
|
6610
7145
|
|
|
6611
7146
|
|
|
@@ -6664,7 +7199,7 @@ path.tween({
|
|
|
6664
7199
|
<div class="button run">Run</div>
|
|
6665
7200
|
</div>
|
|
6666
7201
|
|
|
6667
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7202
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6668
7203
|
var path = new Path.Circle({
|
|
6669
7204
|
fillColor: 'blue',
|
|
6670
7205
|
radius: view.bounds.height * 0.4,
|
|
@@ -6680,7 +7215,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6680
7215
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6681
7216
|
};
|
|
6682
7217
|
</script>
|
|
6683
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7218
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
|
|
6684
7219
|
</div>
|
|
6685
7220
|
|
|
6686
7221
|
|
|
@@ -6801,7 +7336,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6801
7336
|
<div class="button run">Run</div>
|
|
6802
7337
|
</div>
|
|
6803
7338
|
|
|
6804
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7339
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6805
7340
|
var path = new Path.Circle({
|
|
6806
7341
|
fillColor: 'blue',
|
|
6807
7342
|
radius: view.bounds.height * 0.4,
|
|
@@ -6809,7 +7344,7 @@ var path = new Path.Circle({
|
|
|
6809
7344
|
});
|
|
6810
7345
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
6811
7346
|
</script>
|
|
6812
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7347
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
6813
7348
|
</div>
|
|
6814
7349
|
|
|
6815
7350
|
|
|
@@ -6883,7 +7418,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
6883
7418
|
|
|
6884
7419
|
<!-- =========================== copyright notice ========================== -->
|
|
6885
7420
|
<p class="footer">
|
|
6886
|
-
Paper.js v0.
|
|
7421
|
+
Paper.js v0.17.0<br>
|
|
6887
7422
|
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>
|
|
6888
7423
|
<div class="content-end"></div>
|
|
6889
7424
|
|