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
|
@@ -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
|
|
|
@@ -2176,7 +2261,7 @@ path.dashArray = [10, 4];
|
|
|
2176
2261
|
<div class="button run">Run</div>
|
|
2177
2262
|
</div>
|
|
2178
2263
|
|
|
2179
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2264
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2180
2265
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2181
2266
|
// with a radius of 35:
|
|
2182
2267
|
var circle = new Path.Circle({
|
|
@@ -2187,7 +2272,7 @@ var circle = new Path.Circle({
|
|
|
2187
2272
|
// Set the fill color of the circle to RGB red:
|
|
2188
2273
|
circle.fillColor = new Color(1, 0, 0);
|
|
2189
2274
|
</script>
|
|
2190
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2275
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2191
2276
|
</div>
|
|
2192
2277
|
|
|
2193
2278
|
|
|
@@ -2262,7 +2347,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2262
2347
|
<div class="button run">Run</div>
|
|
2263
2348
|
</div>
|
|
2264
2349
|
|
|
2265
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2350
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2266
2351
|
var circle = new Path.Circle({
|
|
2267
2352
|
center: [80, 50],
|
|
2268
2353
|
radius: 35,
|
|
@@ -2275,7 +2360,7 @@ var circle = new Path.Circle({
|
|
|
2275
2360
|
shadowOffset: new Point(5, 5)
|
|
2276
2361
|
});
|
|
2277
2362
|
</script>
|
|
2278
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2363
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2279
2364
|
</div>
|
|
2280
2365
|
|
|
2281
2366
|
|
|
@@ -2416,7 +2501,7 @@ var circle = new Path.Circle({
|
|
|
2416
2501
|
<div class="button run">Run</div>
|
|
2417
2502
|
</div>
|
|
2418
2503
|
|
|
2419
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2504
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2420
2505
|
// Create a rectangle shaped path with its top left point at:
|
|
2421
2506
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2422
2507
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2427,7 +2512,7 @@ path.onFrame = function(event) {
|
|
|
2427
2512
|
this.rotate(3);
|
|
2428
2513
|
}
|
|
2429
2514
|
</script>
|
|
2430
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2515
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2431
2516
|
</div>
|
|
2432
2517
|
|
|
2433
2518
|
|
|
@@ -2471,7 +2556,7 @@ path.onFrame = function(event) {
|
|
|
2471
2556
|
<div class="button run">Run</div>
|
|
2472
2557
|
</div>
|
|
2473
2558
|
|
|
2474
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2559
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2475
2560
|
// Create a circle shaped path at the center of the view:
|
|
2476
2561
|
var path = new Path.Circle({
|
|
2477
2562
|
center: view.center,
|
|
@@ -2485,7 +2570,7 @@ path.onMouseDown = function(event) {
|
|
|
2485
2570
|
this.fillColor = 'red';
|
|
2486
2571
|
}
|
|
2487
2572
|
</script>
|
|
2488
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2573
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2489
2574
|
</div>
|
|
2490
2575
|
|
|
2491
2576
|
|
|
@@ -2497,7 +2582,7 @@ path.onMouseDown = function(event) {
|
|
|
2497
2582
|
<div class="button run">Run</div>
|
|
2498
2583
|
</div>
|
|
2499
2584
|
|
|
2500
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2585
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2501
2586
|
// Loop 30 times:
|
|
2502
2587
|
for (var i = 0; i < 30; i++) {
|
|
2503
2588
|
// Create a circle shaped path at a random position
|
|
@@ -2515,7 +2600,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2515
2600
|
}
|
|
2516
2601
|
}
|
|
2517
2602
|
</script>
|
|
2518
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2603
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2519
2604
|
</div>
|
|
2520
2605
|
|
|
2521
2606
|
|
|
@@ -2559,7 +2644,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2559
2644
|
<div class="button run">Run</div>
|
|
2560
2645
|
</div>
|
|
2561
2646
|
|
|
2562
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2647
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2563
2648
|
// Create a circle shaped path at the center of the view:
|
|
2564
2649
|
var path = new Path.Circle({
|
|
2565
2650
|
center: view.center,
|
|
@@ -2572,7 +2657,7 @@ path.onMouseDrag = function(event) {
|
|
|
2572
2657
|
path.position += event.delta;
|
|
2573
2658
|
}
|
|
2574
2659
|
</script>
|
|
2575
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2660
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-26"></canvas></div>
|
|
2576
2661
|
</div>
|
|
2577
2662
|
|
|
2578
2663
|
|
|
@@ -2616,7 +2701,7 @@ path.onMouseDrag = function(event) {
|
|
|
2616
2701
|
<div class="button run">Run</div>
|
|
2617
2702
|
</div>
|
|
2618
2703
|
|
|
2619
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2704
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2620
2705
|
// Create a circle shaped path at the center of the view:
|
|
2621
2706
|
var path = new Path.Circle({
|
|
2622
2707
|
center: view.center,
|
|
@@ -2630,7 +2715,7 @@ path.onMouseUp = function(event) {
|
|
|
2630
2715
|
this.fillColor = 'red';
|
|
2631
2716
|
}
|
|
2632
2717
|
</script>
|
|
2633
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2718
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2634
2719
|
</div>
|
|
2635
2720
|
|
|
2636
2721
|
|
|
@@ -2674,7 +2759,7 @@ path.onMouseUp = function(event) {
|
|
|
2674
2759
|
<div class="button run">Run</div>
|
|
2675
2760
|
</div>
|
|
2676
2761
|
|
|
2677
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2762
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2678
2763
|
// Create a circle shaped path at the center of the view:
|
|
2679
2764
|
var path = new Path.Circle({
|
|
2680
2765
|
center: view.center,
|
|
@@ -2688,7 +2773,7 @@ path.onClick = function(event) {
|
|
|
2688
2773
|
this.fillColor = 'red';
|
|
2689
2774
|
}
|
|
2690
2775
|
</script>
|
|
2691
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2776
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2692
2777
|
</div>
|
|
2693
2778
|
|
|
2694
2779
|
|
|
@@ -2700,7 +2785,7 @@ path.onClick = function(event) {
|
|
|
2700
2785
|
<div class="button run">Run</div>
|
|
2701
2786
|
</div>
|
|
2702
2787
|
|
|
2703
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2788
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2704
2789
|
// Loop 30 times:
|
|
2705
2790
|
for (var i = 0; i < 30; i++) {
|
|
2706
2791
|
// Create a circle shaped path at a random position
|
|
@@ -2718,7 +2803,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2718
2803
|
}
|
|
2719
2804
|
}
|
|
2720
2805
|
</script>
|
|
2721
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2806
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2722
2807
|
</div>
|
|
2723
2808
|
|
|
2724
2809
|
|
|
@@ -2762,7 +2847,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2762
2847
|
<div class="button run">Run</div>
|
|
2763
2848
|
</div>
|
|
2764
2849
|
|
|
2765
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2850
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2766
2851
|
// Create a circle shaped path at the center of the view:
|
|
2767
2852
|
var path = new Path.Circle({
|
|
2768
2853
|
center: view.center,
|
|
@@ -2776,7 +2861,7 @@ path.onDoubleClick = function(event) {
|
|
|
2776
2861
|
this.fillColor = 'red';
|
|
2777
2862
|
}
|
|
2778
2863
|
</script>
|
|
2779
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2864
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2780
2865
|
</div>
|
|
2781
2866
|
|
|
2782
2867
|
|
|
@@ -2788,7 +2873,7 @@ path.onDoubleClick = function(event) {
|
|
|
2788
2873
|
<div class="button run">Run</div>
|
|
2789
2874
|
</div>
|
|
2790
2875
|
|
|
2791
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2876
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2792
2877
|
// Loop 30 times:
|
|
2793
2878
|
for (var i = 0; i < 30; i++) {
|
|
2794
2879
|
// Create a circle shaped path at a random position
|
|
@@ -2806,7 +2891,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2806
2891
|
}
|
|
2807
2892
|
}
|
|
2808
2893
|
</script>
|
|
2809
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2894
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2810
2895
|
</div>
|
|
2811
2896
|
|
|
2812
2897
|
|
|
@@ -2850,7 +2935,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2850
2935
|
<div class="button run">Run</div>
|
|
2851
2936
|
</div>
|
|
2852
2937
|
|
|
2853
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2938
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2854
2939
|
// Create a circle shaped path at the center of the view:
|
|
2855
2940
|
var path = new Path.Circle({
|
|
2856
2941
|
center: view.center,
|
|
@@ -2864,7 +2949,7 @@ path.onMouseMove = function(event) {
|
|
|
2864
2949
|
this.opacity = Math.random();
|
|
2865
2950
|
}
|
|
2866
2951
|
</script>
|
|
2867
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2952
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2868
2953
|
</div>
|
|
2869
2954
|
|
|
2870
2955
|
|
|
@@ -2908,7 +2993,7 @@ path.onMouseMove = function(event) {
|
|
|
2908
2993
|
<div class="button run">Run</div>
|
|
2909
2994
|
</div>
|
|
2910
2995
|
|
|
2911
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2996
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2912
2997
|
// Create a circle shaped path at the center of the view:
|
|
2913
2998
|
var path = new Path.Circle({
|
|
2914
2999
|
center: view.center,
|
|
@@ -2926,7 +3011,7 @@ path.onMouseLeave = function(event) {
|
|
|
2926
3011
|
this.fillColor = 'black';
|
|
2927
3012
|
}
|
|
2928
3013
|
</script>
|
|
2929
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3014
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2930
3015
|
</div>
|
|
2931
3016
|
|
|
2932
3017
|
|
|
@@ -2938,100 +3023,487 @@ path.onMouseLeave = function(event) {
|
|
|
2938
3023
|
<div class="button run">Run</div>
|
|
2939
3024
|
</div>
|
|
2940
3025
|
|
|
2941
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2942
|
-
function enter(event) {
|
|
2943
|
-
this.fillColor = 'red';
|
|
2944
|
-
}
|
|
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
|
|
2945
3406
|
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
3407
|
+
</li>
|
|
3408
|
+
|
|
3409
|
+
</ul>
|
|
2949
3410
|
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
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>
|
|
2955
3418
|
|
|
2956
|
-
|
|
2957
|
-
|
|
3419
|
+
|
|
3420
|
+
</ul>
|
|
2958
3421
|
|
|
2959
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2960
|
-
path.onMouseLeave = leave;
|
|
2961
|
-
}
|
|
2962
|
-
</script>
|
|
2963
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2964
|
-
</div>
|
|
2965
3422
|
|
|
2966
3423
|
|
|
3424
|
+
|
|
3425
|
+
|
|
2967
3426
|
</div>
|
|
2968
|
-
|
|
2969
3427
|
</div>
|
|
2970
3428
|
</div>
|
|
2971
3429
|
|
|
2972
3430
|
|
|
2973
|
-
<div id="
|
|
3431
|
+
<div id="removeeffects" class="member">
|
|
2974
3432
|
<div class="member-link">
|
|
2975
|
-
<a name="
|
|
3433
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
2976
3434
|
</div>
|
|
2977
3435
|
<div class="member-description hidden">
|
|
2978
|
-
|
|
2979
3436
|
<div class="member-text">
|
|
2980
|
-
<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
|
+
|
|
2981
3439
|
|
|
3440
|
+
<ul class="member-list">
|
|
3441
|
+
<h4>Parameters:</h4>
|
|
2982
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>
|
|
2983
3449
|
|
|
2984
|
-
<
|
|
2985
|
-
|
|
2986
|
-
|
|
2987
|
-
|
|
2988
|
-
|
|
2989
|
-
|
|
2990
|
-
|
|
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
|
+
|
|
2991
3459
|
|
|
2992
3460
|
<ul class="member-list">
|
|
2993
|
-
<h4>
|
|
3461
|
+
<h4>Returns:</h4>
|
|
2994
3462
|
|
|
2995
|
-
<li
|
|
3463
|
+
<li>
|
|
3464
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3465
|
+
</li>
|
|
3466
|
+
|
|
2996
3467
|
|
|
2997
3468
|
</ul>
|
|
2998
3469
|
|
|
2999
|
-
<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>
|
|
3000
3470
|
|
|
3001
|
-
<div class="paperscript split">
|
|
3002
3471
|
|
|
3003
|
-
|
|
3004
|
-
|
|
3472
|
+
|
|
3473
|
+
|
|
3474
|
+
</div>
|
|
3475
|
+
</div>
|
|
3005
3476
|
</div>
|
|
3006
3477
|
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
radius: 25,
|
|
3012
|
-
fillColor: 'black'
|
|
3013
|
-
});
|
|
3014
|
-
|
|
3015
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
3016
|
-
path.onMouseLeave = function(event) {
|
|
3017
|
-
this.fillColor = 'red';
|
|
3018
|
-
}
|
|
3019
|
-
</script>
|
|
3020
|
-
<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>
|
|
3021
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>
|
|
3022
3495
|
|
|
3496
|
+
|
|
3497
|
+
</ul>
|
|
3023
3498
|
|
|
3024
|
-
</div>
|
|
3025
3499
|
|
|
3500
|
+
|
|
3501
|
+
|
|
3502
|
+
|
|
3026
3503
|
</div>
|
|
3027
3504
|
</div>
|
|
3028
|
-
|
|
3029
3505
|
</div>
|
|
3030
3506
|
|
|
3031
|
-
|
|
3032
|
-
<!-- =========================== inherited methods ========================= -->
|
|
3033
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3034
|
-
|
|
3035
3507
|
|
|
3036
3508
|
<div id="set-props" class="member">
|
|
3037
3509
|
<div class="member-link">
|
|
@@ -3076,7 +3548,7 @@ path.onMouseLeave = function(event) {
|
|
|
3076
3548
|
<div class="button run">Run</div>
|
|
3077
3549
|
</div>
|
|
3078
3550
|
|
|
3079
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3551
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3080
3552
|
var circle = new Path.Circle({
|
|
3081
3553
|
center: [80, 50],
|
|
3082
3554
|
radius: 35
|
|
@@ -3089,7 +3561,7 @@ circle.set({
|
|
|
3089
3561
|
selected: true
|
|
3090
3562
|
});
|
|
3091
3563
|
</script>
|
|
3092
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3564
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3093
3565
|
</div>
|
|
3094
3566
|
|
|
3095
3567
|
|
|
@@ -3145,7 +3617,7 @@ circle.set({
|
|
|
3145
3617
|
<div class="button run">Run</div>
|
|
3146
3618
|
</div>
|
|
3147
3619
|
|
|
3148
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3620
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3149
3621
|
var circle = new Path.Circle({
|
|
3150
3622
|
center: [50, 50],
|
|
3151
3623
|
radius: 10,
|
|
@@ -3160,7 +3632,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3160
3632
|
copy.position.x += i * copy.bounds.width;
|
|
3161
3633
|
}
|
|
3162
3634
|
</script>
|
|
3163
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3635
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3164
3636
|
</div>
|
|
3165
3637
|
|
|
3166
3638
|
|
|
@@ -3286,7 +3758,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3286
3758
|
<div class="button run">Run</div>
|
|
3287
3759
|
</div>
|
|
3288
3760
|
|
|
3289
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3761
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3290
3762
|
var circle = new Path.Circle({
|
|
3291
3763
|
center: [50, 50],
|
|
3292
3764
|
radius: 5,
|
|
@@ -3303,7 +3775,7 @@ raster.position.x += 100;
|
|
|
3303
3775
|
circle.scale(5);
|
|
3304
3776
|
raster.scale(5);
|
|
3305
3777
|
</script>
|
|
3306
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3778
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3307
3779
|
</div>
|
|
3308
3780
|
|
|
3309
3781
|
|
|
@@ -3357,7 +3829,7 @@ raster.scale(5);
|
|
|
3357
3829
|
<div class="button run">Run</div>
|
|
3358
3830
|
</div>
|
|
3359
3831
|
|
|
3360
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3832
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3361
3833
|
var path = new Path.Star({
|
|
3362
3834
|
center: [50, 50],
|
|
3363
3835
|
points: 12,
|
|
@@ -3378,7 +3850,7 @@ function onMouseDown(event) {
|
|
|
3378
3850
|
}
|
|
3379
3851
|
}
|
|
3380
3852
|
</script>
|
|
3381
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3853
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3382
3854
|
</div>
|
|
3383
3855
|
|
|
3384
3856
|
|
|
@@ -3896,11 +4368,17 @@ function onMouseDown(event) {
|
|
|
3896
4368
|
</div>
|
|
3897
4369
|
<div class="member-description hidden">
|
|
3898
4370
|
<div class="member-text">
|
|
3899
|
-
<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>
|
|
3900
4372
|
<ul class="member-list">
|
|
3901
4373
|
<h4>Options:</h4>
|
|
3902
|
-
<li
|
|
3903
|
-
|
|
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>
|
|
3904
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>
|
|
3905
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>
|
|
3906
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>
|
|
@@ -5254,7 +5732,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5254
5732
|
<div class="button run">Run</div>
|
|
5255
5733
|
</div>
|
|
5256
5734
|
|
|
5257
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5735
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
5258
5736
|
// Create a rectangle shaped path with its top left
|
|
5259
5737
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5260
5738
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5263,7 +5741,7 @@ path.fillColor = 'black';
|
|
|
5263
5741
|
// Rotate the path by 30 degrees:
|
|
5264
5742
|
path.rotate(30);
|
|
5265
5743
|
</script>
|
|
5266
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5744
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
5267
5745
|
</div>
|
|
5268
5746
|
|
|
5269
5747
|
|
|
@@ -5275,7 +5753,7 @@ path.rotate(30);
|
|
|
5275
5753
|
<div class="button run">Run</div>
|
|
5276
5754
|
</div>
|
|
5277
5755
|
|
|
5278
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5756
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5279
5757
|
// Create a rectangle shaped path with its top left
|
|
5280
5758
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5281
5759
|
var topLeft = new Point(175, 50);
|
|
@@ -5297,7 +5775,7 @@ function onFrame(event) {
|
|
|
5297
5775
|
path.rotate(3, view.center);
|
|
5298
5776
|
}
|
|
5299
5777
|
</script>
|
|
5300
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5778
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-43"></canvas></div>
|
|
5301
5779
|
</div>
|
|
5302
5780
|
|
|
5303
5781
|
|
|
@@ -5346,7 +5824,7 @@ function onFrame(event) {
|
|
|
5346
5824
|
<div class="button run">Run</div>
|
|
5347
5825
|
</div>
|
|
5348
5826
|
|
|
5349
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5827
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5350
5828
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5351
5829
|
// with a radius of 20:
|
|
5352
5830
|
var circle = new Path.Circle({
|
|
@@ -5358,7 +5836,7 @@ var circle = new Path.Circle({
|
|
|
5358
5836
|
// Scale the path by 150% from its center point
|
|
5359
5837
|
circle.scale(1.5);
|
|
5360
5838
|
</script>
|
|
5361
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5839
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
5362
5840
|
</div>
|
|
5363
5841
|
|
|
5364
5842
|
|
|
@@ -5370,7 +5848,7 @@ circle.scale(1.5);
|
|
|
5370
5848
|
<div class="button run">Run</div>
|
|
5371
5849
|
</div>
|
|
5372
5850
|
|
|
5373
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5851
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5374
5852
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5375
5853
|
// with a radius of 20:
|
|
5376
5854
|
var circle = new Path.Circle({
|
|
@@ -5382,7 +5860,7 @@ var circle = new Path.Circle({
|
|
|
5382
5860
|
// Scale the path 150% from its bottom left corner
|
|
5383
5861
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5384
5862
|
</script>
|
|
5385
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5863
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5386
5864
|
</div>
|
|
5387
5865
|
|
|
5388
5866
|
|
|
@@ -5438,7 +5916,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5438
5916
|
<div class="button run">Run</div>
|
|
5439
5917
|
</div>
|
|
5440
5918
|
|
|
5441
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5919
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5442
5920
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5443
5921
|
// with a radius of 20:
|
|
5444
5922
|
var circle = new Path.Circle({
|
|
@@ -5450,7 +5928,7 @@ var circle = new Path.Circle({
|
|
|
5450
5928
|
// Scale the path horizontally by 300%
|
|
5451
5929
|
circle.scale(3, 1);
|
|
5452
5930
|
</script>
|
|
5453
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5931
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5454
5932
|
</div>
|
|
5455
5933
|
|
|
5456
5934
|
|
|
@@ -5888,7 +6366,7 @@ circle.scale(3, 1);
|
|
|
5888
6366
|
<div class="button run">Run</div>
|
|
5889
6367
|
</div>
|
|
5890
6368
|
|
|
5891
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6369
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5892
6370
|
// Create a rectangle shaped path with its top left corner
|
|
5893
6371
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5894
6372
|
var path = new Path.Rectangle({
|
|
@@ -5909,7 +6387,7 @@ var circlePath = new Path.Circle({
|
|
|
5909
6387
|
// the rectangular path:
|
|
5910
6388
|
circlePath.fitBounds(path.bounds);
|
|
5911
6389
|
</script>
|
|
5912
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6390
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5913
6391
|
</div>
|
|
5914
6392
|
|
|
5915
6393
|
|
|
@@ -5921,7 +6399,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5921
6399
|
<div class="button run">Run</div>
|
|
5922
6400
|
</div>
|
|
5923
6401
|
|
|
5924
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6402
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5925
6403
|
// Create a rectangle shaped path with its top left corner
|
|
5926
6404
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5927
6405
|
var path = new Path.Rectangle({
|
|
@@ -5942,7 +6420,7 @@ var circlePath = new Path.Circle({
|
|
|
5942
6420
|
// the rectangular path:
|
|
5943
6421
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
5944
6422
|
</script>
|
|
5945
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6423
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
5946
6424
|
</div>
|
|
5947
6425
|
|
|
5948
6426
|
|
|
@@ -5954,7 +6432,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
5954
6432
|
<div class="button run">Run</div>
|
|
5955
6433
|
</div>
|
|
5956
6434
|
|
|
5957
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6435
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
5958
6436
|
var path = new Path.Circle({
|
|
5959
6437
|
center: [80, 50],
|
|
5960
6438
|
radius: 30,
|
|
@@ -5964,7 +6442,7 @@ var path = new Path.Circle({
|
|
|
5964
6442
|
// Fit the path to the bounding rectangle of the view:
|
|
5965
6443
|
path.fitBounds(view.bounds);
|
|
5966
6444
|
</script>
|
|
5967
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6445
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
|
|
5968
6446
|
</div>
|
|
5969
6447
|
|
|
5970
6448
|
|
|
@@ -5990,7 +6468,7 @@ path.fitBounds(view.bounds);
|
|
|
5990
6468
|
<li>
|
|
5991
6469
|
<tt>type:</tt>
|
|
5992
6470
|
<tt>String</tt>
|
|
5993
|
-
— 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>
|
|
5994
6472
|
|
|
5995
6473
|
</li>
|
|
5996
6474
|
|
|
@@ -6025,7 +6503,7 @@ path.fitBounds(view.bounds);
|
|
|
6025
6503
|
<div class="button run">Run</div>
|
|
6026
6504
|
</div>
|
|
6027
6505
|
|
|
6028
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6506
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
6029
6507
|
// Create a circle shaped path at the center of the view:
|
|
6030
6508
|
var path = new Path.Circle({
|
|
6031
6509
|
center: view.center,
|
|
@@ -6043,7 +6521,7 @@ path.on('mouseleave', function() {
|
|
|
6043
6521
|
this.fillColor = 'black';
|
|
6044
6522
|
});
|
|
6045
6523
|
</script>
|
|
6046
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6524
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
6047
6525
|
</div>
|
|
6048
6526
|
|
|
6049
6527
|
|
|
@@ -6067,7 +6545,7 @@ path.on('mouseleave', function() {
|
|
|
6067
6545
|
<li>
|
|
6068
6546
|
<tt>object:</tt>
|
|
6069
6547
|
<tt>Object</tt>
|
|
6070
|
-
— 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>
|
|
6071
6549
|
|
|
6072
6550
|
</li>
|
|
6073
6551
|
|
|
@@ -6095,7 +6573,7 @@ path.on('mouseleave', function() {
|
|
|
6095
6573
|
<div class="button run">Run</div>
|
|
6096
6574
|
</div>
|
|
6097
6575
|
|
|
6098
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6576
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
6099
6577
|
// Create a circle shaped path at the center of the view:
|
|
6100
6578
|
var path = new Path.Circle({
|
|
6101
6579
|
center: view.center,
|
|
@@ -6113,7 +6591,7 @@ path.on({
|
|
|
6113
6591
|
}
|
|
6114
6592
|
});
|
|
6115
6593
|
</script>
|
|
6116
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6594
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6117
6595
|
</div>
|
|
6118
6596
|
|
|
6119
6597
|
|
|
@@ -6125,7 +6603,7 @@ path.on({
|
|
|
6125
6603
|
<div class="button run">Run</div>
|
|
6126
6604
|
</div>
|
|
6127
6605
|
|
|
6128
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6606
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6129
6607
|
var pathHandlers = {
|
|
6130
6608
|
mouseenter: function(event) {
|
|
6131
6609
|
this.fillColor = 'red';
|
|
@@ -6148,7 +6626,7 @@ function onMouseDown(event) {
|
|
|
6148
6626
|
path.on(pathHandlers);
|
|
6149
6627
|
}
|
|
6150
6628
|
</script>
|
|
6151
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6629
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6152
6630
|
</div>
|
|
6153
6631
|
|
|
6154
6632
|
|
|
@@ -6172,7 +6650,7 @@ function onMouseDown(event) {
|
|
|
6172
6650
|
<li>
|
|
6173
6651
|
<tt>type:</tt>
|
|
6174
6652
|
<tt>String</tt>
|
|
6175
|
-
— 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>
|
|
6176
6654
|
|
|
6177
6655
|
</li>
|
|
6178
6656
|
|
|
@@ -6220,7 +6698,7 @@ function onMouseDown(event) {
|
|
|
6220
6698
|
<li>
|
|
6221
6699
|
<tt>object:</tt>
|
|
6222
6700
|
<tt>Object</tt>
|
|
6223
|
-
— 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>
|
|
6224
6702
|
|
|
6225
6703
|
</li>
|
|
6226
6704
|
|
|
@@ -6261,7 +6739,7 @@ function onMouseDown(event) {
|
|
|
6261
6739
|
<li>
|
|
6262
6740
|
<tt>type:</tt>
|
|
6263
6741
|
<tt>String</tt>
|
|
6264
|
-
— 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>
|
|
6265
6743
|
|
|
6266
6744
|
</li>
|
|
6267
6745
|
|
|
@@ -6309,7 +6787,7 @@ function onMouseDown(event) {
|
|
|
6309
6787
|
<li>
|
|
6310
6788
|
<tt>type:</tt>
|
|
6311
6789
|
<tt>String</tt>
|
|
6312
|
-
— 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>
|
|
6313
6791
|
|
|
6314
6792
|
</li>
|
|
6315
6793
|
|
|
@@ -6376,7 +6854,7 @@ function onMouseDown(event) {
|
|
|
6376
6854
|
<div class="button run">Run</div>
|
|
6377
6855
|
</div>
|
|
6378
6856
|
|
|
6379
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6857
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6380
6858
|
function onMouseDrag(event) {
|
|
6381
6859
|
// Create a circle shaped path at the mouse position,
|
|
6382
6860
|
// with a radius of 10:
|
|
@@ -6393,7 +6871,7 @@ function onMouseDrag(event) {
|
|
|
6393
6871
|
});
|
|
6394
6872
|
}
|
|
6395
6873
|
</script>
|
|
6396
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6874
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
|
|
6397
6875
|
</div>
|
|
6398
6876
|
|
|
6399
6877
|
|
|
@@ -6423,7 +6901,7 @@ function onMouseDrag(event) {
|
|
|
6423
6901
|
<div class="button run">Run</div>
|
|
6424
6902
|
</div>
|
|
6425
6903
|
|
|
6426
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6904
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6427
6905
|
function onMouseMove(event) {
|
|
6428
6906
|
// Create a circle shaped path at the mouse position,
|
|
6429
6907
|
// with a radius of 10:
|
|
@@ -6437,7 +6915,7 @@ function onMouseMove(event) {
|
|
|
6437
6915
|
path.removeOnMove();
|
|
6438
6916
|
}
|
|
6439
6917
|
</script>
|
|
6440
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6918
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6441
6919
|
</div>
|
|
6442
6920
|
|
|
6443
6921
|
|
|
@@ -6467,7 +6945,7 @@ function onMouseMove(event) {
|
|
|
6467
6945
|
<div class="button run">Run</div>
|
|
6468
6946
|
</div>
|
|
6469
6947
|
|
|
6470
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6948
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6471
6949
|
function onMouseDown(event) {
|
|
6472
6950
|
// Create a circle shaped path at the mouse position,
|
|
6473
6951
|
// with a radius of 10:
|
|
@@ -6481,7 +6959,7 @@ function onMouseDown(event) {
|
|
|
6481
6959
|
path.removeOnDown();
|
|
6482
6960
|
}
|
|
6483
6961
|
</script>
|
|
6484
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6962
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6485
6963
|
</div>
|
|
6486
6964
|
|
|
6487
6965
|
|
|
@@ -6511,7 +6989,7 @@ function onMouseDown(event) {
|
|
|
6511
6989
|
<div class="button run">Run</div>
|
|
6512
6990
|
</div>
|
|
6513
6991
|
|
|
6514
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6992
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6515
6993
|
function onMouseDrag(event) {
|
|
6516
6994
|
// Create a circle shaped path at the mouse position,
|
|
6517
6995
|
// with a radius of 10:
|
|
@@ -6525,7 +7003,7 @@ function onMouseDrag(event) {
|
|
|
6525
7003
|
path.removeOnDrag();
|
|
6526
7004
|
}
|
|
6527
7005
|
</script>
|
|
6528
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7006
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6529
7007
|
</div>
|
|
6530
7008
|
|
|
6531
7009
|
|
|
@@ -6555,7 +7033,7 @@ function onMouseDrag(event) {
|
|
|
6555
7033
|
<div class="button run">Run</div>
|
|
6556
7034
|
</div>
|
|
6557
7035
|
|
|
6558
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7036
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6559
7037
|
function onMouseDown(event) {
|
|
6560
7038
|
// Create a circle shaped path at the mouse position,
|
|
6561
7039
|
// with a radius of 10:
|
|
@@ -6569,7 +7047,7 @@ function onMouseDown(event) {
|
|
|
6569
7047
|
path.removeOnUp();
|
|
6570
7048
|
}
|
|
6571
7049
|
</script>
|
|
6572
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7050
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
|
|
6573
7051
|
</div>
|
|
6574
7052
|
|
|
6575
7053
|
|
|
@@ -6642,7 +7120,7 @@ function onMouseDown(event) {
|
|
|
6642
7120
|
<div class="button run">Run</div>
|
|
6643
7121
|
</div>
|
|
6644
7122
|
|
|
6645
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7123
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6646
7124
|
var path = new Path.Circle({
|
|
6647
7125
|
radius: view.bounds.height * 0.4,
|
|
6648
7126
|
center: view.center
|
|
@@ -6653,7 +7131,7 @@ path.tween(
|
|
|
6653
7131
|
3000
|
|
6654
7132
|
);
|
|
6655
7133
|
</script>
|
|
6656
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7134
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
6657
7135
|
</div>
|
|
6658
7136
|
|
|
6659
7137
|
|
|
@@ -6665,7 +7143,7 @@ path.tween(
|
|
|
6665
7143
|
<div class="button run">Run</div>
|
|
6666
7144
|
</div>
|
|
6667
7145
|
|
|
6668
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7146
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6669
7147
|
var path = new Shape.Rectangle({
|
|
6670
7148
|
fillColor: 'red',
|
|
6671
7149
|
center: [50, view.center.y],
|
|
@@ -6680,7 +7158,7 @@ path.tween({
|
|
|
6680
7158
|
duration: 2000
|
|
6681
7159
|
});
|
|
6682
7160
|
</script>
|
|
6683
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7161
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
6684
7162
|
</div>
|
|
6685
7163
|
|
|
6686
7164
|
|
|
@@ -6746,7 +7224,7 @@ path.tween({
|
|
|
6746
7224
|
<div class="button run">Run</div>
|
|
6747
7225
|
</div>
|
|
6748
7226
|
|
|
6749
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7227
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6750
7228
|
var path = new Path.Rectangle({
|
|
6751
7229
|
size: [100, 100],
|
|
6752
7230
|
position: view.center,
|
|
@@ -6760,7 +7238,7 @@ path.tween({
|
|
|
6760
7238
|
'segments[2].point.x': '-= 50'
|
|
6761
7239
|
}, 3000);
|
|
6762
7240
|
</script>
|
|
6763
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7241
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
|
|
6764
7242
|
</div>
|
|
6765
7243
|
|
|
6766
7244
|
|
|
@@ -6819,7 +7297,7 @@ path.tween({
|
|
|
6819
7297
|
<div class="button run">Run</div>
|
|
6820
7298
|
</div>
|
|
6821
7299
|
|
|
6822
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7300
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6823
7301
|
var path = new Path.Circle({
|
|
6824
7302
|
fillColor: 'blue',
|
|
6825
7303
|
radius: view.bounds.height * 0.4,
|
|
@@ -6835,7 +7313,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6835
7313
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6836
7314
|
};
|
|
6837
7315
|
</script>
|
|
6838
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7316
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
6839
7317
|
</div>
|
|
6840
7318
|
|
|
6841
7319
|
|
|
@@ -6956,7 +7434,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6956
7434
|
<div class="button run">Run</div>
|
|
6957
7435
|
</div>
|
|
6958
7436
|
|
|
6959
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7437
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
6960
7438
|
var path = new Path.Circle({
|
|
6961
7439
|
fillColor: 'blue',
|
|
6962
7440
|
radius: view.bounds.height * 0.4,
|
|
@@ -6964,7 +7442,7 @@ var path = new Path.Circle({
|
|
|
6964
7442
|
});
|
|
6965
7443
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
6966
7444
|
</script>
|
|
6967
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7445
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
6968
7446
|
</div>
|
|
6969
7447
|
|
|
6970
7448
|
|
|
@@ -7007,7 +7485,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
7007
7485
|
<div class="button run">Run</div>
|
|
7008
7486
|
</div>
|
|
7009
7487
|
|
|
7010
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7488
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
7011
7489
|
var star = new Path.Star({
|
|
7012
7490
|
center: view.center,
|
|
7013
7491
|
points: 6,
|
|
@@ -7032,7 +7510,7 @@ function onFrame(event) {
|
|
|
7032
7510
|
circle.position.x = view.center.x + offset;
|
|
7033
7511
|
}
|
|
7034
7512
|
</script>
|
|
7035
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7513
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
7036
7514
|
</div>
|
|
7037
7515
|
|
|
7038
7516
|
|
|
@@ -7049,7 +7527,7 @@ function onFrame(event) {
|
|
|
7049
7527
|
<div class="member-description hidden">
|
|
7050
7528
|
|
|
7051
7529
|
<div class="member-text">
|
|
7052
|
-
<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>
|
|
7053
7531
|
|
|
7054
7532
|
|
|
7055
7533
|
|
|
@@ -7067,6 +7545,77 @@ function onFrame(event) {
|
|
|
7067
7545
|
|
|
7068
7546
|
|
|
7069
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
|
+
|
|
7070
7619
|
</div>
|
|
7071
7620
|
|
|
7072
7621
|
</div>
|
|
@@ -7113,7 +7662,7 @@ function onFrame(event) {
|
|
|
7113
7662
|
|
|
7114
7663
|
<!-- =========================== copyright notice ========================== -->
|
|
7115
7664
|
<p class="footer">
|
|
7116
|
-
Paper.js v0.
|
|
7665
|
+
Paper.js v0.17.0<br>
|
|
7117
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>
|
|
7118
7667
|
<div class="content-end"></div>
|
|
7119
7668
|
|