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
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
|
|
18
18
|
<p> Extends <b><a href="../classes/Item.html"><tt>Item</tt></a></b>, <b><a href="../classes/TextItem.html"><tt>TextItem</tt></a></b></p>
|
|
19
19
|
|
|
20
|
-
<p>A PathText item represents text that runs along a path, its <a href="../classes/TextItem.html#textpath"><tt>textPath</tt></a>, each letter turned to the path’s direction where it sits. On a compound path, the text runs along one of its paths after the other. What doesn’t fit between <a href="../classes/PathText.html#startoffset"><tt>startOffset</tt></a> and <a href="../classes/PathText.html#endoffset"><tt>endOffset</tt></a> flows on into the next linked text item.</p>
|
|
20
|
+
<p>A PathText item represents text that runs along a path, its <a href="../classes/TextItem.html#textpath"><tt>textPath</tt></a>, each letter turned to the path’s direction where it sits. On a compound path, the text runs along one of its paths after the other. What doesn’t fit between <a href="../classes/PathText.html#startoffset"><tt>startOffset</tt></a> and <a href="../classes/PathText.html#endoffset"><tt>endOffset</tt></a> flows on into the next linked text item. When its first paragraph runs right to left, its letters follow each other backwards along the path. Each letter is drawn on its own, so scripts that join their letters, as Arabic, lose their joined forms.</p>
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
</div>
|
|
@@ -284,6 +284,91 @@ text.fontSize = 16;
|
|
|
284
284
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
285
285
|
|
|
286
286
|
|
|
287
|
+
<div id="effects" class="member">
|
|
288
|
+
<div class="member-link">
|
|
289
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
290
|
+
</div>
|
|
291
|
+
<div class="member-description hidden">
|
|
292
|
+
|
|
293
|
+
<div class="member-text">
|
|
294
|
+
<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,
|
|
295
|
+
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>
|
|
296
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
297
|
+
<ul>
|
|
298
|
+
<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>
|
|
299
|
+
<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>
|
|
300
|
+
</ul>
|
|
301
|
+
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
<ul class="member-list">
|
|
305
|
+
<h4>Type:</h4>
|
|
306
|
+
<li>
|
|
307
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
308
|
+
</li>
|
|
309
|
+
</ul>
|
|
310
|
+
|
|
311
|
+
|
|
312
|
+
<h4>Example:</h4>
|
|
313
|
+
|
|
314
|
+
<div class="paperscript split">
|
|
315
|
+
|
|
316
|
+
<div class="buttons">
|
|
317
|
+
<div class="button run">Run</div>
|
|
318
|
+
</div>
|
|
319
|
+
|
|
320
|
+
<script type="text/paperscript" canvas="canvas-1">
|
|
321
|
+
var path = new Path.Star({
|
|
322
|
+
center: view.center,
|
|
323
|
+
points: 5,
|
|
324
|
+
radius1: 20,
|
|
325
|
+
radius2: 40,
|
|
326
|
+
strokeColor: 'black',
|
|
327
|
+
strokeWidth: 8
|
|
328
|
+
});
|
|
329
|
+
path.effects = [
|
|
330
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
331
|
+
{ type: 'outline' }
|
|
332
|
+
];
|
|
333
|
+
</script>
|
|
334
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
|
|
335
|
+
</div>
|
|
336
|
+
|
|
337
|
+
|
|
338
|
+
</div>
|
|
339
|
+
|
|
340
|
+
</div>
|
|
341
|
+
</div>
|
|
342
|
+
|
|
343
|
+
|
|
344
|
+
<div id="previewbounds-matrix" class="member">
|
|
345
|
+
<div class="member-link">
|
|
346
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
347
|
+
</div>
|
|
348
|
+
<div class="member-description hidden">
|
|
349
|
+
|
|
350
|
+
<div class="member-text">
|
|
351
|
+
<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>
|
|
352
|
+
|
|
353
|
+
<p>Read only.</p>
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
|
|
357
|
+
<ul class="member-list">
|
|
358
|
+
<h4>Type:</h4>
|
|
359
|
+
<li>
|
|
360
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
361
|
+
</li>
|
|
362
|
+
</ul>
|
|
363
|
+
|
|
364
|
+
|
|
365
|
+
|
|
366
|
+
</div>
|
|
367
|
+
|
|
368
|
+
</div>
|
|
369
|
+
</div>
|
|
370
|
+
|
|
371
|
+
|
|
287
372
|
<div id="key" class="member">
|
|
288
373
|
<div class="member-link">
|
|
289
374
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -396,7 +481,7 @@ text.fontSize = 16;
|
|
|
396
481
|
<div class="button run">Run</div>
|
|
397
482
|
</div>
|
|
398
483
|
|
|
399
|
-
<script type="text/paperscript" canvas="canvas-
|
|
484
|
+
<script type="text/paperscript" canvas="canvas-2">
|
|
400
485
|
var path = new Path.Circle({
|
|
401
486
|
center: [80, 50],
|
|
402
487
|
radius: 35
|
|
@@ -411,7 +496,7 @@ group.addChild(path);
|
|
|
411
496
|
// The path can be accessed by name:
|
|
412
497
|
group.children['example'].fillColor = 'red';
|
|
413
498
|
</script>
|
|
414
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
499
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
|
|
415
500
|
</div>
|
|
416
501
|
|
|
417
502
|
|
|
@@ -449,7 +534,7 @@ group.children['example'].fillColor = 'red';
|
|
|
449
534
|
<div class="button run">Run</div>
|
|
450
535
|
</div>
|
|
451
536
|
|
|
452
|
-
<script type="text/paperscript" canvas="canvas-
|
|
537
|
+
<script type="text/paperscript" canvas="canvas-3">
|
|
453
538
|
var circle = new Path.Circle({
|
|
454
539
|
center: [80, 50],
|
|
455
540
|
radius: 30
|
|
@@ -460,7 +545,7 @@ circle.style = {
|
|
|
460
545
|
strokeWidth: 5
|
|
461
546
|
};
|
|
462
547
|
</script>
|
|
463
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
548
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
|
|
464
549
|
</div>
|
|
465
550
|
|
|
466
551
|
|
|
@@ -472,7 +557,7 @@ circle.style = {
|
|
|
472
557
|
<div class="button run">Run</div>
|
|
473
558
|
</div>
|
|
474
559
|
|
|
475
|
-
<script type="text/paperscript" canvas="canvas-
|
|
560
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
476
561
|
var path = new Path.Circle({
|
|
477
562
|
center: [50, 50],
|
|
478
563
|
radius: 30,
|
|
@@ -487,7 +572,7 @@ var path2 = new Path.Circle({
|
|
|
487
572
|
// Copy the path style of path:
|
|
488
573
|
path2.style = path.style;
|
|
489
574
|
</script>
|
|
490
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
575
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
|
|
491
576
|
</div>
|
|
492
577
|
|
|
493
578
|
|
|
@@ -499,7 +584,7 @@ path2.style = path.style;
|
|
|
499
584
|
<div class="button run">Run</div>
|
|
500
585
|
</div>
|
|
501
586
|
|
|
502
|
-
<script type="text/paperscript" canvas="canvas-
|
|
587
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
503
588
|
var myStyle = {
|
|
504
589
|
fillColor: 'red',
|
|
505
590
|
strokeColor: 'blue',
|
|
@@ -518,7 +603,7 @@ var path2 = new Path.Circle({
|
|
|
518
603
|
});
|
|
519
604
|
path2.style = myStyle;
|
|
520
605
|
</script>
|
|
521
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
606
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
522
607
|
</div>
|
|
523
608
|
|
|
524
609
|
|
|
@@ -560,7 +645,7 @@ path2.style = myStyle;
|
|
|
560
645
|
<div class="button run">Run</div>
|
|
561
646
|
</div>
|
|
562
647
|
|
|
563
|
-
<script type="text/paperscript" canvas="canvas-
|
|
648
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
564
649
|
var unlockedItem = new Path.Circle({
|
|
565
650
|
center: view.center - [35, 0],
|
|
566
651
|
radius: 30,
|
|
@@ -587,7 +672,7 @@ new PointText({
|
|
|
587
672
|
justification: 'center'
|
|
588
673
|
});
|
|
589
674
|
</script>
|
|
590
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
675
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
591
676
|
</div>
|
|
592
677
|
|
|
593
678
|
|
|
@@ -629,7 +714,7 @@ new PointText({
|
|
|
629
714
|
<div class="button run">Run</div>
|
|
630
715
|
</div>
|
|
631
716
|
|
|
632
|
-
<script type="text/paperscript" canvas="canvas-
|
|
717
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
633
718
|
var path = new Path.Circle({
|
|
634
719
|
center: [50, 50],
|
|
635
720
|
radius: 20,
|
|
@@ -639,7 +724,7 @@ var path = new Path.Circle({
|
|
|
639
724
|
// Hide the path:
|
|
640
725
|
path.visible = false;
|
|
641
726
|
</script>
|
|
642
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
727
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
643
728
|
</div>
|
|
644
729
|
|
|
645
730
|
|
|
@@ -687,7 +772,7 @@ path.visible = false;
|
|
|
687
772
|
<div class="button run">Run</div>
|
|
688
773
|
</div>
|
|
689
774
|
|
|
690
|
-
<script type="text/paperscript" canvas="canvas-
|
|
775
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
691
776
|
// Create a white rectangle in the background
|
|
692
777
|
// with the same dimensions as the view:
|
|
693
778
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -708,7 +793,7 @@ var circle2 = new Path.Circle({
|
|
|
708
793
|
// Set the blend mode of circle2:
|
|
709
794
|
circle2.blendMode = 'multiply';
|
|
710
795
|
</script>
|
|
711
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
796
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
712
797
|
</div>
|
|
713
798
|
|
|
714
799
|
|
|
@@ -750,7 +835,7 @@ circle2.blendMode = 'multiply';
|
|
|
750
835
|
<div class="button run">Run</div>
|
|
751
836
|
</div>
|
|
752
837
|
|
|
753
|
-
<script type="text/paperscript" canvas="canvas-
|
|
838
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
754
839
|
var circle = new Path.Circle({
|
|
755
840
|
center: [80, 50],
|
|
756
841
|
radius: 35,
|
|
@@ -768,7 +853,7 @@ var circle2 = new Path.Circle({
|
|
|
768
853
|
// Make circle2 50% transparent:
|
|
769
854
|
circle2.opacity = 0.5;
|
|
770
855
|
</script>
|
|
771
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
856
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
772
857
|
</div>
|
|
773
858
|
|
|
774
859
|
|
|
@@ -891,14 +976,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
891
976
|
<div class="button run">Run</div>
|
|
892
977
|
</div>
|
|
893
978
|
|
|
894
|
-
<script type="text/paperscript" canvas="canvas-
|
|
979
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
895
980
|
var path = new Path.Circle({
|
|
896
981
|
center: [80, 50],
|
|
897
982
|
radius: 35
|
|
898
983
|
});
|
|
899
984
|
path.selected = true; // Select the path
|
|
900
985
|
</script>
|
|
901
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
986
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
902
987
|
</div>
|
|
903
988
|
|
|
904
989
|
|
|
@@ -1055,7 +1140,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
1055
1140
|
<div class="button run">Run</div>
|
|
1056
1141
|
</div>
|
|
1057
1142
|
|
|
1058
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1143
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
1059
1144
|
// Create a circle at position { x: 10, y: 10 }
|
|
1060
1145
|
var circle = new Path.Circle({
|
|
1061
1146
|
center: new Point(10, 10),
|
|
@@ -1069,7 +1154,7 @@ circle.position = new Point(20, 20);
|
|
|
1069
1154
|
// Move the circle 100 points to the right and 50 points down
|
|
1070
1155
|
circle.position += new Point(100, 50);
|
|
1071
1156
|
</script>
|
|
1072
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1157
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
1073
1158
|
</div>
|
|
1074
1159
|
|
|
1075
1160
|
|
|
@@ -1081,7 +1166,7 @@ circle.position += new Point(100, 50);
|
|
|
1081
1166
|
<div class="button run">Run</div>
|
|
1082
1167
|
</div>
|
|
1083
1168
|
|
|
1084
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1169
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
1085
1170
|
// Create a circle at position { x: 20, y: 20 }
|
|
1086
1171
|
var circle = new Path.Circle({
|
|
1087
1172
|
center: new Point(20, 20),
|
|
@@ -1092,7 +1177,7 @@ var circle = new Path.Circle({
|
|
|
1092
1177
|
// Move the circle 100 points to the right
|
|
1093
1178
|
circle.position.x += 100;
|
|
1094
1179
|
</script>
|
|
1095
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1180
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
1096
1181
|
</div>
|
|
1097
1182
|
|
|
1098
1183
|
|
|
@@ -1618,7 +1703,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1618
1703
|
<div class="button run">Run</div>
|
|
1619
1704
|
</div>
|
|
1620
1705
|
|
|
1621
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1706
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1622
1707
|
var path = new Path.Circle({
|
|
1623
1708
|
center: [80, 50],
|
|
1624
1709
|
radius: 35
|
|
@@ -1631,7 +1716,7 @@ group.addChild(path);
|
|
|
1631
1716
|
// Access the path through the group's children array:
|
|
1632
1717
|
group.children[0].fillColor = 'red';
|
|
1633
1718
|
</script>
|
|
1634
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1719
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1635
1720
|
</div>
|
|
1636
1721
|
|
|
1637
1722
|
|
|
@@ -1643,7 +1728,7 @@ group.children[0].fillColor = 'red';
|
|
|
1643
1728
|
<div class="button run">Run</div>
|
|
1644
1729
|
</div>
|
|
1645
1730
|
|
|
1646
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1731
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1647
1732
|
var path = new Path.Circle({
|
|
1648
1733
|
center: [80, 50],
|
|
1649
1734
|
radius: 35
|
|
@@ -1658,7 +1743,7 @@ group.addChild(path);
|
|
|
1658
1743
|
// The path can be accessed by name:
|
|
1659
1744
|
group.children['example'].fillColor = 'orange';
|
|
1660
1745
|
</script>
|
|
1661
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1746
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1662
1747
|
</div>
|
|
1663
1748
|
|
|
1664
1749
|
|
|
@@ -1670,7 +1755,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1670
1755
|
<div class="button run">Run</div>
|
|
1671
1756
|
</div>
|
|
1672
1757
|
|
|
1673
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1758
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1674
1759
|
var path = new Path.Circle({
|
|
1675
1760
|
center: [80, 50],
|
|
1676
1761
|
radius: 35
|
|
@@ -1682,7 +1767,7 @@ group.children = [path];
|
|
|
1682
1767
|
// The path is the first child of the group:
|
|
1683
1768
|
group.firstChild.fillColor = 'green';
|
|
1684
1769
|
</script>
|
|
1685
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1770
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1686
1771
|
</div>
|
|
1687
1772
|
|
|
1688
1773
|
|
|
@@ -1859,7 +1944,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1859
1944
|
<div class="button run">Run</div>
|
|
1860
1945
|
</div>
|
|
1861
1946
|
|
|
1862
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1947
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1863
1948
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1864
1949
|
// with a radius of 35:
|
|
1865
1950
|
var circle = new Path.Circle({
|
|
@@ -1870,7 +1955,7 @@ var circle = new Path.Circle({
|
|
|
1870
1955
|
// Set its stroke color to RGB red:
|
|
1871
1956
|
circle.strokeColor = new Color(1, 0, 0);
|
|
1872
1957
|
</script>
|
|
1873
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1958
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1874
1959
|
</div>
|
|
1875
1960
|
|
|
1876
1961
|
|
|
@@ -1907,7 +1992,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
1907
1992
|
<div class="button run">Run</div>
|
|
1908
1993
|
</div>
|
|
1909
1994
|
|
|
1910
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1995
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1911
1996
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1912
1997
|
// with a radius of 35:
|
|
1913
1998
|
var circle = new Path.Circle({
|
|
@@ -1919,7 +2004,7 @@ var circle = new Path.Circle({
|
|
|
1919
2004
|
// Set its stroke width to 10:
|
|
1920
2005
|
circle.strokeWidth = 10;
|
|
1921
2006
|
</script>
|
|
1922
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2007
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
1923
2008
|
</div>
|
|
1924
2009
|
|
|
1925
2010
|
|
|
@@ -1966,7 +2051,7 @@ circle.strokeWidth = 10;
|
|
|
1966
2051
|
<div class="button run">Run</div>
|
|
1967
2052
|
</div>
|
|
1968
2053
|
|
|
1969
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2054
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1970
2055
|
var line = new Path({
|
|
1971
2056
|
segments: [[80, 50], [420, 50]],
|
|
1972
2057
|
strokeColor: 'black',
|
|
@@ -1987,7 +2072,7 @@ var line2 = line.clone();
|
|
|
1987
2072
|
line2.position.y += 100;
|
|
1988
2073
|
line2.strokeCap = 'butt';
|
|
1989
2074
|
</script>
|
|
1990
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
2075
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-18"></canvas></div>
|
|
1991
2076
|
</div>
|
|
1992
2077
|
|
|
1993
2078
|
|
|
@@ -2034,7 +2119,7 @@ line2.strokeCap = 'butt';
|
|
|
2034
2119
|
<div class="button run">Run</div>
|
|
2035
2120
|
</div>
|
|
2036
2121
|
|
|
2037
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2122
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
2038
2123
|
var path = new Path({
|
|
2039
2124
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
2040
2125
|
strokeColor: 'black',
|
|
@@ -2051,7 +2136,7 @@ var path3 = path2.clone();
|
|
|
2051
2136
|
path3.position.x += path3.bounds.width * 1.5;
|
|
2052
2137
|
path3.strokeJoin = 'bevel';
|
|
2053
2138
|
</script>
|
|
2054
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
2139
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-19"></canvas></div>
|
|
2055
2140
|
</div>
|
|
2056
2141
|
|
|
2057
2142
|
|
|
@@ -2155,7 +2240,7 @@ path3.strokeJoin = 'bevel';
|
|
|
2155
2240
|
<div class="button run">Run</div>
|
|
2156
2241
|
</div>
|
|
2157
2242
|
|
|
2158
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2243
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
2159
2244
|
var path = new Path.Circle({
|
|
2160
2245
|
center: [80, 50],
|
|
2161
2246
|
radius: 40,
|
|
@@ -2166,7 +2251,7 @@ var path = new Path.Circle({
|
|
|
2166
2251
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
2167
2252
|
path.dashArray = [10, 4];
|
|
2168
2253
|
</script>
|
|
2169
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2254
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
2170
2255
|
</div>
|
|
2171
2256
|
|
|
2172
2257
|
|
|
@@ -2201,6 +2286,42 @@ path.dashArray = [10, 4];
|
|
|
2201
2286
|
|
|
2202
2287
|
|
|
2203
2288
|
|
|
2289
|
+
</div>
|
|
2290
|
+
|
|
2291
|
+
</div>
|
|
2292
|
+
</div>
|
|
2293
|
+
|
|
2294
|
+
|
|
2295
|
+
<div id="paintorder" class="member">
|
|
2296
|
+
<div class="member-link">
|
|
2297
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
2298
|
+
</div>
|
|
2299
|
+
<div class="member-description hidden">
|
|
2300
|
+
|
|
2301
|
+
<div class="member-text">
|
|
2302
|
+
<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>
|
|
2303
|
+
|
|
2304
|
+
|
|
2305
|
+
<ul class="member-list">
|
|
2306
|
+
<h4>Values:</h4>
|
|
2307
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
2308
|
+
</ul>
|
|
2309
|
+
|
|
2310
|
+
|
|
2311
|
+
<ul class="member-list">
|
|
2312
|
+
<h4>Default:</h4>
|
|
2313
|
+
<li><tt>'fill'</tt></li>
|
|
2314
|
+
</ul>
|
|
2315
|
+
|
|
2316
|
+
<ul class="member-list">
|
|
2317
|
+
<h4>Type:</h4>
|
|
2318
|
+
<li>
|
|
2319
|
+
<tt>String</tt>
|
|
2320
|
+
</li>
|
|
2321
|
+
</ul>
|
|
2322
|
+
|
|
2323
|
+
|
|
2324
|
+
|
|
2204
2325
|
</div>
|
|
2205
2326
|
|
|
2206
2327
|
</div>
|
|
@@ -2236,7 +2357,7 @@ path.dashArray = [10, 4];
|
|
|
2236
2357
|
<div class="button run">Run</div>
|
|
2237
2358
|
</div>
|
|
2238
2359
|
|
|
2239
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2360
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2240
2361
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2241
2362
|
// with a radius of 35:
|
|
2242
2363
|
var circle = new Path.Circle({
|
|
@@ -2247,7 +2368,7 @@ var circle = new Path.Circle({
|
|
|
2247
2368
|
// Set the fill color of the circle to RGB red:
|
|
2248
2369
|
circle.fillColor = new Color(1, 0, 0);
|
|
2249
2370
|
</script>
|
|
2250
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2371
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2251
2372
|
</div>
|
|
2252
2373
|
|
|
2253
2374
|
|
|
@@ -2322,7 +2443,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2322
2443
|
<div class="button run">Run</div>
|
|
2323
2444
|
</div>
|
|
2324
2445
|
|
|
2325
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2446
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2326
2447
|
var circle = new Path.Circle({
|
|
2327
2448
|
center: [80, 50],
|
|
2328
2449
|
radius: 35,
|
|
@@ -2335,7 +2456,7 @@ var circle = new Path.Circle({
|
|
|
2335
2456
|
shadowOffset: new Point(5, 5)
|
|
2336
2457
|
});
|
|
2337
2458
|
</script>
|
|
2338
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2459
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2339
2460
|
</div>
|
|
2340
2461
|
|
|
2341
2462
|
|
|
@@ -2476,7 +2597,7 @@ var circle = new Path.Circle({
|
|
|
2476
2597
|
<div class="button run">Run</div>
|
|
2477
2598
|
</div>
|
|
2478
2599
|
|
|
2479
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2600
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2480
2601
|
// Create a rectangle shaped path with its top left point at:
|
|
2481
2602
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2482
2603
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2487,7 +2608,7 @@ path.onFrame = function(event) {
|
|
|
2487
2608
|
this.rotate(3);
|
|
2488
2609
|
}
|
|
2489
2610
|
</script>
|
|
2490
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2611
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2491
2612
|
</div>
|
|
2492
2613
|
|
|
2493
2614
|
|
|
@@ -2531,7 +2652,7 @@ path.onFrame = function(event) {
|
|
|
2531
2652
|
<div class="button run">Run</div>
|
|
2532
2653
|
</div>
|
|
2533
2654
|
|
|
2534
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2655
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2535
2656
|
// Create a circle shaped path at the center of the view:
|
|
2536
2657
|
var path = new Path.Circle({
|
|
2537
2658
|
center: view.center,
|
|
@@ -2545,7 +2666,7 @@ path.onMouseDown = function(event) {
|
|
|
2545
2666
|
this.fillColor = 'red';
|
|
2546
2667
|
}
|
|
2547
2668
|
</script>
|
|
2548
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2669
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2549
2670
|
</div>
|
|
2550
2671
|
|
|
2551
2672
|
|
|
@@ -2557,7 +2678,7 @@ path.onMouseDown = function(event) {
|
|
|
2557
2678
|
<div class="button run">Run</div>
|
|
2558
2679
|
</div>
|
|
2559
2680
|
|
|
2560
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2681
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2561
2682
|
// Loop 30 times:
|
|
2562
2683
|
for (var i = 0; i < 30; i++) {
|
|
2563
2684
|
// Create a circle shaped path at a random position
|
|
@@ -2575,7 +2696,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2575
2696
|
}
|
|
2576
2697
|
}
|
|
2577
2698
|
</script>
|
|
2578
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2699
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2579
2700
|
</div>
|
|
2580
2701
|
|
|
2581
2702
|
|
|
@@ -2619,7 +2740,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2619
2740
|
<div class="button run">Run</div>
|
|
2620
2741
|
</div>
|
|
2621
2742
|
|
|
2622
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2743
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2623
2744
|
// Create a circle shaped path at the center of the view:
|
|
2624
2745
|
var path = new Path.Circle({
|
|
2625
2746
|
center: view.center,
|
|
@@ -2632,7 +2753,7 @@ path.onMouseDrag = function(event) {
|
|
|
2632
2753
|
path.position += event.delta;
|
|
2633
2754
|
}
|
|
2634
2755
|
</script>
|
|
2635
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2756
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-26"></canvas></div>
|
|
2636
2757
|
</div>
|
|
2637
2758
|
|
|
2638
2759
|
|
|
@@ -2676,7 +2797,7 @@ path.onMouseDrag = function(event) {
|
|
|
2676
2797
|
<div class="button run">Run</div>
|
|
2677
2798
|
</div>
|
|
2678
2799
|
|
|
2679
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2800
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2680
2801
|
// Create a circle shaped path at the center of the view:
|
|
2681
2802
|
var path = new Path.Circle({
|
|
2682
2803
|
center: view.center,
|
|
@@ -2690,7 +2811,7 @@ path.onMouseUp = function(event) {
|
|
|
2690
2811
|
this.fillColor = 'red';
|
|
2691
2812
|
}
|
|
2692
2813
|
</script>
|
|
2693
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2814
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2694
2815
|
</div>
|
|
2695
2816
|
|
|
2696
2817
|
|
|
@@ -2734,7 +2855,7 @@ path.onMouseUp = function(event) {
|
|
|
2734
2855
|
<div class="button run">Run</div>
|
|
2735
2856
|
</div>
|
|
2736
2857
|
|
|
2737
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2858
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2738
2859
|
// Create a circle shaped path at the center of the view:
|
|
2739
2860
|
var path = new Path.Circle({
|
|
2740
2861
|
center: view.center,
|
|
@@ -2748,7 +2869,7 @@ path.onClick = function(event) {
|
|
|
2748
2869
|
this.fillColor = 'red';
|
|
2749
2870
|
}
|
|
2750
2871
|
</script>
|
|
2751
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2872
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2752
2873
|
</div>
|
|
2753
2874
|
|
|
2754
2875
|
|
|
@@ -2760,7 +2881,7 @@ path.onClick = function(event) {
|
|
|
2760
2881
|
<div class="button run">Run</div>
|
|
2761
2882
|
</div>
|
|
2762
2883
|
|
|
2763
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2884
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2764
2885
|
// Loop 30 times:
|
|
2765
2886
|
for (var i = 0; i < 30; i++) {
|
|
2766
2887
|
// Create a circle shaped path at a random position
|
|
@@ -2778,7 +2899,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2778
2899
|
}
|
|
2779
2900
|
}
|
|
2780
2901
|
</script>
|
|
2781
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2902
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2782
2903
|
</div>
|
|
2783
2904
|
|
|
2784
2905
|
|
|
@@ -2822,7 +2943,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2822
2943
|
<div class="button run">Run</div>
|
|
2823
2944
|
</div>
|
|
2824
2945
|
|
|
2825
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2946
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2826
2947
|
// Create a circle shaped path at the center of the view:
|
|
2827
2948
|
var path = new Path.Circle({
|
|
2828
2949
|
center: view.center,
|
|
@@ -2836,7 +2957,7 @@ path.onDoubleClick = function(event) {
|
|
|
2836
2957
|
this.fillColor = 'red';
|
|
2837
2958
|
}
|
|
2838
2959
|
</script>
|
|
2839
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2960
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2840
2961
|
</div>
|
|
2841
2962
|
|
|
2842
2963
|
|
|
@@ -2848,7 +2969,7 @@ path.onDoubleClick = function(event) {
|
|
|
2848
2969
|
<div class="button run">Run</div>
|
|
2849
2970
|
</div>
|
|
2850
2971
|
|
|
2851
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2972
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2852
2973
|
// Loop 30 times:
|
|
2853
2974
|
for (var i = 0; i < 30; i++) {
|
|
2854
2975
|
// Create a circle shaped path at a random position
|
|
@@ -2866,7 +2987,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2866
2987
|
}
|
|
2867
2988
|
}
|
|
2868
2989
|
</script>
|
|
2869
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2990
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2870
2991
|
</div>
|
|
2871
2992
|
|
|
2872
2993
|
|
|
@@ -2910,7 +3031,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2910
3031
|
<div class="button run">Run</div>
|
|
2911
3032
|
</div>
|
|
2912
3033
|
|
|
2913
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3034
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2914
3035
|
// Create a circle shaped path at the center of the view:
|
|
2915
3036
|
var path = new Path.Circle({
|
|
2916
3037
|
center: view.center,
|
|
@@ -2918,180 +3039,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
2918
3039
|
fillColor: 'black'
|
|
2919
3040
|
});
|
|
2920
3041
|
|
|
2921
|
-
// When the mouse moves on top of the item, set its opacity
|
|
2922
|
-
// to a random value between 0 and 1:
|
|
2923
|
-
path.onMouseMove = function(event) {
|
|
2924
|
-
this.opacity = Math.random();
|
|
2925
|
-
}
|
|
2926
|
-
</script>
|
|
2927
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2928
|
-
</div>
|
|
3042
|
+
// When the mouse moves on top of the item, set its opacity
|
|
3043
|
+
// to a random value between 0 and 1:
|
|
3044
|
+
path.onMouseMove = function(event) {
|
|
3045
|
+
this.opacity = Math.random();
|
|
3046
|
+
}
|
|
3047
|
+
</script>
|
|
3048
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
3049
|
+
</div>
|
|
3050
|
+
|
|
3051
|
+
|
|
3052
|
+
</div>
|
|
3053
|
+
|
|
3054
|
+
</div>
|
|
3055
|
+
</div>
|
|
3056
|
+
|
|
3057
|
+
|
|
3058
|
+
<div id="onmouseenter" class="member">
|
|
3059
|
+
<div class="member-link">
|
|
3060
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</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 over the item. This function will only be called again, once the mouse moved outside of the item first. The function receives a <a href="../classes/MouseEvent.html"><tt>MouseEvent</tt></a> object which contains information about the mouse event. Note that such mouse events bubble up the scene graph hierarchy and will reach the view, unless they are stopped with <a href="../classes/Event.html#stoppropagation"><tt>event.stopPropagation</tt></a>() or by returning <code>false</code> from the handler.</p>
|
|
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#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
3081
|
+
|
|
3082
|
+
</ul>
|
|
3083
|
+
|
|
3084
|
+
<h4>Example:<span class="description">When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
|
|
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-33">
|
|
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 enters the item, set its fill color to red:
|
|
3101
|
+
path.onMouseEnter = function(event) {
|
|
3102
|
+
this.fillColor = 'red';
|
|
3103
|
+
}
|
|
3104
|
+
|
|
3105
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3106
|
+
path.onMouseLeave = function(event) {
|
|
3107
|
+
this.fillColor = 'black';
|
|
3108
|
+
}
|
|
3109
|
+
</script>
|
|
3110
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
3111
|
+
</div>
|
|
3112
|
+
|
|
3113
|
+
|
|
3114
|
+
<h4>Example:<span class="description">When you click the mouse, you create new circle shaped items. When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
|
|
3115
|
+
|
|
3116
|
+
<div class="paperscript split">
|
|
3117
|
+
|
|
3118
|
+
<div class="buttons">
|
|
3119
|
+
<div class="button run">Run</div>
|
|
3120
|
+
</div>
|
|
3121
|
+
|
|
3122
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
3123
|
+
function enter(event) {
|
|
3124
|
+
this.fillColor = 'red';
|
|
3125
|
+
}
|
|
3126
|
+
|
|
3127
|
+
function leave(event) {
|
|
3128
|
+
this.fillColor = 'black';
|
|
3129
|
+
}
|
|
3130
|
+
|
|
3131
|
+
// When the mouse is pressed:
|
|
3132
|
+
function onMouseDown(event) {
|
|
3133
|
+
// Create a circle shaped path at the position of the mouse:
|
|
3134
|
+
var path = new Path.Circle(event.point, 25);
|
|
3135
|
+
path.fillColor = 'black';
|
|
3136
|
+
|
|
3137
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3138
|
+
path.onMouseEnter = enter;
|
|
3139
|
+
|
|
3140
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3141
|
+
path.onMouseLeave = leave;
|
|
3142
|
+
}
|
|
3143
|
+
</script>
|
|
3144
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3145
|
+
</div>
|
|
3146
|
+
|
|
3147
|
+
|
|
3148
|
+
</div>
|
|
3149
|
+
|
|
3150
|
+
</div>
|
|
3151
|
+
</div>
|
|
3152
|
+
|
|
3153
|
+
|
|
3154
|
+
<div id="onmouseleave" class="member">
|
|
3155
|
+
<div class="member-link">
|
|
3156
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
3157
|
+
</div>
|
|
3158
|
+
<div class="member-description hidden">
|
|
3159
|
+
|
|
3160
|
+
<div class="member-text">
|
|
3161
|
+
<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>
|
|
3162
|
+
|
|
3163
|
+
|
|
3164
|
+
|
|
3165
|
+
<ul class="member-list">
|
|
3166
|
+
<h4>Type:</h4>
|
|
3167
|
+
<li>
|
|
3168
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3169
|
+
</li>
|
|
3170
|
+
</ul>
|
|
3171
|
+
|
|
3172
|
+
|
|
3173
|
+
<ul class="member-list">
|
|
3174
|
+
<h4>See also:</h4>
|
|
3175
|
+
|
|
3176
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
3177
|
+
|
|
3178
|
+
</ul>
|
|
3179
|
+
|
|
3180
|
+
<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>
|
|
3181
|
+
|
|
3182
|
+
<div class="paperscript split">
|
|
3183
|
+
|
|
3184
|
+
<div class="buttons">
|
|
3185
|
+
<div class="button run">Run</div>
|
|
3186
|
+
</div>
|
|
3187
|
+
|
|
3188
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
3189
|
+
// Create a circle shaped path at the center of the view:
|
|
3190
|
+
var path = new Path.Circle({
|
|
3191
|
+
center: view.center,
|
|
3192
|
+
radius: 25,
|
|
3193
|
+
fillColor: 'black'
|
|
3194
|
+
});
|
|
3195
|
+
|
|
3196
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
3197
|
+
path.onMouseLeave = function(event) {
|
|
3198
|
+
this.fillColor = 'red';
|
|
3199
|
+
}
|
|
3200
|
+
</script>
|
|
3201
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3202
|
+
</div>
|
|
3203
|
+
|
|
3204
|
+
|
|
3205
|
+
</div>
|
|
3206
|
+
|
|
3207
|
+
</div>
|
|
3208
|
+
</div>
|
|
3209
|
+
|
|
3210
|
+
|
|
3211
|
+
<div id="ondraw" class="member">
|
|
3212
|
+
<div class="member-link">
|
|
3213
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
3214
|
+
</div>
|
|
3215
|
+
<div class="member-description hidden">
|
|
3216
|
+
|
|
3217
|
+
<div class="member-text">
|
|
3218
|
+
<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>
|
|
3219
|
+
|
|
3220
|
+
|
|
3221
|
+
|
|
3222
|
+
<ul class="member-list">
|
|
3223
|
+
<h4>Type:</h4>
|
|
3224
|
+
<li>
|
|
3225
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3226
|
+
</li>
|
|
3227
|
+
</ul>
|
|
3228
|
+
<ul class="member-list">
|
|
3229
|
+
<h4>Options:</h4>
|
|
3230
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
3231
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
3232
|
+
<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>
|
|
3233
|
+
<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>
|
|
3234
|
+
<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>()
|
|
3235
|
+
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>
|
|
3236
|
+
</ul>
|
|
3237
|
+
|
|
3238
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
3239
|
+
|
|
3240
|
+
<div class="paperscript split">
|
|
3241
|
+
|
|
3242
|
+
<div class="buttons">
|
|
3243
|
+
<div class="button run">Run</div>
|
|
3244
|
+
</div>
|
|
3245
|
+
|
|
3246
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3247
|
+
var path = new Path.Circle({
|
|
3248
|
+
center: view.center,
|
|
3249
|
+
radius: 25,
|
|
3250
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3251
|
+
});
|
|
3252
|
+
|
|
3253
|
+
path.onDraw = function(event) {
|
|
3254
|
+
var ctx = event.context,
|
|
3255
|
+
center = this.position,
|
|
3256
|
+
scale = event.matrix.scaling.x;
|
|
3257
|
+
ctx.beginPath();
|
|
3258
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3259
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3260
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3261
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3262
|
+
ctx.lineWidth = 1 / scale;
|
|
3263
|
+
ctx.stroke();
|
|
3264
|
+
}
|
|
3265
|
+
</script>
|
|
3266
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3267
|
+
</div>
|
|
3268
|
+
|
|
3269
|
+
|
|
3270
|
+
</div>
|
|
3271
|
+
|
|
3272
|
+
</div>
|
|
3273
|
+
</div>
|
|
3274
|
+
|
|
3275
|
+
|
|
3276
|
+
<div id="ondrawselection" class="member">
|
|
3277
|
+
<div class="member-link">
|
|
3278
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3279
|
+
</div>
|
|
3280
|
+
<div class="member-description hidden">
|
|
3281
|
+
|
|
3282
|
+
<div class="member-text">
|
|
3283
|
+
<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>
|
|
3284
|
+
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
<ul class="member-list">
|
|
3288
|
+
<h4>Type:</h4>
|
|
3289
|
+
<li>
|
|
3290
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3291
|
+
</li>
|
|
3292
|
+
</ul>
|
|
3293
|
+
<ul class="member-list">
|
|
3294
|
+
<h4>Options:</h4>
|
|
3295
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3296
|
+
<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>
|
|
3297
|
+
<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>
|
|
3298
|
+
<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>
|
|
3299
|
+
<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>
|
|
3300
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3301
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3302
|
+
</ul>
|
|
3303
|
+
|
|
3304
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3305
|
+
|
|
3306
|
+
<div class="paperscript split">
|
|
3307
|
+
|
|
3308
|
+
<div class="buttons">
|
|
3309
|
+
<div class="button run">Run</div>
|
|
3310
|
+
</div>
|
|
3311
|
+
|
|
3312
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3313
|
+
var path = new Path.Star({
|
|
3314
|
+
center: view.center,
|
|
3315
|
+
points: 5,
|
|
3316
|
+
radius1: 20,
|
|
3317
|
+
radius2: 40,
|
|
3318
|
+
strokeColor: 'black',
|
|
3319
|
+
selected: true
|
|
3320
|
+
});
|
|
3321
|
+
|
|
3322
|
+
path.onDrawSelection = function(event) {
|
|
3323
|
+
var ctx = event.context;
|
|
3324
|
+
this.segments.forEach(function(segment) {
|
|
3325
|
+
var point = event.matrix.transform(segment.point);
|
|
3326
|
+
ctx.beginPath();
|
|
3327
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3328
|
+
ctx.fill();
|
|
3329
|
+
});
|
|
3330
|
+
return false;
|
|
3331
|
+
}
|
|
3332
|
+
</script>
|
|
3333
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3334
|
+
</div>
|
|
3335
|
+
|
|
3336
|
+
|
|
3337
|
+
</div>
|
|
3338
|
+
|
|
3339
|
+
</div>
|
|
3340
|
+
</div>
|
|
3341
|
+
|
|
3342
|
+
</div>
|
|
3343
|
+
|
|
3344
|
+
|
|
3345
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3346
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
<div id="addeffect-effect" class="member">
|
|
3350
|
+
<div class="member-link">
|
|
3351
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3352
|
+
</div>
|
|
3353
|
+
<div class="member-description hidden">
|
|
3354
|
+
<div class="member-text">
|
|
3355
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3356
|
+
|
|
3357
|
+
|
|
3358
|
+
<ul class="member-list">
|
|
3359
|
+
<h4>Parameters:</h4>
|
|
3360
|
+
|
|
3361
|
+
<li>
|
|
3362
|
+
<tt>effect:</tt>
|
|
3363
|
+
<tt>Object</tt>
|
|
3364
|
+
— the plain object describing the effect
|
|
3365
|
+
|
|
3366
|
+
</li>
|
|
3367
|
+
|
|
3368
|
+
</ul>
|
|
3369
|
+
|
|
3370
|
+
|
|
3371
|
+
<ul class="member-list">
|
|
3372
|
+
<h4>Returns:</h4>
|
|
3373
|
+
|
|
3374
|
+
<li>
|
|
3375
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3376
|
+
</li>
|
|
3377
|
+
|
|
3378
|
+
|
|
3379
|
+
</ul>
|
|
3380
|
+
|
|
3381
|
+
|
|
3382
|
+
|
|
3383
|
+
|
|
3384
|
+
|
|
3385
|
+
</div>
|
|
3386
|
+
</div>
|
|
3387
|
+
</div>
|
|
3388
|
+
|
|
3389
|
+
|
|
3390
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3391
|
+
<div class="member-link">
|
|
3392
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3393
|
+
</div>
|
|
3394
|
+
<div class="member-description hidden">
|
|
3395
|
+
<div class="member-text">
|
|
3396
|
+
<p>Inserts an effect into the item’s effects at the given index.</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 at which to insert the effect
|
|
3406
|
+
|
|
3407
|
+
</li>
|
|
3408
|
+
|
|
3409
|
+
<li>
|
|
3410
|
+
<tt>effect:</tt>
|
|
3411
|
+
<tt>Object</tt>
|
|
3412
|
+
— the plain object describing the effect
|
|
3413
|
+
|
|
3414
|
+
</li>
|
|
3415
|
+
|
|
3416
|
+
</ul>
|
|
3417
|
+
|
|
3418
|
+
|
|
3419
|
+
<ul class="member-list">
|
|
3420
|
+
<h4>Returns:</h4>
|
|
3421
|
+
|
|
3422
|
+
<li>
|
|
3423
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3424
|
+
</li>
|
|
3425
|
+
|
|
3426
|
+
|
|
3427
|
+
</ul>
|
|
3428
|
+
|
|
3429
|
+
|
|
3430
|
+
|
|
3431
|
+
|
|
3432
|
+
|
|
3433
|
+
</div>
|
|
3434
|
+
</div>
|
|
3435
|
+
</div>
|
|
3436
|
+
|
|
3437
|
+
|
|
3438
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3439
|
+
<div class="member-link">
|
|
3440
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3441
|
+
</div>
|
|
3442
|
+
<div class="member-description hidden">
|
|
3443
|
+
<div class="member-text">
|
|
3444
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3445
|
+
|
|
3446
|
+
|
|
3447
|
+
<ul class="member-list">
|
|
3448
|
+
<h4>Parameters:</h4>
|
|
3449
|
+
|
|
3450
|
+
<li>
|
|
3451
|
+
<tt>index:</tt>
|
|
3452
|
+
<tt>Number</tt>
|
|
3453
|
+
— the index at which to insert the effects
|
|
3454
|
+
|
|
3455
|
+
</li>
|
|
3456
|
+
|
|
3457
|
+
<li>
|
|
3458
|
+
<tt>effects:</tt>
|
|
3459
|
+
Array of <tt>Object</tt> objects
|
|
3460
|
+
— the plain objects describing the effects
|
|
3461
|
+
|
|
3462
|
+
</li>
|
|
3463
|
+
|
|
3464
|
+
</ul>
|
|
3465
|
+
|
|
3466
|
+
|
|
3467
|
+
<ul class="member-list">
|
|
3468
|
+
<h4>Returns:</h4>
|
|
3469
|
+
|
|
3470
|
+
<li>
|
|
3471
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3472
|
+
</li>
|
|
3473
|
+
|
|
3474
|
+
|
|
3475
|
+
</ul>
|
|
2929
3476
|
|
|
2930
3477
|
|
|
2931
|
-
</div>
|
|
2932
3478
|
|
|
3479
|
+
|
|
3480
|
+
|
|
3481
|
+
</div>
|
|
2933
3482
|
</div>
|
|
2934
3483
|
</div>
|
|
2935
3484
|
|
|
2936
3485
|
|
|
2937
|
-
<div id="
|
|
3486
|
+
<div id="removeeffect-index" class="member">
|
|
2938
3487
|
<div class="member-link">
|
|
2939
|
-
<a name="
|
|
3488
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
2940
3489
|
</div>
|
|
2941
3490
|
<div class="member-description hidden">
|
|
2942
|
-
|
|
2943
3491
|
<div class="member-text">
|
|
2944
|
-
<p>
|
|
3492
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3493
|
+
|
|
2945
3494
|
|
|
3495
|
+
<ul class="member-list">
|
|
3496
|
+
<h4>Parameters:</h4>
|
|
2946
3497
|
|
|
3498
|
+
<li>
|
|
3499
|
+
<tt>index:</tt>
|
|
3500
|
+
<tt>Number</tt>
|
|
3501
|
+
— the index of the effect to remove
|
|
3502
|
+
|
|
3503
|
+
</li>
|
|
2947
3504
|
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
<li>
|
|
2951
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2952
|
-
</li>
|
|
2953
|
-
</ul>
|
|
2954
|
-
|
|
3505
|
+
</ul>
|
|
3506
|
+
|
|
2955
3507
|
|
|
2956
3508
|
<ul class="member-list">
|
|
2957
|
-
<h4>
|
|
3509
|
+
<h4>Returns:</h4>
|
|
2958
3510
|
|
|
2959
|
-
<li
|
|
3511
|
+
<li>
|
|
3512
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3513
|
+
</li>
|
|
3514
|
+
|
|
2960
3515
|
|
|
2961
3516
|
</ul>
|
|
2962
3517
|
|
|
2963
|
-
<h4>Example:<span class="description">When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
|
|
2964
3518
|
|
|
2965
|
-
<div class="paperscript split">
|
|
2966
3519
|
|
|
2967
|
-
|
|
2968
|
-
|
|
3520
|
+
|
|
3521
|
+
|
|
2969
3522
|
</div>
|
|
2970
|
-
|
|
2971
|
-
<script type="text/paperscript" canvas="canvas-32">
|
|
2972
|
-
// Create a circle shaped path at the center of the view:
|
|
2973
|
-
var path = new Path.Circle({
|
|
2974
|
-
center: view.center,
|
|
2975
|
-
radius: 25,
|
|
2976
|
-
fillColor: 'black'
|
|
2977
|
-
});
|
|
2978
|
-
|
|
2979
|
-
// When the mouse enters the item, set its fill color to red:
|
|
2980
|
-
path.onMouseEnter = function(event) {
|
|
2981
|
-
this.fillColor = 'red';
|
|
2982
|
-
}
|
|
2983
|
-
|
|
2984
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2985
|
-
path.onMouseLeave = function(event) {
|
|
2986
|
-
this.fillColor = 'black';
|
|
2987
|
-
}
|
|
2988
|
-
</script>
|
|
2989
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2990
3523
|
</div>
|
|
2991
|
-
|
|
2992
|
-
|
|
2993
|
-
<h4>Example:<span class="description">When you click the mouse, you create new circle shaped items. When you move the mouse over the item, its fill color is set to red. When you move the mouse outside again, its fill color is set back to black.</span></h4>
|
|
2994
|
-
|
|
2995
|
-
<div class="paperscript split">
|
|
2996
|
-
|
|
2997
|
-
<div class="buttons">
|
|
2998
|
-
<div class="button run">Run</div>
|
|
2999
3524
|
</div>
|
|
3000
3525
|
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3526
|
+
|
|
3527
|
+
<div id="removeeffects" class="member">
|
|
3528
|
+
<div class="member-link">
|
|
3529
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
3530
|
+
</div>
|
|
3531
|
+
<div class="member-description hidden">
|
|
3532
|
+
<div class="member-text">
|
|
3533
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3534
|
+
|
|
3535
|
+
|
|
3536
|
+
<ul class="member-list">
|
|
3537
|
+
<h4>Parameters:</h4>
|
|
3538
|
+
|
|
3539
|
+
<li>
|
|
3540
|
+
<tt>start:</tt>
|
|
3541
|
+
<tt>Number</tt>
|
|
3542
|
+
— the index of the first effect to remove
|
|
3543
|
+
— optional, default: <tt>0</tt>
|
|
3544
|
+
</li>
|
|
3545
|
+
|
|
3546
|
+
<li>
|
|
3547
|
+
<tt>end:</tt>
|
|
3548
|
+
<tt>Number</tt>
|
|
3549
|
+
— the index after the last one
|
|
3550
|
+
— optional, default: <tt>effects.length</tt>
|
|
3551
|
+
</li>
|
|
3552
|
+
|
|
3553
|
+
</ul>
|
|
3009
3554
|
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3555
|
+
|
|
3556
|
+
<ul class="member-list">
|
|
3557
|
+
<h4>Returns:</h4>
|
|
3558
|
+
|
|
3559
|
+
<li>
|
|
3560
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3561
|
+
</li>
|
|
3015
3562
|
|
|
3016
|
-
|
|
3017
|
-
|
|
3563
|
+
|
|
3564
|
+
</ul>
|
|
3018
3565
|
|
|
3019
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3020
|
-
path.onMouseLeave = leave;
|
|
3021
|
-
}
|
|
3022
|
-
</script>
|
|
3023
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
3024
|
-
</div>
|
|
3025
3566
|
|
|
3026
3567
|
|
|
3568
|
+
|
|
3569
|
+
|
|
3027
3570
|
</div>
|
|
3028
|
-
|
|
3029
3571
|
</div>
|
|
3030
3572
|
</div>
|
|
3031
3573
|
|
|
3032
3574
|
|
|
3033
|
-
<div id="
|
|
3575
|
+
<div id="geteffectoutput" class="member">
|
|
3034
3576
|
<div class="member-link">
|
|
3035
|
-
<a name="
|
|
3577
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
3036
3578
|
</div>
|
|
3037
3579
|
<div class="member-description hidden">
|
|
3038
|
-
|
|
3039
3580
|
<div class="member-text">
|
|
3040
|
-
<p>
|
|
3041
|
-
|
|
3042
|
-
|
|
3043
|
-
|
|
3044
|
-
<ul class="member-list">
|
|
3045
|
-
<h4>Type:</h4>
|
|
3046
|
-
<li>
|
|
3047
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3048
|
-
</li>
|
|
3049
|
-
</ul>
|
|
3581
|
+
<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>
|
|
3050
3582
|
|
|
3051
3583
|
|
|
3584
|
+
|
|
3052
3585
|
<ul class="member-list">
|
|
3053
|
-
<h4>
|
|
3586
|
+
<h4>Returns:</h4>
|
|
3054
3587
|
|
|
3055
|
-
<li
|
|
3588
|
+
<li>
|
|
3589
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3590
|
+
</li>
|
|
3591
|
+
|
|
3056
3592
|
|
|
3057
3593
|
</ul>
|
|
3058
3594
|
|
|
3059
|
-
<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>
|
|
3060
|
-
|
|
3061
|
-
<div class="paperscript split">
|
|
3062
|
-
|
|
3063
|
-
<div class="buttons">
|
|
3064
|
-
<div class="button run">Run</div>
|
|
3065
|
-
</div>
|
|
3066
|
-
|
|
3067
|
-
<script type="text/paperscript" canvas="canvas-34">
|
|
3068
|
-
// Create a circle shaped path at the center of the view:
|
|
3069
|
-
var path = new Path.Circle({
|
|
3070
|
-
center: view.center,
|
|
3071
|
-
radius: 25,
|
|
3072
|
-
fillColor: 'black'
|
|
3073
|
-
});
|
|
3074
|
-
|
|
3075
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
3076
|
-
path.onMouseLeave = function(event) {
|
|
3077
|
-
this.fillColor = 'red';
|
|
3078
|
-
}
|
|
3079
|
-
</script>
|
|
3080
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3081
|
-
</div>
|
|
3082
|
-
|
|
3083
3595
|
|
|
3084
|
-
</div>
|
|
3085
3596
|
|
|
3597
|
+
|
|
3598
|
+
|
|
3086
3599
|
</div>
|
|
3087
3600
|
</div>
|
|
3088
|
-
|
|
3089
3601
|
</div>
|
|
3090
3602
|
|
|
3091
|
-
|
|
3092
|
-
<!-- =========================== inherited methods ========================= -->
|
|
3093
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3094
|
-
|
|
3095
3603
|
|
|
3096
3604
|
<div id="set-props" class="member">
|
|
3097
3605
|
<div class="member-link">
|
|
@@ -3136,7 +3644,7 @@ path.onMouseLeave = function(event) {
|
|
|
3136
3644
|
<div class="button run">Run</div>
|
|
3137
3645
|
</div>
|
|
3138
3646
|
|
|
3139
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3647
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3140
3648
|
var circle = new Path.Circle({
|
|
3141
3649
|
center: [80, 50],
|
|
3142
3650
|
radius: 35
|
|
@@ -3149,7 +3657,7 @@ circle.set({
|
|
|
3149
3657
|
selected: true
|
|
3150
3658
|
});
|
|
3151
3659
|
</script>
|
|
3152
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3660
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3153
3661
|
</div>
|
|
3154
3662
|
|
|
3155
3663
|
|
|
@@ -3205,7 +3713,7 @@ circle.set({
|
|
|
3205
3713
|
<div class="button run">Run</div>
|
|
3206
3714
|
</div>
|
|
3207
3715
|
|
|
3208
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3716
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3209
3717
|
var circle = new Path.Circle({
|
|
3210
3718
|
center: [50, 50],
|
|
3211
3719
|
radius: 10,
|
|
@@ -3220,7 +3728,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3220
3728
|
copy.position.x += i * copy.bounds.width;
|
|
3221
3729
|
}
|
|
3222
3730
|
</script>
|
|
3223
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3731
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3224
3732
|
</div>
|
|
3225
3733
|
|
|
3226
3734
|
|
|
@@ -3346,7 +3854,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3346
3854
|
<div class="button run">Run</div>
|
|
3347
3855
|
</div>
|
|
3348
3856
|
|
|
3349
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3857
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3350
3858
|
var circle = new Path.Circle({
|
|
3351
3859
|
center: [50, 50],
|
|
3352
3860
|
radius: 5,
|
|
@@ -3363,7 +3871,7 @@ raster.position.x += 100;
|
|
|
3363
3871
|
circle.scale(5);
|
|
3364
3872
|
raster.scale(5);
|
|
3365
3873
|
</script>
|
|
3366
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3874
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3367
3875
|
</div>
|
|
3368
3876
|
|
|
3369
3877
|
|
|
@@ -3417,7 +3925,7 @@ raster.scale(5);
|
|
|
3417
3925
|
<div class="button run">Run</div>
|
|
3418
3926
|
</div>
|
|
3419
3927
|
|
|
3420
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3928
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3421
3929
|
var path = new Path.Star({
|
|
3422
3930
|
center: [50, 50],
|
|
3423
3931
|
points: 12,
|
|
@@ -3438,7 +3946,7 @@ function onMouseDown(event) {
|
|
|
3438
3946
|
}
|
|
3439
3947
|
}
|
|
3440
3948
|
</script>
|
|
3441
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3949
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3442
3950
|
</div>
|
|
3443
3951
|
|
|
3444
3952
|
|
|
@@ -3956,11 +4464,17 @@ function onMouseDown(event) {
|
|
|
3956
4464
|
</div>
|
|
3957
4465
|
<div class="member-description hidden">
|
|
3958
4466
|
<div class="member-text">
|
|
3959
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4467
|
+
<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>
|
|
3960
4468
|
<ul class="member-list">
|
|
3961
4469
|
<h4>Options:</h4>
|
|
3962
|
-
<li
|
|
3963
|
-
|
|
4470
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4471
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4472
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4473
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4474
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4475
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4476
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4477
|
+
`options.bounds` the identity matrix is used.</li>
|
|
3964
4478
|
<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>
|
|
3965
4479
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
3966
4480
|
<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>
|
|
@@ -3968,6 +4482,12 @@ function onMouseDown(event) {
|
|
|
3968
4482
|
<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>
|
|
3969
4483
|
<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>
|
|
3970
4484
|
<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>
|
|
4485
|
+
<li>[options.processNode] {Function} the function to process the
|
|
4486
|
+
SVG node made for each exported item, receiving an object with the
|
|
4487
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
4488
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
4489
|
+
is called before the item's name, style, visibility and data are set
|
|
4490
|
+
on the node, which replace attributes of the same names.</li>
|
|
3971
4491
|
</ul>
|
|
3972
4492
|
|
|
3973
4493
|
<ul class="member-list">
|
|
@@ -4010,6 +4530,7 @@ function onMouseDown(event) {
|
|
|
4010
4530
|
<div class="member-text">
|
|
4011
4531
|
<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>
|
|
4012
4532
|
<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>
|
|
4533
|
+
<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>
|
|
4013
4534
|
<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>
|
|
4014
4535
|
<ul class="member-list">
|
|
4015
4536
|
<h4>Options:</h4>
|
|
@@ -4021,6 +4542,13 @@ function onMouseDown(event) {
|
|
|
4021
4542
|
<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>
|
|
4022
4543
|
<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>
|
|
4023
4544
|
<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>
|
|
4545
|
+
<li>[options.processItem] {Function} the function to process the
|
|
4546
|
+
item made for each imported SVG element, receiving an object with
|
|
4547
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
4548
|
+
doesn't import, or return an item to replace it with. It is called
|
|
4549
|
+
after the element's attributes and data are applied to the item, so
|
|
4550
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
4551
|
+
copy them over from `item` as needed.</li>
|
|
4024
4552
|
</ul>
|
|
4025
4553
|
|
|
4026
4554
|
<ul class="member-list">
|
|
@@ -5300,7 +5828,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5300
5828
|
<div class="button run">Run</div>
|
|
5301
5829
|
</div>
|
|
5302
5830
|
|
|
5303
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5831
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
5304
5832
|
// Create a rectangle shaped path with its top left
|
|
5305
5833
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5306
5834
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5309,7 +5837,7 @@ path.fillColor = 'black';
|
|
|
5309
5837
|
// Rotate the path by 30 degrees:
|
|
5310
5838
|
path.rotate(30);
|
|
5311
5839
|
</script>
|
|
5312
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5840
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
5313
5841
|
</div>
|
|
5314
5842
|
|
|
5315
5843
|
|
|
@@ -5321,7 +5849,7 @@ path.rotate(30);
|
|
|
5321
5849
|
<div class="button run">Run</div>
|
|
5322
5850
|
</div>
|
|
5323
5851
|
|
|
5324
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5852
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5325
5853
|
// Create a rectangle shaped path with its top left
|
|
5326
5854
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5327
5855
|
var topLeft = new Point(175, 50);
|
|
@@ -5343,7 +5871,7 @@ function onFrame(event) {
|
|
|
5343
5871
|
path.rotate(3, view.center);
|
|
5344
5872
|
}
|
|
5345
5873
|
</script>
|
|
5346
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5874
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-43"></canvas></div>
|
|
5347
5875
|
</div>
|
|
5348
5876
|
|
|
5349
5877
|
|
|
@@ -5392,7 +5920,7 @@ function onFrame(event) {
|
|
|
5392
5920
|
<div class="button run">Run</div>
|
|
5393
5921
|
</div>
|
|
5394
5922
|
|
|
5395
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5923
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5396
5924
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5397
5925
|
// with a radius of 20:
|
|
5398
5926
|
var circle = new Path.Circle({
|
|
@@ -5404,7 +5932,7 @@ var circle = new Path.Circle({
|
|
|
5404
5932
|
// Scale the path by 150% from its center point
|
|
5405
5933
|
circle.scale(1.5);
|
|
5406
5934
|
</script>
|
|
5407
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5935
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
5408
5936
|
</div>
|
|
5409
5937
|
|
|
5410
5938
|
|
|
@@ -5416,7 +5944,7 @@ circle.scale(1.5);
|
|
|
5416
5944
|
<div class="button run">Run</div>
|
|
5417
5945
|
</div>
|
|
5418
5946
|
|
|
5419
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5947
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5420
5948
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5421
5949
|
// with a radius of 20:
|
|
5422
5950
|
var circle = new Path.Circle({
|
|
@@ -5428,7 +5956,7 @@ var circle = new Path.Circle({
|
|
|
5428
5956
|
// Scale the path 150% from its bottom left corner
|
|
5429
5957
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5430
5958
|
</script>
|
|
5431
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5959
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5432
5960
|
</div>
|
|
5433
5961
|
|
|
5434
5962
|
|
|
@@ -5484,7 +6012,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5484
6012
|
<div class="button run">Run</div>
|
|
5485
6013
|
</div>
|
|
5486
6014
|
|
|
5487
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6015
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5488
6016
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5489
6017
|
// with a radius of 20:
|
|
5490
6018
|
var circle = new Path.Circle({
|
|
@@ -5496,7 +6024,7 @@ var circle = new Path.Circle({
|
|
|
5496
6024
|
// Scale the path horizontally by 300%
|
|
5497
6025
|
circle.scale(3, 1);
|
|
5498
6026
|
</script>
|
|
5499
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6027
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5500
6028
|
</div>
|
|
5501
6029
|
|
|
5502
6030
|
|
|
@@ -5934,7 +6462,7 @@ circle.scale(3, 1);
|
|
|
5934
6462
|
<div class="button run">Run</div>
|
|
5935
6463
|
</div>
|
|
5936
6464
|
|
|
5937
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6465
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5938
6466
|
// Create a rectangle shaped path with its top left corner
|
|
5939
6467
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5940
6468
|
var path = new Path.Rectangle({
|
|
@@ -5955,7 +6483,7 @@ var circlePath = new Path.Circle({
|
|
|
5955
6483
|
// the rectangular path:
|
|
5956
6484
|
circlePath.fitBounds(path.bounds);
|
|
5957
6485
|
</script>
|
|
5958
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6486
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5959
6487
|
</div>
|
|
5960
6488
|
|
|
5961
6489
|
|
|
@@ -5967,7 +6495,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5967
6495
|
<div class="button run">Run</div>
|
|
5968
6496
|
</div>
|
|
5969
6497
|
|
|
5970
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6498
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5971
6499
|
// Create a rectangle shaped path with its top left corner
|
|
5972
6500
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5973
6501
|
var path = new Path.Rectangle({
|
|
@@ -5988,7 +6516,7 @@ var circlePath = new Path.Circle({
|
|
|
5988
6516
|
// the rectangular path:
|
|
5989
6517
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
5990
6518
|
</script>
|
|
5991
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6519
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
5992
6520
|
</div>
|
|
5993
6521
|
|
|
5994
6522
|
|
|
@@ -6000,7 +6528,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
6000
6528
|
<div class="button run">Run</div>
|
|
6001
6529
|
</div>
|
|
6002
6530
|
|
|
6003
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6531
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
6004
6532
|
var path = new Path.Circle({
|
|
6005
6533
|
center: [80, 50],
|
|
6006
6534
|
radius: 30,
|
|
@@ -6010,7 +6538,7 @@ var path = new Path.Circle({
|
|
|
6010
6538
|
// Fit the path to the bounding rectangle of the view:
|
|
6011
6539
|
path.fitBounds(view.bounds);
|
|
6012
6540
|
</script>
|
|
6013
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6541
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
|
|
6014
6542
|
</div>
|
|
6015
6543
|
|
|
6016
6544
|
|
|
@@ -6036,7 +6564,7 @@ path.fitBounds(view.bounds);
|
|
|
6036
6564
|
<li>
|
|
6037
6565
|
<tt>type:</tt>
|
|
6038
6566
|
<tt>String</tt>
|
|
6039
|
-
— 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>
|
|
6567
|
+
— 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>
|
|
6040
6568
|
|
|
6041
6569
|
</li>
|
|
6042
6570
|
|
|
@@ -6071,7 +6599,7 @@ path.fitBounds(view.bounds);
|
|
|
6071
6599
|
<div class="button run">Run</div>
|
|
6072
6600
|
</div>
|
|
6073
6601
|
|
|
6074
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6602
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
6075
6603
|
// Create a circle shaped path at the center of the view:
|
|
6076
6604
|
var path = new Path.Circle({
|
|
6077
6605
|
center: view.center,
|
|
@@ -6089,7 +6617,7 @@ path.on('mouseleave', function() {
|
|
|
6089
6617
|
this.fillColor = 'black';
|
|
6090
6618
|
});
|
|
6091
6619
|
</script>
|
|
6092
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6620
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
6093
6621
|
</div>
|
|
6094
6622
|
|
|
6095
6623
|
|
|
@@ -6113,7 +6641,7 @@ path.on('mouseleave', function() {
|
|
|
6113
6641
|
<li>
|
|
6114
6642
|
<tt>object:</tt>
|
|
6115
6643
|
<tt>Object</tt>
|
|
6116
|
-
— 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>
|
|
6644
|
+
— 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>
|
|
6117
6645
|
|
|
6118
6646
|
</li>
|
|
6119
6647
|
|
|
@@ -6141,7 +6669,7 @@ path.on('mouseleave', function() {
|
|
|
6141
6669
|
<div class="button run">Run</div>
|
|
6142
6670
|
</div>
|
|
6143
6671
|
|
|
6144
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6672
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
6145
6673
|
// Create a circle shaped path at the center of the view:
|
|
6146
6674
|
var path = new Path.Circle({
|
|
6147
6675
|
center: view.center,
|
|
@@ -6159,7 +6687,7 @@ path.on({
|
|
|
6159
6687
|
}
|
|
6160
6688
|
});
|
|
6161
6689
|
</script>
|
|
6162
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6690
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6163
6691
|
</div>
|
|
6164
6692
|
|
|
6165
6693
|
|
|
@@ -6171,7 +6699,7 @@ path.on({
|
|
|
6171
6699
|
<div class="button run">Run</div>
|
|
6172
6700
|
</div>
|
|
6173
6701
|
|
|
6174
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6702
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6175
6703
|
var pathHandlers = {
|
|
6176
6704
|
mouseenter: function(event) {
|
|
6177
6705
|
this.fillColor = 'red';
|
|
@@ -6194,7 +6722,7 @@ function onMouseDown(event) {
|
|
|
6194
6722
|
path.on(pathHandlers);
|
|
6195
6723
|
}
|
|
6196
6724
|
</script>
|
|
6197
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6725
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6198
6726
|
</div>
|
|
6199
6727
|
|
|
6200
6728
|
|
|
@@ -6218,7 +6746,7 @@ function onMouseDown(event) {
|
|
|
6218
6746
|
<li>
|
|
6219
6747
|
<tt>type:</tt>
|
|
6220
6748
|
<tt>String</tt>
|
|
6221
|
-
— 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>
|
|
6749
|
+
— 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>
|
|
6222
6750
|
|
|
6223
6751
|
</li>
|
|
6224
6752
|
|
|
@@ -6266,7 +6794,7 @@ function onMouseDown(event) {
|
|
|
6266
6794
|
<li>
|
|
6267
6795
|
<tt>object:</tt>
|
|
6268
6796
|
<tt>Object</tt>
|
|
6269
|
-
— 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>
|
|
6797
|
+
— 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>
|
|
6270
6798
|
|
|
6271
6799
|
</li>
|
|
6272
6800
|
|
|
@@ -6307,7 +6835,7 @@ function onMouseDown(event) {
|
|
|
6307
6835
|
<li>
|
|
6308
6836
|
<tt>type:</tt>
|
|
6309
6837
|
<tt>String</tt>
|
|
6310
|
-
— 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>
|
|
6838
|
+
— 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>
|
|
6311
6839
|
|
|
6312
6840
|
</li>
|
|
6313
6841
|
|
|
@@ -6355,7 +6883,7 @@ function onMouseDown(event) {
|
|
|
6355
6883
|
<li>
|
|
6356
6884
|
<tt>type:</tt>
|
|
6357
6885
|
<tt>String</tt>
|
|
6358
|
-
— 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>
|
|
6886
|
+
— 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>
|
|
6359
6887
|
|
|
6360
6888
|
</li>
|
|
6361
6889
|
|
|
@@ -6422,7 +6950,7 @@ function onMouseDown(event) {
|
|
|
6422
6950
|
<div class="button run">Run</div>
|
|
6423
6951
|
</div>
|
|
6424
6952
|
|
|
6425
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6953
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6426
6954
|
function onMouseDrag(event) {
|
|
6427
6955
|
// Create a circle shaped path at the mouse position,
|
|
6428
6956
|
// with a radius of 10:
|
|
@@ -6439,7 +6967,7 @@ function onMouseDrag(event) {
|
|
|
6439
6967
|
});
|
|
6440
6968
|
}
|
|
6441
6969
|
</script>
|
|
6442
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6970
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
|
|
6443
6971
|
</div>
|
|
6444
6972
|
|
|
6445
6973
|
|
|
@@ -6469,7 +6997,7 @@ function onMouseDrag(event) {
|
|
|
6469
6997
|
<div class="button run">Run</div>
|
|
6470
6998
|
</div>
|
|
6471
6999
|
|
|
6472
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7000
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6473
7001
|
function onMouseMove(event) {
|
|
6474
7002
|
// Create a circle shaped path at the mouse position,
|
|
6475
7003
|
// with a radius of 10:
|
|
@@ -6483,7 +7011,7 @@ function onMouseMove(event) {
|
|
|
6483
7011
|
path.removeOnMove();
|
|
6484
7012
|
}
|
|
6485
7013
|
</script>
|
|
6486
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7014
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6487
7015
|
</div>
|
|
6488
7016
|
|
|
6489
7017
|
|
|
@@ -6513,7 +7041,7 @@ function onMouseMove(event) {
|
|
|
6513
7041
|
<div class="button run">Run</div>
|
|
6514
7042
|
</div>
|
|
6515
7043
|
|
|
6516
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7044
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6517
7045
|
function onMouseDown(event) {
|
|
6518
7046
|
// Create a circle shaped path at the mouse position,
|
|
6519
7047
|
// with a radius of 10:
|
|
@@ -6527,7 +7055,7 @@ function onMouseDown(event) {
|
|
|
6527
7055
|
path.removeOnDown();
|
|
6528
7056
|
}
|
|
6529
7057
|
</script>
|
|
6530
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7058
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6531
7059
|
</div>
|
|
6532
7060
|
|
|
6533
7061
|
|
|
@@ -6557,7 +7085,7 @@ function onMouseDown(event) {
|
|
|
6557
7085
|
<div class="button run">Run</div>
|
|
6558
7086
|
</div>
|
|
6559
7087
|
|
|
6560
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7088
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6561
7089
|
function onMouseDrag(event) {
|
|
6562
7090
|
// Create a circle shaped path at the mouse position,
|
|
6563
7091
|
// with a radius of 10:
|
|
@@ -6571,7 +7099,7 @@ function onMouseDrag(event) {
|
|
|
6571
7099
|
path.removeOnDrag();
|
|
6572
7100
|
}
|
|
6573
7101
|
</script>
|
|
6574
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7102
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6575
7103
|
</div>
|
|
6576
7104
|
|
|
6577
7105
|
|
|
@@ -6601,7 +7129,7 @@ function onMouseDrag(event) {
|
|
|
6601
7129
|
<div class="button run">Run</div>
|
|
6602
7130
|
</div>
|
|
6603
7131
|
|
|
6604
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7132
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6605
7133
|
function onMouseDown(event) {
|
|
6606
7134
|
// Create a circle shaped path at the mouse position,
|
|
6607
7135
|
// with a radius of 10:
|
|
@@ -6615,7 +7143,7 @@ function onMouseDown(event) {
|
|
|
6615
7143
|
path.removeOnUp();
|
|
6616
7144
|
}
|
|
6617
7145
|
</script>
|
|
6618
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7146
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
|
|
6619
7147
|
</div>
|
|
6620
7148
|
|
|
6621
7149
|
|
|
@@ -6688,7 +7216,7 @@ function onMouseDown(event) {
|
|
|
6688
7216
|
<div class="button run">Run</div>
|
|
6689
7217
|
</div>
|
|
6690
7218
|
|
|
6691
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7219
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6692
7220
|
var path = new Path.Circle({
|
|
6693
7221
|
radius: view.bounds.height * 0.4,
|
|
6694
7222
|
center: view.center
|
|
@@ -6699,7 +7227,7 @@ path.tween(
|
|
|
6699
7227
|
3000
|
|
6700
7228
|
);
|
|
6701
7229
|
</script>
|
|
6702
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7230
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
6703
7231
|
</div>
|
|
6704
7232
|
|
|
6705
7233
|
|
|
@@ -6711,7 +7239,7 @@ path.tween(
|
|
|
6711
7239
|
<div class="button run">Run</div>
|
|
6712
7240
|
</div>
|
|
6713
7241
|
|
|
6714
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7242
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6715
7243
|
var path = new Shape.Rectangle({
|
|
6716
7244
|
fillColor: 'red',
|
|
6717
7245
|
center: [50, view.center.y],
|
|
@@ -6726,7 +7254,7 @@ path.tween({
|
|
|
6726
7254
|
duration: 2000
|
|
6727
7255
|
});
|
|
6728
7256
|
</script>
|
|
6729
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7257
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
6730
7258
|
</div>
|
|
6731
7259
|
|
|
6732
7260
|
|
|
@@ -6792,7 +7320,7 @@ path.tween({
|
|
|
6792
7320
|
<div class="button run">Run</div>
|
|
6793
7321
|
</div>
|
|
6794
7322
|
|
|
6795
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7323
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6796
7324
|
var path = new Path.Rectangle({
|
|
6797
7325
|
size: [100, 100],
|
|
6798
7326
|
position: view.center,
|
|
@@ -6806,7 +7334,7 @@ path.tween({
|
|
|
6806
7334
|
'segments[2].point.x': '-= 50'
|
|
6807
7335
|
}, 3000);
|
|
6808
7336
|
</script>
|
|
6809
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7337
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
|
|
6810
7338
|
</div>
|
|
6811
7339
|
|
|
6812
7340
|
|
|
@@ -6865,7 +7393,7 @@ path.tween({
|
|
|
6865
7393
|
<div class="button run">Run</div>
|
|
6866
7394
|
</div>
|
|
6867
7395
|
|
|
6868
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7396
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6869
7397
|
var path = new Path.Circle({
|
|
6870
7398
|
fillColor: 'blue',
|
|
6871
7399
|
radius: view.bounds.height * 0.4,
|
|
@@ -6881,7 +7409,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6881
7409
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6882
7410
|
};
|
|
6883
7411
|
</script>
|
|
6884
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7412
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
6885
7413
|
</div>
|
|
6886
7414
|
|
|
6887
7415
|
|
|
@@ -7002,7 +7530,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7002
7530
|
<div class="button run">Run</div>
|
|
7003
7531
|
</div>
|
|
7004
7532
|
|
|
7005
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7533
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
7006
7534
|
var path = new Path.Circle({
|
|
7007
7535
|
fillColor: 'blue',
|
|
7008
7536
|
radius: view.bounds.height * 0.4,
|
|
@@ -7010,7 +7538,7 @@ var path = new Path.Circle({
|
|
|
7010
7538
|
});
|
|
7011
7539
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
7012
7540
|
</script>
|
|
7013
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7541
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
7014
7542
|
</div>
|
|
7015
7543
|
|
|
7016
7544
|
|
|
@@ -8143,7 +8671,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
|
|
|
8143
8671
|
<div class="member-description hidden">
|
|
8144
8672
|
|
|
8145
8673
|
<div class="member-text">
|
|
8146
|
-
<p>The direction the paragraph’s lines run in, which <code>'start'</code> and <code>'end'</code> follow; <code>null</code> for left to right.</p>
|
|
8674
|
+
<p>The direction the paragraph’s lines run in, which <code>'start'</code> and <code>'end'</code> follow, and from which side their pieces are placed; <code>null</code> for left to right. Lines that mix directions across styles aren’t reordered by the Unicode bidirectional algorithm: their pieces follow the paragraph’s direction, and canvas orders only the letters within each piece.</p>
|
|
8147
8675
|
|
|
8148
8676
|
|
|
8149
8677
|
<ul class="member-list">
|
|
@@ -8519,7 +9047,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
|
|
|
8519
9047
|
|
|
8520
9048
|
<!-- =========================== copyright notice ========================== -->
|
|
8521
9049
|
<p class="footer">
|
|
8522
|
-
Paper.js v0.
|
|
9050
|
+
Paper.js v0.17.0<br>
|
|
8523
9051
|
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>
|
|
8524
9052
|
<div class="content-end"></div>
|
|
8525
9053
|
|