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
|
@@ -188,6 +188,91 @@ console.log(project.activeLayer == firstLayer); // true</code></pre>
|
|
|
188
188
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
189
189
|
|
|
190
190
|
|
|
191
|
+
<div id="effects" class="member">
|
|
192
|
+
<div class="member-link">
|
|
193
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
194
|
+
</div>
|
|
195
|
+
<div class="member-description hidden">
|
|
196
|
+
|
|
197
|
+
<div class="member-text">
|
|
198
|
+
<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,
|
|
199
|
+
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>
|
|
200
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
201
|
+
<ul>
|
|
202
|
+
<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>
|
|
203
|
+
<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>
|
|
204
|
+
</ul>
|
|
205
|
+
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
<ul class="member-list">
|
|
209
|
+
<h4>Type:</h4>
|
|
210
|
+
<li>
|
|
211
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
212
|
+
</li>
|
|
213
|
+
</ul>
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
<h4>Example:</h4>
|
|
217
|
+
|
|
218
|
+
<div class="paperscript split">
|
|
219
|
+
|
|
220
|
+
<div class="buttons">
|
|
221
|
+
<div class="button run">Run</div>
|
|
222
|
+
</div>
|
|
223
|
+
|
|
224
|
+
<script type="text/paperscript" canvas="canvas-1">
|
|
225
|
+
var path = new Path.Star({
|
|
226
|
+
center: view.center,
|
|
227
|
+
points: 5,
|
|
228
|
+
radius1: 20,
|
|
229
|
+
radius2: 40,
|
|
230
|
+
strokeColor: 'black',
|
|
231
|
+
strokeWidth: 8
|
|
232
|
+
});
|
|
233
|
+
path.effects = [
|
|
234
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
235
|
+
{ type: 'outline' }
|
|
236
|
+
];
|
|
237
|
+
</script>
|
|
238
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
|
|
239
|
+
</div>
|
|
240
|
+
|
|
241
|
+
|
|
242
|
+
</div>
|
|
243
|
+
|
|
244
|
+
</div>
|
|
245
|
+
</div>
|
|
246
|
+
|
|
247
|
+
|
|
248
|
+
<div id="previewbounds-matrix" class="member">
|
|
249
|
+
<div class="member-link">
|
|
250
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
251
|
+
</div>
|
|
252
|
+
<div class="member-description hidden">
|
|
253
|
+
|
|
254
|
+
<div class="member-text">
|
|
255
|
+
<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>
|
|
256
|
+
|
|
257
|
+
<p>Read only.</p>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
|
|
261
|
+
<ul class="member-list">
|
|
262
|
+
<h4>Type:</h4>
|
|
263
|
+
<li>
|
|
264
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
265
|
+
</li>
|
|
266
|
+
</ul>
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
|
|
270
|
+
</div>
|
|
271
|
+
|
|
272
|
+
</div>
|
|
273
|
+
</div>
|
|
274
|
+
|
|
275
|
+
|
|
191
276
|
<div id="key" class="member">
|
|
192
277
|
<div class="member-link">
|
|
193
278
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -300,7 +385,7 @@ console.log(project.activeLayer == firstLayer); // true</code></pre>
|
|
|
300
385
|
<div class="button run">Run</div>
|
|
301
386
|
</div>
|
|
302
387
|
|
|
303
|
-
<script type="text/paperscript" canvas="canvas-
|
|
388
|
+
<script type="text/paperscript" canvas="canvas-2">
|
|
304
389
|
var path = new Path.Circle({
|
|
305
390
|
center: [80, 50],
|
|
306
391
|
radius: 35
|
|
@@ -315,7 +400,7 @@ group.addChild(path);
|
|
|
315
400
|
// The path can be accessed by name:
|
|
316
401
|
group.children['example'].fillColor = 'red';
|
|
317
402
|
</script>
|
|
318
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
403
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
|
|
319
404
|
</div>
|
|
320
405
|
|
|
321
406
|
|
|
@@ -353,7 +438,7 @@ group.children['example'].fillColor = 'red';
|
|
|
353
438
|
<div class="button run">Run</div>
|
|
354
439
|
</div>
|
|
355
440
|
|
|
356
|
-
<script type="text/paperscript" canvas="canvas-
|
|
441
|
+
<script type="text/paperscript" canvas="canvas-3">
|
|
357
442
|
var circle = new Path.Circle({
|
|
358
443
|
center: [80, 50],
|
|
359
444
|
radius: 30
|
|
@@ -364,7 +449,7 @@ circle.style = {
|
|
|
364
449
|
strokeWidth: 5
|
|
365
450
|
};
|
|
366
451
|
</script>
|
|
367
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
452
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
|
|
368
453
|
</div>
|
|
369
454
|
|
|
370
455
|
|
|
@@ -376,7 +461,7 @@ circle.style = {
|
|
|
376
461
|
<div class="button run">Run</div>
|
|
377
462
|
</div>
|
|
378
463
|
|
|
379
|
-
<script type="text/paperscript" canvas="canvas-
|
|
464
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
380
465
|
var path = new Path.Circle({
|
|
381
466
|
center: [50, 50],
|
|
382
467
|
radius: 30,
|
|
@@ -391,7 +476,7 @@ var path2 = new Path.Circle({
|
|
|
391
476
|
// Copy the path style of path:
|
|
392
477
|
path2.style = path.style;
|
|
393
478
|
</script>
|
|
394
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
479
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
|
|
395
480
|
</div>
|
|
396
481
|
|
|
397
482
|
|
|
@@ -403,7 +488,7 @@ path2.style = path.style;
|
|
|
403
488
|
<div class="button run">Run</div>
|
|
404
489
|
</div>
|
|
405
490
|
|
|
406
|
-
<script type="text/paperscript" canvas="canvas-
|
|
491
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
407
492
|
var myStyle = {
|
|
408
493
|
fillColor: 'red',
|
|
409
494
|
strokeColor: 'blue',
|
|
@@ -422,7 +507,7 @@ var path2 = new Path.Circle({
|
|
|
422
507
|
});
|
|
423
508
|
path2.style = myStyle;
|
|
424
509
|
</script>
|
|
425
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
510
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
426
511
|
</div>
|
|
427
512
|
|
|
428
513
|
|
|
@@ -464,7 +549,7 @@ path2.style = myStyle;
|
|
|
464
549
|
<div class="button run">Run</div>
|
|
465
550
|
</div>
|
|
466
551
|
|
|
467
|
-
<script type="text/paperscript" canvas="canvas-
|
|
552
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
468
553
|
var unlockedItem = new Path.Circle({
|
|
469
554
|
center: view.center - [35, 0],
|
|
470
555
|
radius: 30,
|
|
@@ -491,7 +576,7 @@ new PointText({
|
|
|
491
576
|
justification: 'center'
|
|
492
577
|
});
|
|
493
578
|
</script>
|
|
494
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
579
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
495
580
|
</div>
|
|
496
581
|
|
|
497
582
|
|
|
@@ -533,7 +618,7 @@ new PointText({
|
|
|
533
618
|
<div class="button run">Run</div>
|
|
534
619
|
</div>
|
|
535
620
|
|
|
536
|
-
<script type="text/paperscript" canvas="canvas-
|
|
621
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
537
622
|
var path = new Path.Circle({
|
|
538
623
|
center: [50, 50],
|
|
539
624
|
radius: 20,
|
|
@@ -543,7 +628,7 @@ var path = new Path.Circle({
|
|
|
543
628
|
// Hide the path:
|
|
544
629
|
path.visible = false;
|
|
545
630
|
</script>
|
|
546
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
631
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
547
632
|
</div>
|
|
548
633
|
|
|
549
634
|
|
|
@@ -591,7 +676,7 @@ path.visible = false;
|
|
|
591
676
|
<div class="button run">Run</div>
|
|
592
677
|
</div>
|
|
593
678
|
|
|
594
|
-
<script type="text/paperscript" canvas="canvas-
|
|
679
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
595
680
|
// Create a white rectangle in the background
|
|
596
681
|
// with the same dimensions as the view:
|
|
597
682
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -612,7 +697,7 @@ var circle2 = new Path.Circle({
|
|
|
612
697
|
// Set the blend mode of circle2:
|
|
613
698
|
circle2.blendMode = 'multiply';
|
|
614
699
|
</script>
|
|
615
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
700
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
616
701
|
</div>
|
|
617
702
|
|
|
618
703
|
|
|
@@ -654,7 +739,7 @@ circle2.blendMode = 'multiply';
|
|
|
654
739
|
<div class="button run">Run</div>
|
|
655
740
|
</div>
|
|
656
741
|
|
|
657
|
-
<script type="text/paperscript" canvas="canvas-
|
|
742
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
658
743
|
var circle = new Path.Circle({
|
|
659
744
|
center: [80, 50],
|
|
660
745
|
radius: 35,
|
|
@@ -672,7 +757,7 @@ var circle2 = new Path.Circle({
|
|
|
672
757
|
// Make circle2 50% transparent:
|
|
673
758
|
circle2.opacity = 0.5;
|
|
674
759
|
</script>
|
|
675
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
760
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
676
761
|
</div>
|
|
677
762
|
|
|
678
763
|
|
|
@@ -795,14 +880,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
795
880
|
<div class="button run">Run</div>
|
|
796
881
|
</div>
|
|
797
882
|
|
|
798
|
-
<script type="text/paperscript" canvas="canvas-
|
|
883
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
799
884
|
var path = new Path.Circle({
|
|
800
885
|
center: [80, 50],
|
|
801
886
|
radius: 35
|
|
802
887
|
});
|
|
803
888
|
path.selected = true; // Select the path
|
|
804
889
|
</script>
|
|
805
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
890
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
806
891
|
</div>
|
|
807
892
|
|
|
808
893
|
|
|
@@ -959,7 +1044,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
959
1044
|
<div class="button run">Run</div>
|
|
960
1045
|
</div>
|
|
961
1046
|
|
|
962
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1047
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
963
1048
|
// Create a circle at position { x: 10, y: 10 }
|
|
964
1049
|
var circle = new Path.Circle({
|
|
965
1050
|
center: new Point(10, 10),
|
|
@@ -973,7 +1058,7 @@ circle.position = new Point(20, 20);
|
|
|
973
1058
|
// Move the circle 100 points to the right and 50 points down
|
|
974
1059
|
circle.position += new Point(100, 50);
|
|
975
1060
|
</script>
|
|
976
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1061
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
977
1062
|
</div>
|
|
978
1063
|
|
|
979
1064
|
|
|
@@ -985,7 +1070,7 @@ circle.position += new Point(100, 50);
|
|
|
985
1070
|
<div class="button run">Run</div>
|
|
986
1071
|
</div>
|
|
987
1072
|
|
|
988
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1073
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
989
1074
|
// Create a circle at position { x: 20, y: 20 }
|
|
990
1075
|
var circle = new Path.Circle({
|
|
991
1076
|
center: new Point(20, 20),
|
|
@@ -996,7 +1081,7 @@ var circle = new Path.Circle({
|
|
|
996
1081
|
// Move the circle 100 points to the right
|
|
997
1082
|
circle.position.x += 100;
|
|
998
1083
|
</script>
|
|
999
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1084
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
1000
1085
|
</div>
|
|
1001
1086
|
|
|
1002
1087
|
|
|
@@ -1522,7 +1607,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1522
1607
|
<div class="button run">Run</div>
|
|
1523
1608
|
</div>
|
|
1524
1609
|
|
|
1525
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1610
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1526
1611
|
var path = new Path.Circle({
|
|
1527
1612
|
center: [80, 50],
|
|
1528
1613
|
radius: 35
|
|
@@ -1535,7 +1620,7 @@ group.addChild(path);
|
|
|
1535
1620
|
// Access the path through the group's children array:
|
|
1536
1621
|
group.children[0].fillColor = 'red';
|
|
1537
1622
|
</script>
|
|
1538
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1623
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1539
1624
|
</div>
|
|
1540
1625
|
|
|
1541
1626
|
|
|
@@ -1547,7 +1632,7 @@ group.children[0].fillColor = 'red';
|
|
|
1547
1632
|
<div class="button run">Run</div>
|
|
1548
1633
|
</div>
|
|
1549
1634
|
|
|
1550
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1635
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1551
1636
|
var path = new Path.Circle({
|
|
1552
1637
|
center: [80, 50],
|
|
1553
1638
|
radius: 35
|
|
@@ -1562,7 +1647,7 @@ group.addChild(path);
|
|
|
1562
1647
|
// The path can be accessed by name:
|
|
1563
1648
|
group.children['example'].fillColor = 'orange';
|
|
1564
1649
|
</script>
|
|
1565
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1650
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1566
1651
|
</div>
|
|
1567
1652
|
|
|
1568
1653
|
|
|
@@ -1574,7 +1659,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1574
1659
|
<div class="button run">Run</div>
|
|
1575
1660
|
</div>
|
|
1576
1661
|
|
|
1577
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1662
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1578
1663
|
var path = new Path.Circle({
|
|
1579
1664
|
center: [80, 50],
|
|
1580
1665
|
radius: 35
|
|
@@ -1586,7 +1671,7 @@ group.children = [path];
|
|
|
1586
1671
|
// The path is the first child of the group:
|
|
1587
1672
|
group.firstChild.fillColor = 'green';
|
|
1588
1673
|
</script>
|
|
1589
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1674
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1590
1675
|
</div>
|
|
1591
1676
|
|
|
1592
1677
|
|
|
@@ -1763,7 +1848,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1763
1848
|
<div class="button run">Run</div>
|
|
1764
1849
|
</div>
|
|
1765
1850
|
|
|
1766
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1851
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1767
1852
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1768
1853
|
// with a radius of 35:
|
|
1769
1854
|
var circle = new Path.Circle({
|
|
@@ -1774,7 +1859,7 @@ var circle = new Path.Circle({
|
|
|
1774
1859
|
// Set its stroke color to RGB red:
|
|
1775
1860
|
circle.strokeColor = new Color(1, 0, 0);
|
|
1776
1861
|
</script>
|
|
1777
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1862
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1778
1863
|
</div>
|
|
1779
1864
|
|
|
1780
1865
|
|
|
@@ -1811,7 +1896,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
1811
1896
|
<div class="button run">Run</div>
|
|
1812
1897
|
</div>
|
|
1813
1898
|
|
|
1814
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1899
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1815
1900
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1816
1901
|
// with a radius of 35:
|
|
1817
1902
|
var circle = new Path.Circle({
|
|
@@ -1823,7 +1908,7 @@ var circle = new Path.Circle({
|
|
|
1823
1908
|
// Set its stroke width to 10:
|
|
1824
1909
|
circle.strokeWidth = 10;
|
|
1825
1910
|
</script>
|
|
1826
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1911
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
1827
1912
|
</div>
|
|
1828
1913
|
|
|
1829
1914
|
|
|
@@ -1870,7 +1955,7 @@ circle.strokeWidth = 10;
|
|
|
1870
1955
|
<div class="button run">Run</div>
|
|
1871
1956
|
</div>
|
|
1872
1957
|
|
|
1873
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1958
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1874
1959
|
var line = new Path({
|
|
1875
1960
|
segments: [[80, 50], [420, 50]],
|
|
1876
1961
|
strokeColor: 'black',
|
|
@@ -1891,7 +1976,7 @@ var line2 = line.clone();
|
|
|
1891
1976
|
line2.position.y += 100;
|
|
1892
1977
|
line2.strokeCap = 'butt';
|
|
1893
1978
|
</script>
|
|
1894
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
1979
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-18"></canvas></div>
|
|
1895
1980
|
</div>
|
|
1896
1981
|
|
|
1897
1982
|
|
|
@@ -1938,7 +2023,7 @@ line2.strokeCap = 'butt';
|
|
|
1938
2023
|
<div class="button run">Run</div>
|
|
1939
2024
|
</div>
|
|
1940
2025
|
|
|
1941
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2026
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1942
2027
|
var path = new Path({
|
|
1943
2028
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
1944
2029
|
strokeColor: 'black',
|
|
@@ -1955,7 +2040,7 @@ var path3 = path2.clone();
|
|
|
1955
2040
|
path3.position.x += path3.bounds.width * 1.5;
|
|
1956
2041
|
path3.strokeJoin = 'bevel';
|
|
1957
2042
|
</script>
|
|
1958
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
2043
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-19"></canvas></div>
|
|
1959
2044
|
</div>
|
|
1960
2045
|
|
|
1961
2046
|
|
|
@@ -2059,7 +2144,7 @@ path3.strokeJoin = 'bevel';
|
|
|
2059
2144
|
<div class="button run">Run</div>
|
|
2060
2145
|
</div>
|
|
2061
2146
|
|
|
2062
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2147
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
2063
2148
|
var path = new Path.Circle({
|
|
2064
2149
|
center: [80, 50],
|
|
2065
2150
|
radius: 40,
|
|
@@ -2070,7 +2155,7 @@ var path = new Path.Circle({
|
|
|
2070
2155
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
2071
2156
|
path.dashArray = [10, 4];
|
|
2072
2157
|
</script>
|
|
2073
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2158
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
2074
2159
|
</div>
|
|
2075
2160
|
|
|
2076
2161
|
|
|
@@ -2105,6 +2190,42 @@ path.dashArray = [10, 4];
|
|
|
2105
2190
|
|
|
2106
2191
|
|
|
2107
2192
|
|
|
2193
|
+
</div>
|
|
2194
|
+
|
|
2195
|
+
</div>
|
|
2196
|
+
</div>
|
|
2197
|
+
|
|
2198
|
+
|
|
2199
|
+
<div id="paintorder" class="member">
|
|
2200
|
+
<div class="member-link">
|
|
2201
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
2202
|
+
</div>
|
|
2203
|
+
<div class="member-description hidden">
|
|
2204
|
+
|
|
2205
|
+
<div class="member-text">
|
|
2206
|
+
<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>
|
|
2207
|
+
|
|
2208
|
+
|
|
2209
|
+
<ul class="member-list">
|
|
2210
|
+
<h4>Values:</h4>
|
|
2211
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
2212
|
+
</ul>
|
|
2213
|
+
|
|
2214
|
+
|
|
2215
|
+
<ul class="member-list">
|
|
2216
|
+
<h4>Default:</h4>
|
|
2217
|
+
<li><tt>'fill'</tt></li>
|
|
2218
|
+
</ul>
|
|
2219
|
+
|
|
2220
|
+
<ul class="member-list">
|
|
2221
|
+
<h4>Type:</h4>
|
|
2222
|
+
<li>
|
|
2223
|
+
<tt>String</tt>
|
|
2224
|
+
</li>
|
|
2225
|
+
</ul>
|
|
2226
|
+
|
|
2227
|
+
|
|
2228
|
+
|
|
2108
2229
|
</div>
|
|
2109
2230
|
|
|
2110
2231
|
</div>
|
|
@@ -2140,7 +2261,7 @@ path.dashArray = [10, 4];
|
|
|
2140
2261
|
<div class="button run">Run</div>
|
|
2141
2262
|
</div>
|
|
2142
2263
|
|
|
2143
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2264
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2144
2265
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2145
2266
|
// with a radius of 35:
|
|
2146
2267
|
var circle = new Path.Circle({
|
|
@@ -2151,7 +2272,7 @@ var circle = new Path.Circle({
|
|
|
2151
2272
|
// Set the fill color of the circle to RGB red:
|
|
2152
2273
|
circle.fillColor = new Color(1, 0, 0);
|
|
2153
2274
|
</script>
|
|
2154
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2275
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2155
2276
|
</div>
|
|
2156
2277
|
|
|
2157
2278
|
|
|
@@ -2226,7 +2347,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2226
2347
|
<div class="button run">Run</div>
|
|
2227
2348
|
</div>
|
|
2228
2349
|
|
|
2229
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2350
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2230
2351
|
var circle = new Path.Circle({
|
|
2231
2352
|
center: [80, 50],
|
|
2232
2353
|
radius: 35,
|
|
@@ -2239,7 +2360,7 @@ var circle = new Path.Circle({
|
|
|
2239
2360
|
shadowOffset: new Point(5, 5)
|
|
2240
2361
|
});
|
|
2241
2362
|
</script>
|
|
2242
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2363
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2243
2364
|
</div>
|
|
2244
2365
|
|
|
2245
2366
|
|
|
@@ -2380,7 +2501,7 @@ var circle = new Path.Circle({
|
|
|
2380
2501
|
<div class="button run">Run</div>
|
|
2381
2502
|
</div>
|
|
2382
2503
|
|
|
2383
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2504
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2384
2505
|
// Create a rectangle shaped path with its top left point at:
|
|
2385
2506
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2386
2507
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2391,7 +2512,7 @@ path.onFrame = function(event) {
|
|
|
2391
2512
|
this.rotate(3);
|
|
2392
2513
|
}
|
|
2393
2514
|
</script>
|
|
2394
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2515
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2395
2516
|
</div>
|
|
2396
2517
|
|
|
2397
2518
|
|
|
@@ -2435,7 +2556,7 @@ path.onFrame = function(event) {
|
|
|
2435
2556
|
<div class="button run">Run</div>
|
|
2436
2557
|
</div>
|
|
2437
2558
|
|
|
2438
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2559
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2439
2560
|
// Create a circle shaped path at the center of the view:
|
|
2440
2561
|
var path = new Path.Circle({
|
|
2441
2562
|
center: view.center,
|
|
@@ -2449,7 +2570,7 @@ path.onMouseDown = function(event) {
|
|
|
2449
2570
|
this.fillColor = 'red';
|
|
2450
2571
|
}
|
|
2451
2572
|
</script>
|
|
2452
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2573
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2453
2574
|
</div>
|
|
2454
2575
|
|
|
2455
2576
|
|
|
@@ -2461,7 +2582,7 @@ path.onMouseDown = function(event) {
|
|
|
2461
2582
|
<div class="button run">Run</div>
|
|
2462
2583
|
</div>
|
|
2463
2584
|
|
|
2464
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2585
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2465
2586
|
// Loop 30 times:
|
|
2466
2587
|
for (var i = 0; i < 30; i++) {
|
|
2467
2588
|
// Create a circle shaped path at a random position
|
|
@@ -2479,7 +2600,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2479
2600
|
}
|
|
2480
2601
|
}
|
|
2481
2602
|
</script>
|
|
2482
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2603
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2483
2604
|
</div>
|
|
2484
2605
|
|
|
2485
2606
|
|
|
@@ -2523,7 +2644,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2523
2644
|
<div class="button run">Run</div>
|
|
2524
2645
|
</div>
|
|
2525
2646
|
|
|
2526
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2647
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2527
2648
|
// Create a circle shaped path at the center of the view:
|
|
2528
2649
|
var path = new Path.Circle({
|
|
2529
2650
|
center: view.center,
|
|
@@ -2536,7 +2657,7 @@ path.onMouseDrag = function(event) {
|
|
|
2536
2657
|
path.position += event.delta;
|
|
2537
2658
|
}
|
|
2538
2659
|
</script>
|
|
2539
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2660
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-26"></canvas></div>
|
|
2540
2661
|
</div>
|
|
2541
2662
|
|
|
2542
2663
|
|
|
@@ -2580,7 +2701,7 @@ path.onMouseDrag = function(event) {
|
|
|
2580
2701
|
<div class="button run">Run</div>
|
|
2581
2702
|
</div>
|
|
2582
2703
|
|
|
2583
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2704
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2584
2705
|
// Create a circle shaped path at the center of the view:
|
|
2585
2706
|
var path = new Path.Circle({
|
|
2586
2707
|
center: view.center,
|
|
@@ -2594,7 +2715,7 @@ path.onMouseUp = function(event) {
|
|
|
2594
2715
|
this.fillColor = 'red';
|
|
2595
2716
|
}
|
|
2596
2717
|
</script>
|
|
2597
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2718
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2598
2719
|
</div>
|
|
2599
2720
|
|
|
2600
2721
|
|
|
@@ -2638,7 +2759,7 @@ path.onMouseUp = function(event) {
|
|
|
2638
2759
|
<div class="button run">Run</div>
|
|
2639
2760
|
</div>
|
|
2640
2761
|
|
|
2641
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2762
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2642
2763
|
// Create a circle shaped path at the center of the view:
|
|
2643
2764
|
var path = new Path.Circle({
|
|
2644
2765
|
center: view.center,
|
|
@@ -2652,7 +2773,7 @@ path.onClick = function(event) {
|
|
|
2652
2773
|
this.fillColor = 'red';
|
|
2653
2774
|
}
|
|
2654
2775
|
</script>
|
|
2655
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2776
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2656
2777
|
</div>
|
|
2657
2778
|
|
|
2658
2779
|
|
|
@@ -2664,7 +2785,7 @@ path.onClick = function(event) {
|
|
|
2664
2785
|
<div class="button run">Run</div>
|
|
2665
2786
|
</div>
|
|
2666
2787
|
|
|
2667
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2788
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2668
2789
|
// Loop 30 times:
|
|
2669
2790
|
for (var i = 0; i < 30; i++) {
|
|
2670
2791
|
// Create a circle shaped path at a random position
|
|
@@ -2682,7 +2803,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2682
2803
|
}
|
|
2683
2804
|
}
|
|
2684
2805
|
</script>
|
|
2685
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2806
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2686
2807
|
</div>
|
|
2687
2808
|
|
|
2688
2809
|
|
|
@@ -2726,7 +2847,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2726
2847
|
<div class="button run">Run</div>
|
|
2727
2848
|
</div>
|
|
2728
2849
|
|
|
2729
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2850
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2730
2851
|
// Create a circle shaped path at the center of the view:
|
|
2731
2852
|
var path = new Path.Circle({
|
|
2732
2853
|
center: view.center,
|
|
@@ -2740,7 +2861,7 @@ path.onDoubleClick = function(event) {
|
|
|
2740
2861
|
this.fillColor = 'red';
|
|
2741
2862
|
}
|
|
2742
2863
|
</script>
|
|
2743
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2864
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2744
2865
|
</div>
|
|
2745
2866
|
|
|
2746
2867
|
|
|
@@ -2752,7 +2873,7 @@ path.onDoubleClick = function(event) {
|
|
|
2752
2873
|
<div class="button run">Run</div>
|
|
2753
2874
|
</div>
|
|
2754
2875
|
|
|
2755
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2876
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2756
2877
|
// Loop 30 times:
|
|
2757
2878
|
for (var i = 0; i < 30; i++) {
|
|
2758
2879
|
// Create a circle shaped path at a random position
|
|
@@ -2770,7 +2891,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2770
2891
|
}
|
|
2771
2892
|
}
|
|
2772
2893
|
</script>
|
|
2773
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2894
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2774
2895
|
</div>
|
|
2775
2896
|
|
|
2776
2897
|
|
|
@@ -2814,7 +2935,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2814
2935
|
<div class="button run">Run</div>
|
|
2815
2936
|
</div>
|
|
2816
2937
|
|
|
2817
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2938
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2818
2939
|
// Create a circle shaped path at the center of the view:
|
|
2819
2940
|
var path = new Path.Circle({
|
|
2820
2941
|
center: view.center,
|
|
@@ -2828,7 +2949,7 @@ path.onMouseMove = function(event) {
|
|
|
2828
2949
|
this.opacity = Math.random();
|
|
2829
2950
|
}
|
|
2830
2951
|
</script>
|
|
2831
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2952
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2832
2953
|
</div>
|
|
2833
2954
|
|
|
2834
2955
|
|
|
@@ -2872,7 +2993,7 @@ path.onMouseMove = function(event) {
|
|
|
2872
2993
|
<div class="button run">Run</div>
|
|
2873
2994
|
</div>
|
|
2874
2995
|
|
|
2875
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2996
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2876
2997
|
// Create a circle shaped path at the center of the view:
|
|
2877
2998
|
var path = new Path.Circle({
|
|
2878
2999
|
center: view.center,
|
|
@@ -2890,7 +3011,7 @@ path.onMouseLeave = function(event) {
|
|
|
2890
3011
|
this.fillColor = 'black';
|
|
2891
3012
|
}
|
|
2892
3013
|
</script>
|
|
2893
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3014
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2894
3015
|
</div>
|
|
2895
3016
|
|
|
2896
3017
|
|
|
@@ -2902,100 +3023,487 @@ path.onMouseLeave = function(event) {
|
|
|
2902
3023
|
<div class="button run">Run</div>
|
|
2903
3024
|
</div>
|
|
2904
3025
|
|
|
2905
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2906
|
-
function enter(event) {
|
|
2907
|
-
this.fillColor = 'red';
|
|
2908
|
-
}
|
|
3026
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
3027
|
+
function enter(event) {
|
|
3028
|
+
this.fillColor = 'red';
|
|
3029
|
+
}
|
|
3030
|
+
|
|
3031
|
+
function leave(event) {
|
|
3032
|
+
this.fillColor = 'black';
|
|
3033
|
+
}
|
|
3034
|
+
|
|
3035
|
+
// When the mouse is pressed:
|
|
3036
|
+
function onMouseDown(event) {
|
|
3037
|
+
// Create a circle shaped path at the position of the mouse:
|
|
3038
|
+
var path = new Path.Circle(event.point, 25);
|
|
3039
|
+
path.fillColor = 'black';
|
|
3040
|
+
|
|
3041
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3042
|
+
path.onMouseEnter = enter;
|
|
3043
|
+
|
|
3044
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3045
|
+
path.onMouseLeave = leave;
|
|
3046
|
+
}
|
|
3047
|
+
</script>
|
|
3048
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3049
|
+
</div>
|
|
3050
|
+
|
|
3051
|
+
|
|
3052
|
+
</div>
|
|
3053
|
+
|
|
3054
|
+
</div>
|
|
3055
|
+
</div>
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
<div id="onmouseleave" class="member">
|
|
3059
|
+
<div class="member-link">
|
|
3060
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
3061
|
+
</div>
|
|
3062
|
+
<div class="member-description hidden">
|
|
3063
|
+
|
|
3064
|
+
<div class="member-text">
|
|
3065
|
+
<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>
|
|
3066
|
+
|
|
3067
|
+
|
|
3068
|
+
|
|
3069
|
+
<ul class="member-list">
|
|
3070
|
+
<h4>Type:</h4>
|
|
3071
|
+
<li>
|
|
3072
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3073
|
+
</li>
|
|
3074
|
+
</ul>
|
|
3075
|
+
|
|
3076
|
+
|
|
3077
|
+
<ul class="member-list">
|
|
3078
|
+
<h4>See also:</h4>
|
|
3079
|
+
|
|
3080
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
3081
|
+
|
|
3082
|
+
</ul>
|
|
3083
|
+
|
|
3084
|
+
<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>
|
|
3085
|
+
|
|
3086
|
+
<div class="paperscript split">
|
|
3087
|
+
|
|
3088
|
+
<div class="buttons">
|
|
3089
|
+
<div class="button run">Run</div>
|
|
3090
|
+
</div>
|
|
3091
|
+
|
|
3092
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
3093
|
+
// Create a circle shaped path at the center of the view:
|
|
3094
|
+
var path = new Path.Circle({
|
|
3095
|
+
center: view.center,
|
|
3096
|
+
radius: 25,
|
|
3097
|
+
fillColor: 'black'
|
|
3098
|
+
});
|
|
3099
|
+
|
|
3100
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
3101
|
+
path.onMouseLeave = function(event) {
|
|
3102
|
+
this.fillColor = 'red';
|
|
3103
|
+
}
|
|
3104
|
+
</script>
|
|
3105
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3106
|
+
</div>
|
|
3107
|
+
|
|
3108
|
+
|
|
3109
|
+
</div>
|
|
3110
|
+
|
|
3111
|
+
</div>
|
|
3112
|
+
</div>
|
|
3113
|
+
|
|
3114
|
+
|
|
3115
|
+
<div id="ondraw" class="member">
|
|
3116
|
+
<div class="member-link">
|
|
3117
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
3118
|
+
</div>
|
|
3119
|
+
<div class="member-description hidden">
|
|
3120
|
+
|
|
3121
|
+
<div class="member-text">
|
|
3122
|
+
<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>
|
|
3123
|
+
|
|
3124
|
+
|
|
3125
|
+
|
|
3126
|
+
<ul class="member-list">
|
|
3127
|
+
<h4>Type:</h4>
|
|
3128
|
+
<li>
|
|
3129
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3130
|
+
</li>
|
|
3131
|
+
</ul>
|
|
3132
|
+
<ul class="member-list">
|
|
3133
|
+
<h4>Options:</h4>
|
|
3134
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
3135
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
3136
|
+
<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>
|
|
3137
|
+
<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>
|
|
3138
|
+
<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>()
|
|
3139
|
+
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>
|
|
3140
|
+
</ul>
|
|
3141
|
+
|
|
3142
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
3143
|
+
|
|
3144
|
+
<div class="paperscript split">
|
|
3145
|
+
|
|
3146
|
+
<div class="buttons">
|
|
3147
|
+
<div class="button run">Run</div>
|
|
3148
|
+
</div>
|
|
3149
|
+
|
|
3150
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3151
|
+
var path = new Path.Circle({
|
|
3152
|
+
center: view.center,
|
|
3153
|
+
radius: 25,
|
|
3154
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3155
|
+
});
|
|
3156
|
+
|
|
3157
|
+
path.onDraw = function(event) {
|
|
3158
|
+
var ctx = event.context,
|
|
3159
|
+
center = this.position,
|
|
3160
|
+
scale = event.matrix.scaling.x;
|
|
3161
|
+
ctx.beginPath();
|
|
3162
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3163
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3164
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3165
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3166
|
+
ctx.lineWidth = 1 / scale;
|
|
3167
|
+
ctx.stroke();
|
|
3168
|
+
}
|
|
3169
|
+
</script>
|
|
3170
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3171
|
+
</div>
|
|
3172
|
+
|
|
3173
|
+
|
|
3174
|
+
</div>
|
|
3175
|
+
|
|
3176
|
+
</div>
|
|
3177
|
+
</div>
|
|
3178
|
+
|
|
3179
|
+
|
|
3180
|
+
<div id="ondrawselection" class="member">
|
|
3181
|
+
<div class="member-link">
|
|
3182
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3183
|
+
</div>
|
|
3184
|
+
<div class="member-description hidden">
|
|
3185
|
+
|
|
3186
|
+
<div class="member-text">
|
|
3187
|
+
<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>
|
|
3188
|
+
|
|
3189
|
+
|
|
3190
|
+
|
|
3191
|
+
<ul class="member-list">
|
|
3192
|
+
<h4>Type:</h4>
|
|
3193
|
+
<li>
|
|
3194
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3195
|
+
</li>
|
|
3196
|
+
</ul>
|
|
3197
|
+
<ul class="member-list">
|
|
3198
|
+
<h4>Options:</h4>
|
|
3199
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3200
|
+
<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>
|
|
3201
|
+
<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>
|
|
3202
|
+
<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>
|
|
3203
|
+
<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>
|
|
3204
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3205
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3206
|
+
</ul>
|
|
3207
|
+
|
|
3208
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3209
|
+
|
|
3210
|
+
<div class="paperscript split">
|
|
3211
|
+
|
|
3212
|
+
<div class="buttons">
|
|
3213
|
+
<div class="button run">Run</div>
|
|
3214
|
+
</div>
|
|
3215
|
+
|
|
3216
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3217
|
+
var path = new Path.Star({
|
|
3218
|
+
center: view.center,
|
|
3219
|
+
points: 5,
|
|
3220
|
+
radius1: 20,
|
|
3221
|
+
radius2: 40,
|
|
3222
|
+
strokeColor: 'black',
|
|
3223
|
+
selected: true
|
|
3224
|
+
});
|
|
3225
|
+
|
|
3226
|
+
path.onDrawSelection = function(event) {
|
|
3227
|
+
var ctx = event.context;
|
|
3228
|
+
this.segments.forEach(function(segment) {
|
|
3229
|
+
var point = event.matrix.transform(segment.point);
|
|
3230
|
+
ctx.beginPath();
|
|
3231
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3232
|
+
ctx.fill();
|
|
3233
|
+
});
|
|
3234
|
+
return false;
|
|
3235
|
+
}
|
|
3236
|
+
</script>
|
|
3237
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3238
|
+
</div>
|
|
3239
|
+
|
|
3240
|
+
|
|
3241
|
+
</div>
|
|
3242
|
+
|
|
3243
|
+
</div>
|
|
3244
|
+
</div>
|
|
3245
|
+
|
|
3246
|
+
</div>
|
|
3247
|
+
|
|
3248
|
+
|
|
3249
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3250
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3251
|
+
|
|
3252
|
+
|
|
3253
|
+
<div id="addeffect-effect" class="member">
|
|
3254
|
+
<div class="member-link">
|
|
3255
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3256
|
+
</div>
|
|
3257
|
+
<div class="member-description hidden">
|
|
3258
|
+
<div class="member-text">
|
|
3259
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3260
|
+
|
|
3261
|
+
|
|
3262
|
+
<ul class="member-list">
|
|
3263
|
+
<h4>Parameters:</h4>
|
|
3264
|
+
|
|
3265
|
+
<li>
|
|
3266
|
+
<tt>effect:</tt>
|
|
3267
|
+
<tt>Object</tt>
|
|
3268
|
+
— the plain object describing the effect
|
|
3269
|
+
|
|
3270
|
+
</li>
|
|
3271
|
+
|
|
3272
|
+
</ul>
|
|
3273
|
+
|
|
3274
|
+
|
|
3275
|
+
<ul class="member-list">
|
|
3276
|
+
<h4>Returns:</h4>
|
|
3277
|
+
|
|
3278
|
+
<li>
|
|
3279
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3280
|
+
</li>
|
|
3281
|
+
|
|
3282
|
+
|
|
3283
|
+
</ul>
|
|
3284
|
+
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
|
|
3288
|
+
|
|
3289
|
+
</div>
|
|
3290
|
+
</div>
|
|
3291
|
+
</div>
|
|
3292
|
+
|
|
3293
|
+
|
|
3294
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3295
|
+
<div class="member-link">
|
|
3296
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3297
|
+
</div>
|
|
3298
|
+
<div class="member-description hidden">
|
|
3299
|
+
<div class="member-text">
|
|
3300
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3301
|
+
|
|
3302
|
+
|
|
3303
|
+
<ul class="member-list">
|
|
3304
|
+
<h4>Parameters:</h4>
|
|
3305
|
+
|
|
3306
|
+
<li>
|
|
3307
|
+
<tt>index:</tt>
|
|
3308
|
+
<tt>Number</tt>
|
|
3309
|
+
— the index at which to insert the effect
|
|
3310
|
+
|
|
3311
|
+
</li>
|
|
3312
|
+
|
|
3313
|
+
<li>
|
|
3314
|
+
<tt>effect:</tt>
|
|
3315
|
+
<tt>Object</tt>
|
|
3316
|
+
— the plain object describing the effect
|
|
3317
|
+
|
|
3318
|
+
</li>
|
|
3319
|
+
|
|
3320
|
+
</ul>
|
|
3321
|
+
|
|
3322
|
+
|
|
3323
|
+
<ul class="member-list">
|
|
3324
|
+
<h4>Returns:</h4>
|
|
3325
|
+
|
|
3326
|
+
<li>
|
|
3327
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3328
|
+
</li>
|
|
3329
|
+
|
|
3330
|
+
|
|
3331
|
+
</ul>
|
|
3332
|
+
|
|
3333
|
+
|
|
3334
|
+
|
|
3335
|
+
|
|
3336
|
+
|
|
3337
|
+
</div>
|
|
3338
|
+
</div>
|
|
3339
|
+
</div>
|
|
3340
|
+
|
|
3341
|
+
|
|
3342
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3343
|
+
<div class="member-link">
|
|
3344
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3345
|
+
</div>
|
|
3346
|
+
<div class="member-description hidden">
|
|
3347
|
+
<div class="member-text">
|
|
3348
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3349
|
+
|
|
3350
|
+
|
|
3351
|
+
<ul class="member-list">
|
|
3352
|
+
<h4>Parameters:</h4>
|
|
3353
|
+
|
|
3354
|
+
<li>
|
|
3355
|
+
<tt>index:</tt>
|
|
3356
|
+
<tt>Number</tt>
|
|
3357
|
+
— the index at which to insert the effects
|
|
3358
|
+
|
|
3359
|
+
</li>
|
|
3360
|
+
|
|
3361
|
+
<li>
|
|
3362
|
+
<tt>effects:</tt>
|
|
3363
|
+
Array of <tt>Object</tt> objects
|
|
3364
|
+
— the plain objects describing the effects
|
|
3365
|
+
|
|
3366
|
+
</li>
|
|
3367
|
+
|
|
3368
|
+
</ul>
|
|
3369
|
+
|
|
3370
|
+
|
|
3371
|
+
<ul class="member-list">
|
|
3372
|
+
<h4>Returns:</h4>
|
|
3373
|
+
|
|
3374
|
+
<li>
|
|
3375
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3376
|
+
</li>
|
|
3377
|
+
|
|
3378
|
+
|
|
3379
|
+
</ul>
|
|
3380
|
+
|
|
3381
|
+
|
|
3382
|
+
|
|
3383
|
+
|
|
3384
|
+
|
|
3385
|
+
</div>
|
|
3386
|
+
</div>
|
|
3387
|
+
</div>
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
<div id="removeeffect-index" class="member">
|
|
3391
|
+
<div class="member-link">
|
|
3392
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
3393
|
+
</div>
|
|
3394
|
+
<div class="member-description hidden">
|
|
3395
|
+
<div class="member-text">
|
|
3396
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3397
|
+
|
|
3398
|
+
|
|
3399
|
+
<ul class="member-list">
|
|
3400
|
+
<h4>Parameters:</h4>
|
|
3401
|
+
|
|
3402
|
+
<li>
|
|
3403
|
+
<tt>index:</tt>
|
|
3404
|
+
<tt>Number</tt>
|
|
3405
|
+
— the index of the effect to remove
|
|
2909
3406
|
|
|
2910
|
-
|
|
2911
|
-
|
|
2912
|
-
|
|
3407
|
+
</li>
|
|
3408
|
+
|
|
3409
|
+
</ul>
|
|
2913
3410
|
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
3411
|
+
|
|
3412
|
+
<ul class="member-list">
|
|
3413
|
+
<h4>Returns:</h4>
|
|
3414
|
+
|
|
3415
|
+
<li>
|
|
3416
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3417
|
+
</li>
|
|
2919
3418
|
|
|
2920
|
-
|
|
2921
|
-
|
|
3419
|
+
|
|
3420
|
+
</ul>
|
|
2922
3421
|
|
|
2923
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2924
|
-
path.onMouseLeave = leave;
|
|
2925
|
-
}
|
|
2926
|
-
</script>
|
|
2927
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2928
|
-
</div>
|
|
2929
3422
|
|
|
2930
3423
|
|
|
3424
|
+
|
|
3425
|
+
|
|
2931
3426
|
</div>
|
|
2932
|
-
|
|
2933
3427
|
</div>
|
|
2934
3428
|
</div>
|
|
2935
3429
|
|
|
2936
3430
|
|
|
2937
|
-
<div id="
|
|
3431
|
+
<div id="removeeffects" class="member">
|
|
2938
3432
|
<div class="member-link">
|
|
2939
|
-
<a name="
|
|
3433
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
2940
3434
|
</div>
|
|
2941
3435
|
<div class="member-description hidden">
|
|
2942
|
-
|
|
2943
3436
|
<div class="member-text">
|
|
2944
|
-
<p>
|
|
3437
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3438
|
+
|
|
2945
3439
|
|
|
3440
|
+
<ul class="member-list">
|
|
3441
|
+
<h4>Parameters:</h4>
|
|
2946
3442
|
|
|
3443
|
+
<li>
|
|
3444
|
+
<tt>start:</tt>
|
|
3445
|
+
<tt>Number</tt>
|
|
3446
|
+
— the index of the first effect to remove
|
|
3447
|
+
— optional, default: <tt>0</tt>
|
|
3448
|
+
</li>
|
|
2947
3449
|
|
|
2948
|
-
<
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
3450
|
+
<li>
|
|
3451
|
+
<tt>end:</tt>
|
|
3452
|
+
<tt>Number</tt>
|
|
3453
|
+
— the index after the last one
|
|
3454
|
+
— optional, default: <tt>effects.length</tt>
|
|
3455
|
+
</li>
|
|
3456
|
+
|
|
3457
|
+
</ul>
|
|
3458
|
+
|
|
2955
3459
|
|
|
2956
3460
|
<ul class="member-list">
|
|
2957
|
-
<h4>
|
|
3461
|
+
<h4>Returns:</h4>
|
|
2958
3462
|
|
|
2959
|
-
<li
|
|
3463
|
+
<li>
|
|
3464
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3465
|
+
</li>
|
|
3466
|
+
|
|
2960
3467
|
|
|
2961
3468
|
</ul>
|
|
2962
3469
|
|
|
2963
|
-
<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>
|
|
2964
3470
|
|
|
2965
|
-
<div class="paperscript split">
|
|
2966
3471
|
|
|
2967
|
-
|
|
2968
|
-
|
|
3472
|
+
|
|
3473
|
+
|
|
3474
|
+
</div>
|
|
3475
|
+
</div>
|
|
2969
3476
|
</div>
|
|
2970
3477
|
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
radius: 25,
|
|
2976
|
-
fillColor: 'black'
|
|
2977
|
-
});
|
|
2978
|
-
|
|
2979
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
2980
|
-
path.onMouseLeave = function(event) {
|
|
2981
|
-
this.fillColor = 'red';
|
|
2982
|
-
}
|
|
2983
|
-
</script>
|
|
2984
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3478
|
+
|
|
3479
|
+
<div id="geteffectoutput" class="member">
|
|
3480
|
+
<div class="member-link">
|
|
3481
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
2985
3482
|
</div>
|
|
3483
|
+
<div class="member-description hidden">
|
|
3484
|
+
<div class="member-text">
|
|
3485
|
+
<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>
|
|
3486
|
+
|
|
3487
|
+
|
|
3488
|
+
|
|
3489
|
+
<ul class="member-list">
|
|
3490
|
+
<h4>Returns:</h4>
|
|
3491
|
+
|
|
3492
|
+
<li>
|
|
3493
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3494
|
+
</li>
|
|
2986
3495
|
|
|
3496
|
+
|
|
3497
|
+
</ul>
|
|
2987
3498
|
|
|
2988
|
-
</div>
|
|
2989
3499
|
|
|
3500
|
+
|
|
3501
|
+
|
|
3502
|
+
|
|
2990
3503
|
</div>
|
|
2991
3504
|
</div>
|
|
2992
|
-
|
|
2993
3505
|
</div>
|
|
2994
3506
|
|
|
2995
|
-
|
|
2996
|
-
<!-- =========================== inherited methods ========================= -->
|
|
2997
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
2998
|
-
|
|
2999
3507
|
|
|
3000
3508
|
<div id="set-props" class="member">
|
|
3001
3509
|
<div class="member-link">
|
|
@@ -3040,7 +3548,7 @@ path.onMouseLeave = function(event) {
|
|
|
3040
3548
|
<div class="button run">Run</div>
|
|
3041
3549
|
</div>
|
|
3042
3550
|
|
|
3043
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3551
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3044
3552
|
var circle = new Path.Circle({
|
|
3045
3553
|
center: [80, 50],
|
|
3046
3554
|
radius: 35
|
|
@@ -3053,7 +3561,7 @@ circle.set({
|
|
|
3053
3561
|
selected: true
|
|
3054
3562
|
});
|
|
3055
3563
|
</script>
|
|
3056
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3564
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3057
3565
|
</div>
|
|
3058
3566
|
|
|
3059
3567
|
|
|
@@ -3109,7 +3617,7 @@ circle.set({
|
|
|
3109
3617
|
<div class="button run">Run</div>
|
|
3110
3618
|
</div>
|
|
3111
3619
|
|
|
3112
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3620
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3113
3621
|
var circle = new Path.Circle({
|
|
3114
3622
|
center: [50, 50],
|
|
3115
3623
|
radius: 10,
|
|
@@ -3124,7 +3632,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3124
3632
|
copy.position.x += i * copy.bounds.width;
|
|
3125
3633
|
}
|
|
3126
3634
|
</script>
|
|
3127
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3635
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3128
3636
|
</div>
|
|
3129
3637
|
|
|
3130
3638
|
|
|
@@ -3250,7 +3758,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3250
3758
|
<div class="button run">Run</div>
|
|
3251
3759
|
</div>
|
|
3252
3760
|
|
|
3253
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3761
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3254
3762
|
var circle = new Path.Circle({
|
|
3255
3763
|
center: [50, 50],
|
|
3256
3764
|
radius: 5,
|
|
@@ -3267,7 +3775,7 @@ raster.position.x += 100;
|
|
|
3267
3775
|
circle.scale(5);
|
|
3268
3776
|
raster.scale(5);
|
|
3269
3777
|
</script>
|
|
3270
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3778
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3271
3779
|
</div>
|
|
3272
3780
|
|
|
3273
3781
|
|
|
@@ -3321,7 +3829,7 @@ raster.scale(5);
|
|
|
3321
3829
|
<div class="button run">Run</div>
|
|
3322
3830
|
</div>
|
|
3323
3831
|
|
|
3324
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3832
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3325
3833
|
var path = new Path.Star({
|
|
3326
3834
|
center: [50, 50],
|
|
3327
3835
|
points: 12,
|
|
@@ -3342,7 +3850,7 @@ function onMouseDown(event) {
|
|
|
3342
3850
|
}
|
|
3343
3851
|
}
|
|
3344
3852
|
</script>
|
|
3345
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3853
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3346
3854
|
</div>
|
|
3347
3855
|
|
|
3348
3856
|
|
|
@@ -3860,11 +4368,17 @@ function onMouseDown(event) {
|
|
|
3860
4368
|
</div>
|
|
3861
4369
|
<div class="member-description hidden">
|
|
3862
4370
|
<div class="member-text">
|
|
3863
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4371
|
+
<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>
|
|
3864
4372
|
<ul class="member-list">
|
|
3865
4373
|
<h4>Options:</h4>
|
|
3866
|
-
<li
|
|
3867
|
-
|
|
4374
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4375
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4376
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4377
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4378
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4379
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4380
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4381
|
+
`options.bounds` the identity matrix is used.</li>
|
|
3868
4382
|
<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>
|
|
3869
4383
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
3870
4384
|
<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>
|
|
@@ -3872,6 +4386,12 @@ function onMouseDown(event) {
|
|
|
3872
4386
|
<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>
|
|
3873
4387
|
<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>
|
|
3874
4388
|
<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>
|
|
4389
|
+
<li>[options.processNode] {Function} the function to process the
|
|
4390
|
+
SVG node made for each exported item, receiving an object with the
|
|
4391
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
4392
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
4393
|
+
is called before the item's name, style, visibility and data are set
|
|
4394
|
+
on the node, which replace attributes of the same names.</li>
|
|
3875
4395
|
</ul>
|
|
3876
4396
|
|
|
3877
4397
|
<ul class="member-list">
|
|
@@ -3914,6 +4434,7 @@ function onMouseDown(event) {
|
|
|
3914
4434
|
<div class="member-text">
|
|
3915
4435
|
<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>
|
|
3916
4436
|
<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>
|
|
4437
|
+
<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>
|
|
3917
4438
|
<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>
|
|
3918
4439
|
<ul class="member-list">
|
|
3919
4440
|
<h4>Options:</h4>
|
|
@@ -3925,6 +4446,13 @@ function onMouseDown(event) {
|
|
|
3925
4446
|
<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>
|
|
3926
4447
|
<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>
|
|
3927
4448
|
<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>
|
|
4449
|
+
<li>[options.processItem] {Function} the function to process the
|
|
4450
|
+
item made for each imported SVG element, receiving an object with
|
|
4451
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
4452
|
+
doesn't import, or return an item to replace it with. It is called
|
|
4453
|
+
after the element's attributes and data are applied to the item, so
|
|
4454
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
4455
|
+
copy them over from `item` as needed.</li>
|
|
3928
4456
|
</ul>
|
|
3929
4457
|
|
|
3930
4458
|
<ul class="member-list">
|
|
@@ -5204,7 +5732,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5204
5732
|
<div class="button run">Run</div>
|
|
5205
5733
|
</div>
|
|
5206
5734
|
|
|
5207
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5735
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
5208
5736
|
// Create a rectangle shaped path with its top left
|
|
5209
5737
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5210
5738
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5213,7 +5741,7 @@ path.fillColor = 'black';
|
|
|
5213
5741
|
// Rotate the path by 30 degrees:
|
|
5214
5742
|
path.rotate(30);
|
|
5215
5743
|
</script>
|
|
5216
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5744
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
5217
5745
|
</div>
|
|
5218
5746
|
|
|
5219
5747
|
|
|
@@ -5225,7 +5753,7 @@ path.rotate(30);
|
|
|
5225
5753
|
<div class="button run">Run</div>
|
|
5226
5754
|
</div>
|
|
5227
5755
|
|
|
5228
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5756
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5229
5757
|
// Create a rectangle shaped path with its top left
|
|
5230
5758
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5231
5759
|
var topLeft = new Point(175, 50);
|
|
@@ -5247,7 +5775,7 @@ function onFrame(event) {
|
|
|
5247
5775
|
path.rotate(3, view.center);
|
|
5248
5776
|
}
|
|
5249
5777
|
</script>
|
|
5250
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5778
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-43"></canvas></div>
|
|
5251
5779
|
</div>
|
|
5252
5780
|
|
|
5253
5781
|
|
|
@@ -5296,7 +5824,7 @@ function onFrame(event) {
|
|
|
5296
5824
|
<div class="button run">Run</div>
|
|
5297
5825
|
</div>
|
|
5298
5826
|
|
|
5299
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5827
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5300
5828
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5301
5829
|
// with a radius of 20:
|
|
5302
5830
|
var circle = new Path.Circle({
|
|
@@ -5308,7 +5836,7 @@ var circle = new Path.Circle({
|
|
|
5308
5836
|
// Scale the path by 150% from its center point
|
|
5309
5837
|
circle.scale(1.5);
|
|
5310
5838
|
</script>
|
|
5311
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5839
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
5312
5840
|
</div>
|
|
5313
5841
|
|
|
5314
5842
|
|
|
@@ -5320,7 +5848,7 @@ circle.scale(1.5);
|
|
|
5320
5848
|
<div class="button run">Run</div>
|
|
5321
5849
|
</div>
|
|
5322
5850
|
|
|
5323
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5851
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5324
5852
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5325
5853
|
// with a radius of 20:
|
|
5326
5854
|
var circle = new Path.Circle({
|
|
@@ -5332,7 +5860,7 @@ var circle = new Path.Circle({
|
|
|
5332
5860
|
// Scale the path 150% from its bottom left corner
|
|
5333
5861
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5334
5862
|
</script>
|
|
5335
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5863
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5336
5864
|
</div>
|
|
5337
5865
|
|
|
5338
5866
|
|
|
@@ -5388,7 +5916,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5388
5916
|
<div class="button run">Run</div>
|
|
5389
5917
|
</div>
|
|
5390
5918
|
|
|
5391
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5919
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5392
5920
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5393
5921
|
// with a radius of 20:
|
|
5394
5922
|
var circle = new Path.Circle({
|
|
@@ -5400,7 +5928,7 @@ var circle = new Path.Circle({
|
|
|
5400
5928
|
// Scale the path horizontally by 300%
|
|
5401
5929
|
circle.scale(3, 1);
|
|
5402
5930
|
</script>
|
|
5403
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5931
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5404
5932
|
</div>
|
|
5405
5933
|
|
|
5406
5934
|
|
|
@@ -5838,7 +6366,7 @@ circle.scale(3, 1);
|
|
|
5838
6366
|
<div class="button run">Run</div>
|
|
5839
6367
|
</div>
|
|
5840
6368
|
|
|
5841
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6369
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5842
6370
|
// Create a rectangle shaped path with its top left corner
|
|
5843
6371
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5844
6372
|
var path = new Path.Rectangle({
|
|
@@ -5859,7 +6387,7 @@ var circlePath = new Path.Circle({
|
|
|
5859
6387
|
// the rectangular path:
|
|
5860
6388
|
circlePath.fitBounds(path.bounds);
|
|
5861
6389
|
</script>
|
|
5862
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6390
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5863
6391
|
</div>
|
|
5864
6392
|
|
|
5865
6393
|
|
|
@@ -5871,7 +6399,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5871
6399
|
<div class="button run">Run</div>
|
|
5872
6400
|
</div>
|
|
5873
6401
|
|
|
5874
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6402
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5875
6403
|
// Create a rectangle shaped path with its top left corner
|
|
5876
6404
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5877
6405
|
var path = new Path.Rectangle({
|
|
@@ -5892,7 +6420,7 @@ var circlePath = new Path.Circle({
|
|
|
5892
6420
|
// the rectangular path:
|
|
5893
6421
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
5894
6422
|
</script>
|
|
5895
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6423
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
5896
6424
|
</div>
|
|
5897
6425
|
|
|
5898
6426
|
|
|
@@ -5904,7 +6432,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
5904
6432
|
<div class="button run">Run</div>
|
|
5905
6433
|
</div>
|
|
5906
6434
|
|
|
5907
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6435
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
5908
6436
|
var path = new Path.Circle({
|
|
5909
6437
|
center: [80, 50],
|
|
5910
6438
|
radius: 30,
|
|
@@ -5914,7 +6442,7 @@ var path = new Path.Circle({
|
|
|
5914
6442
|
// Fit the path to the bounding rectangle of the view:
|
|
5915
6443
|
path.fitBounds(view.bounds);
|
|
5916
6444
|
</script>
|
|
5917
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6445
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
|
|
5918
6446
|
</div>
|
|
5919
6447
|
|
|
5920
6448
|
|
|
@@ -5940,7 +6468,7 @@ path.fitBounds(view.bounds);
|
|
|
5940
6468
|
<li>
|
|
5941
6469
|
<tt>type:</tt>
|
|
5942
6470
|
<tt>String</tt>
|
|
5943
|
-
— 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>
|
|
6471
|
+
— 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>
|
|
5944
6472
|
|
|
5945
6473
|
</li>
|
|
5946
6474
|
|
|
@@ -5975,7 +6503,7 @@ path.fitBounds(view.bounds);
|
|
|
5975
6503
|
<div class="button run">Run</div>
|
|
5976
6504
|
</div>
|
|
5977
6505
|
|
|
5978
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6506
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
5979
6507
|
// Create a circle shaped path at the center of the view:
|
|
5980
6508
|
var path = new Path.Circle({
|
|
5981
6509
|
center: view.center,
|
|
@@ -5993,7 +6521,7 @@ path.on('mouseleave', function() {
|
|
|
5993
6521
|
this.fillColor = 'black';
|
|
5994
6522
|
});
|
|
5995
6523
|
</script>
|
|
5996
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6524
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
5997
6525
|
</div>
|
|
5998
6526
|
|
|
5999
6527
|
|
|
@@ -6017,7 +6545,7 @@ path.on('mouseleave', function() {
|
|
|
6017
6545
|
<li>
|
|
6018
6546
|
<tt>object:</tt>
|
|
6019
6547
|
<tt>Object</tt>
|
|
6020
|
-
— 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>
|
|
6548
|
+
— 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>
|
|
6021
6549
|
|
|
6022
6550
|
</li>
|
|
6023
6551
|
|
|
@@ -6045,7 +6573,7 @@ path.on('mouseleave', function() {
|
|
|
6045
6573
|
<div class="button run">Run</div>
|
|
6046
6574
|
</div>
|
|
6047
6575
|
|
|
6048
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6576
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
6049
6577
|
// Create a circle shaped path at the center of the view:
|
|
6050
6578
|
var path = new Path.Circle({
|
|
6051
6579
|
center: view.center,
|
|
@@ -6063,7 +6591,7 @@ path.on({
|
|
|
6063
6591
|
}
|
|
6064
6592
|
});
|
|
6065
6593
|
</script>
|
|
6066
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6594
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6067
6595
|
</div>
|
|
6068
6596
|
|
|
6069
6597
|
|
|
@@ -6075,7 +6603,7 @@ path.on({
|
|
|
6075
6603
|
<div class="button run">Run</div>
|
|
6076
6604
|
</div>
|
|
6077
6605
|
|
|
6078
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6606
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6079
6607
|
var pathHandlers = {
|
|
6080
6608
|
mouseenter: function(event) {
|
|
6081
6609
|
this.fillColor = 'red';
|
|
@@ -6098,7 +6626,7 @@ function onMouseDown(event) {
|
|
|
6098
6626
|
path.on(pathHandlers);
|
|
6099
6627
|
}
|
|
6100
6628
|
</script>
|
|
6101
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6629
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6102
6630
|
</div>
|
|
6103
6631
|
|
|
6104
6632
|
|
|
@@ -6122,7 +6650,7 @@ function onMouseDown(event) {
|
|
|
6122
6650
|
<li>
|
|
6123
6651
|
<tt>type:</tt>
|
|
6124
6652
|
<tt>String</tt>
|
|
6125
|
-
— 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>
|
|
6653
|
+
— 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>
|
|
6126
6654
|
|
|
6127
6655
|
</li>
|
|
6128
6656
|
|
|
@@ -6170,7 +6698,7 @@ function onMouseDown(event) {
|
|
|
6170
6698
|
<li>
|
|
6171
6699
|
<tt>object:</tt>
|
|
6172
6700
|
<tt>Object</tt>
|
|
6173
|
-
— 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>
|
|
6701
|
+
— 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>
|
|
6174
6702
|
|
|
6175
6703
|
</li>
|
|
6176
6704
|
|
|
@@ -6211,7 +6739,7 @@ function onMouseDown(event) {
|
|
|
6211
6739
|
<li>
|
|
6212
6740
|
<tt>type:</tt>
|
|
6213
6741
|
<tt>String</tt>
|
|
6214
|
-
— 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>
|
|
6742
|
+
— 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>
|
|
6215
6743
|
|
|
6216
6744
|
</li>
|
|
6217
6745
|
|
|
@@ -6259,7 +6787,7 @@ function onMouseDown(event) {
|
|
|
6259
6787
|
<li>
|
|
6260
6788
|
<tt>type:</tt>
|
|
6261
6789
|
<tt>String</tt>
|
|
6262
|
-
— 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>
|
|
6790
|
+
— 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>
|
|
6263
6791
|
|
|
6264
6792
|
</li>
|
|
6265
6793
|
|
|
@@ -6326,7 +6854,7 @@ function onMouseDown(event) {
|
|
|
6326
6854
|
<div class="button run">Run</div>
|
|
6327
6855
|
</div>
|
|
6328
6856
|
|
|
6329
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6857
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6330
6858
|
function onMouseDrag(event) {
|
|
6331
6859
|
// Create a circle shaped path at the mouse position,
|
|
6332
6860
|
// with a radius of 10:
|
|
@@ -6343,7 +6871,7 @@ function onMouseDrag(event) {
|
|
|
6343
6871
|
});
|
|
6344
6872
|
}
|
|
6345
6873
|
</script>
|
|
6346
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6874
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
|
|
6347
6875
|
</div>
|
|
6348
6876
|
|
|
6349
6877
|
|
|
@@ -6373,7 +6901,7 @@ function onMouseDrag(event) {
|
|
|
6373
6901
|
<div class="button run">Run</div>
|
|
6374
6902
|
</div>
|
|
6375
6903
|
|
|
6376
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6904
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6377
6905
|
function onMouseMove(event) {
|
|
6378
6906
|
// Create a circle shaped path at the mouse position,
|
|
6379
6907
|
// with a radius of 10:
|
|
@@ -6387,7 +6915,7 @@ function onMouseMove(event) {
|
|
|
6387
6915
|
path.removeOnMove();
|
|
6388
6916
|
}
|
|
6389
6917
|
</script>
|
|
6390
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6918
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6391
6919
|
</div>
|
|
6392
6920
|
|
|
6393
6921
|
|
|
@@ -6417,7 +6945,7 @@ function onMouseMove(event) {
|
|
|
6417
6945
|
<div class="button run">Run</div>
|
|
6418
6946
|
</div>
|
|
6419
6947
|
|
|
6420
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6948
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6421
6949
|
function onMouseDown(event) {
|
|
6422
6950
|
// Create a circle shaped path at the mouse position,
|
|
6423
6951
|
// with a radius of 10:
|
|
@@ -6431,7 +6959,7 @@ function onMouseDown(event) {
|
|
|
6431
6959
|
path.removeOnDown();
|
|
6432
6960
|
}
|
|
6433
6961
|
</script>
|
|
6434
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6962
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6435
6963
|
</div>
|
|
6436
6964
|
|
|
6437
6965
|
|
|
@@ -6461,7 +6989,7 @@ function onMouseDown(event) {
|
|
|
6461
6989
|
<div class="button run">Run</div>
|
|
6462
6990
|
</div>
|
|
6463
6991
|
|
|
6464
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6992
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6465
6993
|
function onMouseDrag(event) {
|
|
6466
6994
|
// Create a circle shaped path at the mouse position,
|
|
6467
6995
|
// with a radius of 10:
|
|
@@ -6475,7 +7003,7 @@ function onMouseDrag(event) {
|
|
|
6475
7003
|
path.removeOnDrag();
|
|
6476
7004
|
}
|
|
6477
7005
|
</script>
|
|
6478
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7006
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6479
7007
|
</div>
|
|
6480
7008
|
|
|
6481
7009
|
|
|
@@ -6505,7 +7033,7 @@ function onMouseDrag(event) {
|
|
|
6505
7033
|
<div class="button run">Run</div>
|
|
6506
7034
|
</div>
|
|
6507
7035
|
|
|
6508
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7036
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6509
7037
|
function onMouseDown(event) {
|
|
6510
7038
|
// Create a circle shaped path at the mouse position,
|
|
6511
7039
|
// with a radius of 10:
|
|
@@ -6519,7 +7047,7 @@ function onMouseDown(event) {
|
|
|
6519
7047
|
path.removeOnUp();
|
|
6520
7048
|
}
|
|
6521
7049
|
</script>
|
|
6522
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7050
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
|
|
6523
7051
|
</div>
|
|
6524
7052
|
|
|
6525
7053
|
|
|
@@ -6592,7 +7120,7 @@ function onMouseDown(event) {
|
|
|
6592
7120
|
<div class="button run">Run</div>
|
|
6593
7121
|
</div>
|
|
6594
7122
|
|
|
6595
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7123
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6596
7124
|
var path = new Path.Circle({
|
|
6597
7125
|
radius: view.bounds.height * 0.4,
|
|
6598
7126
|
center: view.center
|
|
@@ -6603,7 +7131,7 @@ path.tween(
|
|
|
6603
7131
|
3000
|
|
6604
7132
|
);
|
|
6605
7133
|
</script>
|
|
6606
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7134
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
6607
7135
|
</div>
|
|
6608
7136
|
|
|
6609
7137
|
|
|
@@ -6615,7 +7143,7 @@ path.tween(
|
|
|
6615
7143
|
<div class="button run">Run</div>
|
|
6616
7144
|
</div>
|
|
6617
7145
|
|
|
6618
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7146
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6619
7147
|
var path = new Shape.Rectangle({
|
|
6620
7148
|
fillColor: 'red',
|
|
6621
7149
|
center: [50, view.center.y],
|
|
@@ -6630,7 +7158,7 @@ path.tween({
|
|
|
6630
7158
|
duration: 2000
|
|
6631
7159
|
});
|
|
6632
7160
|
</script>
|
|
6633
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7161
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
6634
7162
|
</div>
|
|
6635
7163
|
|
|
6636
7164
|
|
|
@@ -6696,7 +7224,7 @@ path.tween({
|
|
|
6696
7224
|
<div class="button run">Run</div>
|
|
6697
7225
|
</div>
|
|
6698
7226
|
|
|
6699
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7227
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6700
7228
|
var path = new Path.Rectangle({
|
|
6701
7229
|
size: [100, 100],
|
|
6702
7230
|
position: view.center,
|
|
@@ -6710,7 +7238,7 @@ path.tween({
|
|
|
6710
7238
|
'segments[2].point.x': '-= 50'
|
|
6711
7239
|
}, 3000);
|
|
6712
7240
|
</script>
|
|
6713
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7241
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
|
|
6714
7242
|
</div>
|
|
6715
7243
|
|
|
6716
7244
|
|
|
@@ -6769,7 +7297,7 @@ path.tween({
|
|
|
6769
7297
|
<div class="button run">Run</div>
|
|
6770
7298
|
</div>
|
|
6771
7299
|
|
|
6772
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7300
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6773
7301
|
var path = new Path.Circle({
|
|
6774
7302
|
fillColor: 'blue',
|
|
6775
7303
|
radius: view.bounds.height * 0.4,
|
|
@@ -6785,7 +7313,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6785
7313
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6786
7314
|
};
|
|
6787
7315
|
</script>
|
|
6788
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7316
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
6789
7317
|
</div>
|
|
6790
7318
|
|
|
6791
7319
|
|
|
@@ -6906,7 +7434,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6906
7434
|
<div class="button run">Run</div>
|
|
6907
7435
|
</div>
|
|
6908
7436
|
|
|
6909
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7437
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
6910
7438
|
var path = new Path.Circle({
|
|
6911
7439
|
fillColor: 'blue',
|
|
6912
7440
|
radius: view.bounds.height * 0.4,
|
|
@@ -6914,7 +7442,7 @@ var path = new Path.Circle({
|
|
|
6914
7442
|
});
|
|
6915
7443
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
6916
7444
|
</script>
|
|
6917
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7445
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
6918
7446
|
</div>
|
|
6919
7447
|
|
|
6920
7448
|
|
|
@@ -6957,7 +7485,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
6957
7485
|
<div class="button run">Run</div>
|
|
6958
7486
|
</div>
|
|
6959
7487
|
|
|
6960
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7488
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
6961
7489
|
var star = new Path.Star({
|
|
6962
7490
|
center: view.center,
|
|
6963
7491
|
points: 6,
|
|
@@ -6982,7 +7510,7 @@ function onFrame(event) {
|
|
|
6982
7510
|
circle.position.x = view.center.x + offset;
|
|
6983
7511
|
}
|
|
6984
7512
|
</script>
|
|
6985
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7513
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
6986
7514
|
</div>
|
|
6987
7515
|
|
|
6988
7516
|
|
|
@@ -6999,7 +7527,7 @@ function onFrame(event) {
|
|
|
6999
7527
|
<div class="member-description hidden">
|
|
7000
7528
|
|
|
7001
7529
|
<div class="member-text">
|
|
7002
|
-
<p>Specifies whether the group is isolated, drawn through a temporary canvas, so that the blend modes of its children only apply within it, like CSS’s <code>isolation: isolate</code>. Without it, a compositing mode such as <code>'destination-out'</code> affects everything drawn below the group, also in other layers. Groups with an <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> below 1 or a <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a> are isolated anyway
|
|
7530
|
+
<p>Specifies whether the group is isolated, drawn through a temporary canvas, so that the blend modes of its children only apply within it, like CSS’s <code>isolation: isolate</code>. Without it, a compositing mode such as <code>'destination-out'</code> affects everything drawn below the group, also in other layers. Groups with an <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> below 1 or a <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a> are isolated anyway, and buffered groups always, see <a href="../classes/Group.html#buffered"><tt>buffered</tt></a>.</p>
|
|
7003
7531
|
|
|
7004
7532
|
|
|
7005
7533
|
|
|
@@ -7017,6 +7545,77 @@ function onFrame(event) {
|
|
|
7017
7545
|
|
|
7018
7546
|
|
|
7019
7547
|
|
|
7548
|
+
</div>
|
|
7549
|
+
|
|
7550
|
+
</div>
|
|
7551
|
+
</div>
|
|
7552
|
+
|
|
7553
|
+
|
|
7554
|
+
<div id="buffered" class="member">
|
|
7555
|
+
<div class="member-link">
|
|
7556
|
+
<a name="buffered" href="#buffered"><tt><b>buffered</b></tt></a>
|
|
7557
|
+
</div>
|
|
7558
|
+
<div class="member-description hidden">
|
|
7559
|
+
|
|
7560
|
+
<div class="member-text">
|
|
7561
|
+
<p>Specifies whether the group is buffered: when a view draws it, it draws its content into a canvas of its own, which it keeps, and only draws into it again when something in the group changes, or the part of it that the view shows does, e.g. after zooming or panning. Otherwise, the view only composites the buffer, with the group’s <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> and <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a>. This pays off for large groups and layers that rarely change, such as a complex background below animated items.</p>
|
|
7562
|
+
<p>It doesn’t pay off when the buffer is drawn again on every frame: while the view pans or zooms on every frame, while the group itself is moved or transformed, or when an item inside it is animated. Put animated items into another group or layer instead.</p>
|
|
7563
|
+
<p>The buffer costs memory: it covers the part of the group that the view shows, at up to <code>width × height × 4 × pixelRatio²</code> bytes for a group that fills the whole view.</p>
|
|
7564
|
+
<p>Buffered groups are always <a href="../classes/Group.html#isolated"><tt>isolated</tt></a>: the blend modes of their children only apply within them, not to the items below them, also in other layers.</p>
|
|
7565
|
+
<p>Hit-testing, SVG export, <a href="../classes/Item.html#rasterize"><tt>item.rasterize</tt></a>() and drawing into other canvases than the view’s don’t use the buffer.</p>
|
|
7566
|
+
<p>A buffered group keeps one buffer, so inside a <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> that is placed several times, it draws into it again for each placement. Changes to any symbol definition make all buffers stale, as do forced updates through <code>view.update(true)</code>.</p>
|
|
7567
|
+
|
|
7568
|
+
|
|
7569
|
+
|
|
7570
|
+
<ul class="member-list">
|
|
7571
|
+
<h4>Default:</h4>
|
|
7572
|
+
<li><tt>false</tt></li>
|
|
7573
|
+
</ul>
|
|
7574
|
+
|
|
7575
|
+
<ul class="member-list">
|
|
7576
|
+
<h4>Type:</h4>
|
|
7577
|
+
<li>
|
|
7578
|
+
<tt>Boolean</tt>
|
|
7579
|
+
</li>
|
|
7580
|
+
</ul>
|
|
7581
|
+
|
|
7582
|
+
|
|
7583
|
+
<h4>Example:<span class="description">Draw many circles into a buffered layer, which is drawn once, while the circle in the layer above moves on every frame:</span></h4>
|
|
7584
|
+
|
|
7585
|
+
<div class="paperscript split">
|
|
7586
|
+
|
|
7587
|
+
<div class="buttons">
|
|
7588
|
+
<div class="button run">Run</div>
|
|
7589
|
+
</div>
|
|
7590
|
+
|
|
7591
|
+
<script type="text/paperscript" canvas="canvas-64">
|
|
7592
|
+
var background = project.activeLayer;
|
|
7593
|
+
background.buffered = true;
|
|
7594
|
+
for (var i = 0; i < 2000; i++) {
|
|
7595
|
+
new Path.Circle({
|
|
7596
|
+
center: Point.random() * view.size,
|
|
7597
|
+
radius: 5 + Math.random() * 10,
|
|
7598
|
+
fillColor: { hue: Math.random() * 360, saturation: 0.5,
|
|
7599
|
+
brightness: 1 },
|
|
7600
|
+
opacity: 0.5
|
|
7601
|
+
});
|
|
7602
|
+
}
|
|
7603
|
+
|
|
7604
|
+
var circle = new Path.Circle({
|
|
7605
|
+
center: view.center,
|
|
7606
|
+
radius: 20,
|
|
7607
|
+
fillColor: 'black'
|
|
7608
|
+
});
|
|
7609
|
+
new Layer([circle]);
|
|
7610
|
+
|
|
7611
|
+
function onFrame(event) {
|
|
7612
|
+
circle.position.x = view.center.x + Math.sin(event.time) * 100;
|
|
7613
|
+
}
|
|
7614
|
+
</script>
|
|
7615
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-64"></canvas></div>
|
|
7616
|
+
</div>
|
|
7617
|
+
|
|
7618
|
+
|
|
7020
7619
|
</div>
|
|
7021
7620
|
|
|
7022
7621
|
</div>
|
|
@@ -7063,7 +7662,7 @@ function onFrame(event) {
|
|
|
7063
7662
|
|
|
7064
7663
|
<!-- =========================== copyright notice ========================== -->
|
|
7065
7664
|
<p class="footer">
|
|
7066
|
-
Paper.js v0.
|
|
7665
|
+
Paper.js v0.17.0<br>
|
|
7067
7666
|
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>
|
|
7068
7667
|
<div class="content-end"></div>
|
|
7069
7668
|
|