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
|
@@ -195,6 +195,91 @@ var text = new PointText({
|
|
|
195
195
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
196
196
|
|
|
197
197
|
|
|
198
|
+
<div id="effects" class="member">
|
|
199
|
+
<div class="member-link">
|
|
200
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
201
|
+
</div>
|
|
202
|
+
<div class="member-description hidden">
|
|
203
|
+
|
|
204
|
+
<div class="member-text">
|
|
205
|
+
<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,
|
|
206
|
+
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>
|
|
207
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
208
|
+
<ul>
|
|
209
|
+
<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>
|
|
210
|
+
<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>
|
|
211
|
+
</ul>
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
<ul class="member-list">
|
|
216
|
+
<h4>Type:</h4>
|
|
217
|
+
<li>
|
|
218
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
219
|
+
</li>
|
|
220
|
+
</ul>
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
<h4>Example:</h4>
|
|
224
|
+
|
|
225
|
+
<div class="paperscript split">
|
|
226
|
+
|
|
227
|
+
<div class="buttons">
|
|
228
|
+
<div class="button run">Run</div>
|
|
229
|
+
</div>
|
|
230
|
+
|
|
231
|
+
<script type="text/paperscript" canvas="canvas-2">
|
|
232
|
+
var path = new Path.Star({
|
|
233
|
+
center: view.center,
|
|
234
|
+
points: 5,
|
|
235
|
+
radius1: 20,
|
|
236
|
+
radius2: 40,
|
|
237
|
+
strokeColor: 'black',
|
|
238
|
+
strokeWidth: 8
|
|
239
|
+
});
|
|
240
|
+
path.effects = [
|
|
241
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
242
|
+
{ type: 'outline' }
|
|
243
|
+
];
|
|
244
|
+
</script>
|
|
245
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
|
|
246
|
+
</div>
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
</div>
|
|
250
|
+
|
|
251
|
+
</div>
|
|
252
|
+
</div>
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
<div id="previewbounds-matrix" class="member">
|
|
256
|
+
<div class="member-link">
|
|
257
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
258
|
+
</div>
|
|
259
|
+
<div class="member-description hidden">
|
|
260
|
+
|
|
261
|
+
<div class="member-text">
|
|
262
|
+
<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>
|
|
263
|
+
|
|
264
|
+
<p>Read only.</p>
|
|
265
|
+
|
|
266
|
+
|
|
267
|
+
|
|
268
|
+
<ul class="member-list">
|
|
269
|
+
<h4>Type:</h4>
|
|
270
|
+
<li>
|
|
271
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
272
|
+
</li>
|
|
273
|
+
</ul>
|
|
274
|
+
|
|
275
|
+
|
|
276
|
+
|
|
277
|
+
</div>
|
|
278
|
+
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
|
|
282
|
+
|
|
198
283
|
<div id="key" class="member">
|
|
199
284
|
<div class="member-link">
|
|
200
285
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -307,7 +392,7 @@ var text = new PointText({
|
|
|
307
392
|
<div class="button run">Run</div>
|
|
308
393
|
</div>
|
|
309
394
|
|
|
310
|
-
<script type="text/paperscript" canvas="canvas-
|
|
395
|
+
<script type="text/paperscript" canvas="canvas-3">
|
|
311
396
|
var path = new Path.Circle({
|
|
312
397
|
center: [80, 50],
|
|
313
398
|
radius: 35
|
|
@@ -322,7 +407,7 @@ group.addChild(path);
|
|
|
322
407
|
// The path can be accessed by name:
|
|
323
408
|
group.children['example'].fillColor = 'red';
|
|
324
409
|
</script>
|
|
325
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
410
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
|
|
326
411
|
</div>
|
|
327
412
|
|
|
328
413
|
|
|
@@ -360,7 +445,7 @@ group.children['example'].fillColor = 'red';
|
|
|
360
445
|
<div class="button run">Run</div>
|
|
361
446
|
</div>
|
|
362
447
|
|
|
363
|
-
<script type="text/paperscript" canvas="canvas-
|
|
448
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
364
449
|
var circle = new Path.Circle({
|
|
365
450
|
center: [80, 50],
|
|
366
451
|
radius: 30
|
|
@@ -371,7 +456,7 @@ circle.style = {
|
|
|
371
456
|
strokeWidth: 5
|
|
372
457
|
};
|
|
373
458
|
</script>
|
|
374
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
459
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
|
|
375
460
|
</div>
|
|
376
461
|
|
|
377
462
|
|
|
@@ -383,7 +468,7 @@ circle.style = {
|
|
|
383
468
|
<div class="button run">Run</div>
|
|
384
469
|
</div>
|
|
385
470
|
|
|
386
|
-
<script type="text/paperscript" canvas="canvas-
|
|
471
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
387
472
|
var path = new Path.Circle({
|
|
388
473
|
center: [50, 50],
|
|
389
474
|
radius: 30,
|
|
@@ -398,7 +483,7 @@ var path2 = new Path.Circle({
|
|
|
398
483
|
// Copy the path style of path:
|
|
399
484
|
path2.style = path.style;
|
|
400
485
|
</script>
|
|
401
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
486
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
402
487
|
</div>
|
|
403
488
|
|
|
404
489
|
|
|
@@ -410,7 +495,7 @@ path2.style = path.style;
|
|
|
410
495
|
<div class="button run">Run</div>
|
|
411
496
|
</div>
|
|
412
497
|
|
|
413
|
-
<script type="text/paperscript" canvas="canvas-
|
|
498
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
414
499
|
var myStyle = {
|
|
415
500
|
fillColor: 'red',
|
|
416
501
|
strokeColor: 'blue',
|
|
@@ -429,7 +514,7 @@ var path2 = new Path.Circle({
|
|
|
429
514
|
});
|
|
430
515
|
path2.style = myStyle;
|
|
431
516
|
</script>
|
|
432
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
517
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
433
518
|
</div>
|
|
434
519
|
|
|
435
520
|
|
|
@@ -471,7 +556,7 @@ path2.style = myStyle;
|
|
|
471
556
|
<div class="button run">Run</div>
|
|
472
557
|
</div>
|
|
473
558
|
|
|
474
|
-
<script type="text/paperscript" canvas="canvas-
|
|
559
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
475
560
|
var unlockedItem = new Path.Circle({
|
|
476
561
|
center: view.center - [35, 0],
|
|
477
562
|
radius: 30,
|
|
@@ -498,7 +583,7 @@ new PointText({
|
|
|
498
583
|
justification: 'center'
|
|
499
584
|
});
|
|
500
585
|
</script>
|
|
501
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
586
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
502
587
|
</div>
|
|
503
588
|
|
|
504
589
|
|
|
@@ -540,7 +625,7 @@ new PointText({
|
|
|
540
625
|
<div class="button run">Run</div>
|
|
541
626
|
</div>
|
|
542
627
|
|
|
543
|
-
<script type="text/paperscript" canvas="canvas-
|
|
628
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
544
629
|
var path = new Path.Circle({
|
|
545
630
|
center: [50, 50],
|
|
546
631
|
radius: 20,
|
|
@@ -550,7 +635,7 @@ var path = new Path.Circle({
|
|
|
550
635
|
// Hide the path:
|
|
551
636
|
path.visible = false;
|
|
552
637
|
</script>
|
|
553
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
638
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
554
639
|
</div>
|
|
555
640
|
|
|
556
641
|
|
|
@@ -598,7 +683,7 @@ path.visible = false;
|
|
|
598
683
|
<div class="button run">Run</div>
|
|
599
684
|
</div>
|
|
600
685
|
|
|
601
|
-
<script type="text/paperscript" canvas="canvas-
|
|
686
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
602
687
|
// Create a white rectangle in the background
|
|
603
688
|
// with the same dimensions as the view:
|
|
604
689
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -619,7 +704,7 @@ var circle2 = new Path.Circle({
|
|
|
619
704
|
// Set the blend mode of circle2:
|
|
620
705
|
circle2.blendMode = 'multiply';
|
|
621
706
|
</script>
|
|
622
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
707
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
623
708
|
</div>
|
|
624
709
|
|
|
625
710
|
|
|
@@ -661,7 +746,7 @@ circle2.blendMode = 'multiply';
|
|
|
661
746
|
<div class="button run">Run</div>
|
|
662
747
|
</div>
|
|
663
748
|
|
|
664
|
-
<script type="text/paperscript" canvas="canvas-
|
|
749
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
665
750
|
var circle = new Path.Circle({
|
|
666
751
|
center: [80, 50],
|
|
667
752
|
radius: 35,
|
|
@@ -679,7 +764,7 @@ var circle2 = new Path.Circle({
|
|
|
679
764
|
// Make circle2 50% transparent:
|
|
680
765
|
circle2.opacity = 0.5;
|
|
681
766
|
</script>
|
|
682
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
767
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
683
768
|
</div>
|
|
684
769
|
|
|
685
770
|
|
|
@@ -802,14 +887,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
802
887
|
<div class="button run">Run</div>
|
|
803
888
|
</div>
|
|
804
889
|
|
|
805
|
-
<script type="text/paperscript" canvas="canvas-
|
|
890
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
806
891
|
var path = new Path.Circle({
|
|
807
892
|
center: [80, 50],
|
|
808
893
|
radius: 35
|
|
809
894
|
});
|
|
810
895
|
path.selected = true; // Select the path
|
|
811
896
|
</script>
|
|
812
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
897
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
813
898
|
</div>
|
|
814
899
|
|
|
815
900
|
|
|
@@ -966,7 +1051,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
966
1051
|
<div class="button run">Run</div>
|
|
967
1052
|
</div>
|
|
968
1053
|
|
|
969
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1054
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
970
1055
|
// Create a circle at position { x: 10, y: 10 }
|
|
971
1056
|
var circle = new Path.Circle({
|
|
972
1057
|
center: new Point(10, 10),
|
|
@@ -980,7 +1065,7 @@ circle.position = new Point(20, 20);
|
|
|
980
1065
|
// Move the circle 100 points to the right and 50 points down
|
|
981
1066
|
circle.position += new Point(100, 50);
|
|
982
1067
|
</script>
|
|
983
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1068
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
984
1069
|
</div>
|
|
985
1070
|
|
|
986
1071
|
|
|
@@ -992,7 +1077,7 @@ circle.position += new Point(100, 50);
|
|
|
992
1077
|
<div class="button run">Run</div>
|
|
993
1078
|
</div>
|
|
994
1079
|
|
|
995
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1080
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
996
1081
|
// Create a circle at position { x: 20, y: 20 }
|
|
997
1082
|
var circle = new Path.Circle({
|
|
998
1083
|
center: new Point(20, 20),
|
|
@@ -1003,7 +1088,7 @@ var circle = new Path.Circle({
|
|
|
1003
1088
|
// Move the circle 100 points to the right
|
|
1004
1089
|
circle.position.x += 100;
|
|
1005
1090
|
</script>
|
|
1006
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1091
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1007
1092
|
</div>
|
|
1008
1093
|
|
|
1009
1094
|
|
|
@@ -1529,7 +1614,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1529
1614
|
<div class="button run">Run</div>
|
|
1530
1615
|
</div>
|
|
1531
1616
|
|
|
1532
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1617
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1533
1618
|
var path = new Path.Circle({
|
|
1534
1619
|
center: [80, 50],
|
|
1535
1620
|
radius: 35
|
|
@@ -1542,7 +1627,7 @@ group.addChild(path);
|
|
|
1542
1627
|
// Access the path through the group's children array:
|
|
1543
1628
|
group.children[0].fillColor = 'red';
|
|
1544
1629
|
</script>
|
|
1545
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1630
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1546
1631
|
</div>
|
|
1547
1632
|
|
|
1548
1633
|
|
|
@@ -1554,7 +1639,7 @@ group.children[0].fillColor = 'red';
|
|
|
1554
1639
|
<div class="button run">Run</div>
|
|
1555
1640
|
</div>
|
|
1556
1641
|
|
|
1557
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1642
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1558
1643
|
var path = new Path.Circle({
|
|
1559
1644
|
center: [80, 50],
|
|
1560
1645
|
radius: 35
|
|
@@ -1569,7 +1654,7 @@ group.addChild(path);
|
|
|
1569
1654
|
// The path can be accessed by name:
|
|
1570
1655
|
group.children['example'].fillColor = 'orange';
|
|
1571
1656
|
</script>
|
|
1572
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1657
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1573
1658
|
</div>
|
|
1574
1659
|
|
|
1575
1660
|
|
|
@@ -1581,7 +1666,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1581
1666
|
<div class="button run">Run</div>
|
|
1582
1667
|
</div>
|
|
1583
1668
|
|
|
1584
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1669
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1585
1670
|
var path = new Path.Circle({
|
|
1586
1671
|
center: [80, 50],
|
|
1587
1672
|
radius: 35
|
|
@@ -1593,7 +1678,7 @@ group.children = [path];
|
|
|
1593
1678
|
// The path is the first child of the group:
|
|
1594
1679
|
group.firstChild.fillColor = 'green';
|
|
1595
1680
|
</script>
|
|
1596
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1681
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1597
1682
|
</div>
|
|
1598
1683
|
|
|
1599
1684
|
|
|
@@ -1770,7 +1855,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1770
1855
|
<div class="button run">Run</div>
|
|
1771
1856
|
</div>
|
|
1772
1857
|
|
|
1773
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1858
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1774
1859
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1775
1860
|
// with a radius of 35:
|
|
1776
1861
|
var circle = new Path.Circle({
|
|
@@ -1781,7 +1866,7 @@ var circle = new Path.Circle({
|
|
|
1781
1866
|
// Set its stroke color to RGB red:
|
|
1782
1867
|
circle.strokeColor = new Color(1, 0, 0);
|
|
1783
1868
|
</script>
|
|
1784
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1869
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
1785
1870
|
</div>
|
|
1786
1871
|
|
|
1787
1872
|
|
|
@@ -1818,7 +1903,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
1818
1903
|
<div class="button run">Run</div>
|
|
1819
1904
|
</div>
|
|
1820
1905
|
|
|
1821
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1906
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1822
1907
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1823
1908
|
// with a radius of 35:
|
|
1824
1909
|
var circle = new Path.Circle({
|
|
@@ -1830,7 +1915,7 @@ var circle = new Path.Circle({
|
|
|
1830
1915
|
// Set its stroke width to 10:
|
|
1831
1916
|
circle.strokeWidth = 10;
|
|
1832
1917
|
</script>
|
|
1833
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1918
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
|
|
1834
1919
|
</div>
|
|
1835
1920
|
|
|
1836
1921
|
|
|
@@ -1877,7 +1962,7 @@ circle.strokeWidth = 10;
|
|
|
1877
1962
|
<div class="button run">Run</div>
|
|
1878
1963
|
</div>
|
|
1879
1964
|
|
|
1880
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1965
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1881
1966
|
var line = new Path({
|
|
1882
1967
|
segments: [[80, 50], [420, 50]],
|
|
1883
1968
|
strokeColor: 'black',
|
|
@@ -1898,7 +1983,7 @@ var line2 = line.clone();
|
|
|
1898
1983
|
line2.position.y += 100;
|
|
1899
1984
|
line2.strokeCap = 'butt';
|
|
1900
1985
|
</script>
|
|
1901
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
1986
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-19"></canvas></div>
|
|
1902
1987
|
</div>
|
|
1903
1988
|
|
|
1904
1989
|
|
|
@@ -1945,7 +2030,7 @@ line2.strokeCap = 'butt';
|
|
|
1945
2030
|
<div class="button run">Run</div>
|
|
1946
2031
|
</div>
|
|
1947
2032
|
|
|
1948
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2033
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
1949
2034
|
var path = new Path({
|
|
1950
2035
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
1951
2036
|
strokeColor: 'black',
|
|
@@ -1962,7 +2047,7 @@ var path3 = path2.clone();
|
|
|
1962
2047
|
path3.position.x += path3.bounds.width * 1.5;
|
|
1963
2048
|
path3.strokeJoin = 'bevel';
|
|
1964
2049
|
</script>
|
|
1965
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
2050
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-20"></canvas></div>
|
|
1966
2051
|
</div>
|
|
1967
2052
|
|
|
1968
2053
|
|
|
@@ -2066,7 +2151,7 @@ path3.strokeJoin = 'bevel';
|
|
|
2066
2151
|
<div class="button run">Run</div>
|
|
2067
2152
|
</div>
|
|
2068
2153
|
|
|
2069
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2154
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2070
2155
|
var path = new Path.Circle({
|
|
2071
2156
|
center: [80, 50],
|
|
2072
2157
|
radius: 40,
|
|
@@ -2077,7 +2162,7 @@ var path = new Path.Circle({
|
|
|
2077
2162
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
2078
2163
|
path.dashArray = [10, 4];
|
|
2079
2164
|
</script>
|
|
2080
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2165
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2081
2166
|
</div>
|
|
2082
2167
|
|
|
2083
2168
|
|
|
@@ -2112,6 +2197,42 @@ path.dashArray = [10, 4];
|
|
|
2112
2197
|
|
|
2113
2198
|
|
|
2114
2199
|
|
|
2200
|
+
</div>
|
|
2201
|
+
|
|
2202
|
+
</div>
|
|
2203
|
+
</div>
|
|
2204
|
+
|
|
2205
|
+
|
|
2206
|
+
<div id="paintorder" class="member">
|
|
2207
|
+
<div class="member-link">
|
|
2208
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
2209
|
+
</div>
|
|
2210
|
+
<div class="member-description hidden">
|
|
2211
|
+
|
|
2212
|
+
<div class="member-text">
|
|
2213
|
+
<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>
|
|
2214
|
+
|
|
2215
|
+
|
|
2216
|
+
<ul class="member-list">
|
|
2217
|
+
<h4>Values:</h4>
|
|
2218
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
2219
|
+
</ul>
|
|
2220
|
+
|
|
2221
|
+
|
|
2222
|
+
<ul class="member-list">
|
|
2223
|
+
<h4>Default:</h4>
|
|
2224
|
+
<li><tt>'fill'</tt></li>
|
|
2225
|
+
</ul>
|
|
2226
|
+
|
|
2227
|
+
<ul class="member-list">
|
|
2228
|
+
<h4>Type:</h4>
|
|
2229
|
+
<li>
|
|
2230
|
+
<tt>String</tt>
|
|
2231
|
+
</li>
|
|
2232
|
+
</ul>
|
|
2233
|
+
|
|
2234
|
+
|
|
2235
|
+
|
|
2115
2236
|
</div>
|
|
2116
2237
|
|
|
2117
2238
|
</div>
|
|
@@ -2147,7 +2268,7 @@ path.dashArray = [10, 4];
|
|
|
2147
2268
|
<div class="button run">Run</div>
|
|
2148
2269
|
</div>
|
|
2149
2270
|
|
|
2150
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2271
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2151
2272
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2152
2273
|
// with a radius of 35:
|
|
2153
2274
|
var circle = new Path.Circle({
|
|
@@ -2158,7 +2279,7 @@ var circle = new Path.Circle({
|
|
|
2158
2279
|
// Set the fill color of the circle to RGB red:
|
|
2159
2280
|
circle.fillColor = new Color(1, 0, 0);
|
|
2160
2281
|
</script>
|
|
2161
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2282
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2162
2283
|
</div>
|
|
2163
2284
|
|
|
2164
2285
|
|
|
@@ -2233,7 +2354,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2233
2354
|
<div class="button run">Run</div>
|
|
2234
2355
|
</div>
|
|
2235
2356
|
|
|
2236
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2357
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2237
2358
|
var circle = new Path.Circle({
|
|
2238
2359
|
center: [80, 50],
|
|
2239
2360
|
radius: 35,
|
|
@@ -2246,7 +2367,7 @@ var circle = new Path.Circle({
|
|
|
2246
2367
|
shadowOffset: new Point(5, 5)
|
|
2247
2368
|
});
|
|
2248
2369
|
</script>
|
|
2249
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2370
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2250
2371
|
</div>
|
|
2251
2372
|
|
|
2252
2373
|
|
|
@@ -2387,7 +2508,7 @@ var circle = new Path.Circle({
|
|
|
2387
2508
|
<div class="button run">Run</div>
|
|
2388
2509
|
</div>
|
|
2389
2510
|
|
|
2390
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2511
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2391
2512
|
// Create a rectangle shaped path with its top left point at:
|
|
2392
2513
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2393
2514
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2398,7 +2519,7 @@ path.onFrame = function(event) {
|
|
|
2398
2519
|
this.rotate(3);
|
|
2399
2520
|
}
|
|
2400
2521
|
</script>
|
|
2401
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2522
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2402
2523
|
</div>
|
|
2403
2524
|
|
|
2404
2525
|
|
|
@@ -2442,7 +2563,7 @@ path.onFrame = function(event) {
|
|
|
2442
2563
|
<div class="button run">Run</div>
|
|
2443
2564
|
</div>
|
|
2444
2565
|
|
|
2445
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2566
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2446
2567
|
// Create a circle shaped path at the center of the view:
|
|
2447
2568
|
var path = new Path.Circle({
|
|
2448
2569
|
center: view.center,
|
|
@@ -2456,7 +2577,7 @@ path.onMouseDown = function(event) {
|
|
|
2456
2577
|
this.fillColor = 'red';
|
|
2457
2578
|
}
|
|
2458
2579
|
</script>
|
|
2459
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2580
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2460
2581
|
</div>
|
|
2461
2582
|
|
|
2462
2583
|
|
|
@@ -2468,7 +2589,7 @@ path.onMouseDown = function(event) {
|
|
|
2468
2589
|
<div class="button run">Run</div>
|
|
2469
2590
|
</div>
|
|
2470
2591
|
|
|
2471
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2592
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2472
2593
|
// Loop 30 times:
|
|
2473
2594
|
for (var i = 0; i < 30; i++) {
|
|
2474
2595
|
// Create a circle shaped path at a random position
|
|
@@ -2486,7 +2607,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2486
2607
|
}
|
|
2487
2608
|
}
|
|
2488
2609
|
</script>
|
|
2489
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2610
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
2490
2611
|
</div>
|
|
2491
2612
|
|
|
2492
2613
|
|
|
@@ -2530,7 +2651,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2530
2651
|
<div class="button run">Run</div>
|
|
2531
2652
|
</div>
|
|
2532
2653
|
|
|
2533
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2654
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2534
2655
|
// Create a circle shaped path at the center of the view:
|
|
2535
2656
|
var path = new Path.Circle({
|
|
2536
2657
|
center: view.center,
|
|
@@ -2543,7 +2664,7 @@ path.onMouseDrag = function(event) {
|
|
|
2543
2664
|
path.position += event.delta;
|
|
2544
2665
|
}
|
|
2545
2666
|
</script>
|
|
2546
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2667
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-27"></canvas></div>
|
|
2547
2668
|
</div>
|
|
2548
2669
|
|
|
2549
2670
|
|
|
@@ -2587,7 +2708,7 @@ path.onMouseDrag = function(event) {
|
|
|
2587
2708
|
<div class="button run">Run</div>
|
|
2588
2709
|
</div>
|
|
2589
2710
|
|
|
2590
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2711
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2591
2712
|
// Create a circle shaped path at the center of the view:
|
|
2592
2713
|
var path = new Path.Circle({
|
|
2593
2714
|
center: view.center,
|
|
@@ -2601,7 +2722,7 @@ path.onMouseUp = function(event) {
|
|
|
2601
2722
|
this.fillColor = 'red';
|
|
2602
2723
|
}
|
|
2603
2724
|
</script>
|
|
2604
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2725
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2605
2726
|
</div>
|
|
2606
2727
|
|
|
2607
2728
|
|
|
@@ -2645,7 +2766,7 @@ path.onMouseUp = function(event) {
|
|
|
2645
2766
|
<div class="button run">Run</div>
|
|
2646
2767
|
</div>
|
|
2647
2768
|
|
|
2648
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2769
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2649
2770
|
// Create a circle shaped path at the center of the view:
|
|
2650
2771
|
var path = new Path.Circle({
|
|
2651
2772
|
center: view.center,
|
|
@@ -2659,7 +2780,7 @@ path.onClick = function(event) {
|
|
|
2659
2780
|
this.fillColor = 'red';
|
|
2660
2781
|
}
|
|
2661
2782
|
</script>
|
|
2662
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2783
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2663
2784
|
</div>
|
|
2664
2785
|
|
|
2665
2786
|
|
|
@@ -2671,7 +2792,7 @@ path.onClick = function(event) {
|
|
|
2671
2792
|
<div class="button run">Run</div>
|
|
2672
2793
|
</div>
|
|
2673
2794
|
|
|
2674
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2795
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2675
2796
|
// Loop 30 times:
|
|
2676
2797
|
for (var i = 0; i < 30; i++) {
|
|
2677
2798
|
// Create a circle shaped path at a random position
|
|
@@ -2689,7 +2810,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2689
2810
|
}
|
|
2690
2811
|
}
|
|
2691
2812
|
</script>
|
|
2692
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2813
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2693
2814
|
</div>
|
|
2694
2815
|
|
|
2695
2816
|
|
|
@@ -2733,7 +2854,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2733
2854
|
<div class="button run">Run</div>
|
|
2734
2855
|
</div>
|
|
2735
2856
|
|
|
2736
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2857
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2737
2858
|
// Create a circle shaped path at the center of the view:
|
|
2738
2859
|
var path = new Path.Circle({
|
|
2739
2860
|
center: view.center,
|
|
@@ -2747,7 +2868,7 @@ path.onDoubleClick = function(event) {
|
|
|
2747
2868
|
this.fillColor = 'red';
|
|
2748
2869
|
}
|
|
2749
2870
|
</script>
|
|
2750
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2871
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2751
2872
|
</div>
|
|
2752
2873
|
|
|
2753
2874
|
|
|
@@ -2759,7 +2880,7 @@ path.onDoubleClick = function(event) {
|
|
|
2759
2880
|
<div class="button run">Run</div>
|
|
2760
2881
|
</div>
|
|
2761
2882
|
|
|
2762
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2883
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2763
2884
|
// Loop 30 times:
|
|
2764
2885
|
for (var i = 0; i < 30; i++) {
|
|
2765
2886
|
// Create a circle shaped path at a random position
|
|
@@ -2777,7 +2898,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2777
2898
|
}
|
|
2778
2899
|
}
|
|
2779
2900
|
</script>
|
|
2780
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2901
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2781
2902
|
</div>
|
|
2782
2903
|
|
|
2783
2904
|
|
|
@@ -2821,7 +2942,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2821
2942
|
<div class="button run">Run</div>
|
|
2822
2943
|
</div>
|
|
2823
2944
|
|
|
2824
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2945
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2825
2946
|
// Create a circle shaped path at the center of the view:
|
|
2826
2947
|
var path = new Path.Circle({
|
|
2827
2948
|
center: view.center,
|
|
@@ -2829,180 +2950,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
2829
2950
|
fillColor: 'black'
|
|
2830
2951
|
});
|
|
2831
2952
|
|
|
2832
|
-
// When the mouse moves on top of the item, set its opacity
|
|
2833
|
-
// to a random value between 0 and 1:
|
|
2834
|
-
path.onMouseMove = function(event) {
|
|
2835
|
-
this.opacity = Math.random();
|
|
2836
|
-
}
|
|
2837
|
-
</script>
|
|
2838
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2839
|
-
</div>
|
|
2953
|
+
// When the mouse moves on top of the item, set its opacity
|
|
2954
|
+
// to a random value between 0 and 1:
|
|
2955
|
+
path.onMouseMove = function(event) {
|
|
2956
|
+
this.opacity = Math.random();
|
|
2957
|
+
}
|
|
2958
|
+
</script>
|
|
2959
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2960
|
+
</div>
|
|
2961
|
+
|
|
2962
|
+
|
|
2963
|
+
</div>
|
|
2964
|
+
|
|
2965
|
+
</div>
|
|
2966
|
+
</div>
|
|
2967
|
+
|
|
2968
|
+
|
|
2969
|
+
<div id="onmouseenter" class="member">
|
|
2970
|
+
<div class="member-link">
|
|
2971
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
2972
|
+
</div>
|
|
2973
|
+
<div class="member-description hidden">
|
|
2974
|
+
|
|
2975
|
+
<div class="member-text">
|
|
2976
|
+
<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>
|
|
2977
|
+
|
|
2978
|
+
|
|
2979
|
+
|
|
2980
|
+
<ul class="member-list">
|
|
2981
|
+
<h4>Type:</h4>
|
|
2982
|
+
<li>
|
|
2983
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2984
|
+
</li>
|
|
2985
|
+
</ul>
|
|
2986
|
+
|
|
2987
|
+
|
|
2988
|
+
<ul class="member-list">
|
|
2989
|
+
<h4>See also:</h4>
|
|
2990
|
+
|
|
2991
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
2992
|
+
|
|
2993
|
+
</ul>
|
|
2994
|
+
|
|
2995
|
+
<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>
|
|
2996
|
+
|
|
2997
|
+
<div class="paperscript split">
|
|
2998
|
+
|
|
2999
|
+
<div class="buttons">
|
|
3000
|
+
<div class="button run">Run</div>
|
|
3001
|
+
</div>
|
|
3002
|
+
|
|
3003
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
3004
|
+
// Create a circle shaped path at the center of the view:
|
|
3005
|
+
var path = new Path.Circle({
|
|
3006
|
+
center: view.center,
|
|
3007
|
+
radius: 25,
|
|
3008
|
+
fillColor: 'black'
|
|
3009
|
+
});
|
|
3010
|
+
|
|
3011
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3012
|
+
path.onMouseEnter = function(event) {
|
|
3013
|
+
this.fillColor = 'red';
|
|
3014
|
+
}
|
|
3015
|
+
|
|
3016
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3017
|
+
path.onMouseLeave = function(event) {
|
|
3018
|
+
this.fillColor = 'black';
|
|
3019
|
+
}
|
|
3020
|
+
</script>
|
|
3021
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3022
|
+
</div>
|
|
3023
|
+
|
|
3024
|
+
|
|
3025
|
+
<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>
|
|
3026
|
+
|
|
3027
|
+
<div class="paperscript split">
|
|
3028
|
+
|
|
3029
|
+
<div class="buttons">
|
|
3030
|
+
<div class="button run">Run</div>
|
|
3031
|
+
</div>
|
|
3032
|
+
|
|
3033
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
3034
|
+
function enter(event) {
|
|
3035
|
+
this.fillColor = 'red';
|
|
3036
|
+
}
|
|
3037
|
+
|
|
3038
|
+
function leave(event) {
|
|
3039
|
+
this.fillColor = 'black';
|
|
3040
|
+
}
|
|
3041
|
+
|
|
3042
|
+
// When the mouse is pressed:
|
|
3043
|
+
function onMouseDown(event) {
|
|
3044
|
+
// Create a circle shaped path at the position of the mouse:
|
|
3045
|
+
var path = new Path.Circle(event.point, 25);
|
|
3046
|
+
path.fillColor = 'black';
|
|
3047
|
+
|
|
3048
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3049
|
+
path.onMouseEnter = enter;
|
|
3050
|
+
|
|
3051
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3052
|
+
path.onMouseLeave = leave;
|
|
3053
|
+
}
|
|
3054
|
+
</script>
|
|
3055
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3056
|
+
</div>
|
|
3057
|
+
|
|
3058
|
+
|
|
3059
|
+
</div>
|
|
3060
|
+
|
|
3061
|
+
</div>
|
|
3062
|
+
</div>
|
|
3063
|
+
|
|
3064
|
+
|
|
3065
|
+
<div id="onmouseleave" class="member">
|
|
3066
|
+
<div class="member-link">
|
|
3067
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
3068
|
+
</div>
|
|
3069
|
+
<div class="member-description hidden">
|
|
3070
|
+
|
|
3071
|
+
<div class="member-text">
|
|
3072
|
+
<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>
|
|
3073
|
+
|
|
3074
|
+
|
|
3075
|
+
|
|
3076
|
+
<ul class="member-list">
|
|
3077
|
+
<h4>Type:</h4>
|
|
3078
|
+
<li>
|
|
3079
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3080
|
+
</li>
|
|
3081
|
+
</ul>
|
|
3082
|
+
|
|
3083
|
+
|
|
3084
|
+
<ul class="member-list">
|
|
3085
|
+
<h4>See also:</h4>
|
|
3086
|
+
|
|
3087
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
3088
|
+
|
|
3089
|
+
</ul>
|
|
3090
|
+
|
|
3091
|
+
<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>
|
|
3092
|
+
|
|
3093
|
+
<div class="paperscript split">
|
|
3094
|
+
|
|
3095
|
+
<div class="buttons">
|
|
3096
|
+
<div class="button run">Run</div>
|
|
3097
|
+
</div>
|
|
3098
|
+
|
|
3099
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3100
|
+
// Create a circle shaped path at the center of the view:
|
|
3101
|
+
var path = new Path.Circle({
|
|
3102
|
+
center: view.center,
|
|
3103
|
+
radius: 25,
|
|
3104
|
+
fillColor: 'black'
|
|
3105
|
+
});
|
|
3106
|
+
|
|
3107
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
3108
|
+
path.onMouseLeave = function(event) {
|
|
3109
|
+
this.fillColor = 'red';
|
|
3110
|
+
}
|
|
3111
|
+
</script>
|
|
3112
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3113
|
+
</div>
|
|
3114
|
+
|
|
3115
|
+
|
|
3116
|
+
</div>
|
|
3117
|
+
|
|
3118
|
+
</div>
|
|
3119
|
+
</div>
|
|
3120
|
+
|
|
3121
|
+
|
|
3122
|
+
<div id="ondraw" class="member">
|
|
3123
|
+
<div class="member-link">
|
|
3124
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
3125
|
+
</div>
|
|
3126
|
+
<div class="member-description hidden">
|
|
3127
|
+
|
|
3128
|
+
<div class="member-text">
|
|
3129
|
+
<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>
|
|
3130
|
+
|
|
3131
|
+
|
|
3132
|
+
|
|
3133
|
+
<ul class="member-list">
|
|
3134
|
+
<h4>Type:</h4>
|
|
3135
|
+
<li>
|
|
3136
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3137
|
+
</li>
|
|
3138
|
+
</ul>
|
|
3139
|
+
<ul class="member-list">
|
|
3140
|
+
<h4>Options:</h4>
|
|
3141
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
3142
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
3143
|
+
<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>
|
|
3144
|
+
<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>
|
|
3145
|
+
<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>()
|
|
3146
|
+
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>
|
|
3147
|
+
</ul>
|
|
3148
|
+
|
|
3149
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
3150
|
+
|
|
3151
|
+
<div class="paperscript split">
|
|
3152
|
+
|
|
3153
|
+
<div class="buttons">
|
|
3154
|
+
<div class="button run">Run</div>
|
|
3155
|
+
</div>
|
|
3156
|
+
|
|
3157
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3158
|
+
var path = new Path.Circle({
|
|
3159
|
+
center: view.center,
|
|
3160
|
+
radius: 25,
|
|
3161
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3162
|
+
});
|
|
3163
|
+
|
|
3164
|
+
path.onDraw = function(event) {
|
|
3165
|
+
var ctx = event.context,
|
|
3166
|
+
center = this.position,
|
|
3167
|
+
scale = event.matrix.scaling.x;
|
|
3168
|
+
ctx.beginPath();
|
|
3169
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3170
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3171
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3172
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3173
|
+
ctx.lineWidth = 1 / scale;
|
|
3174
|
+
ctx.stroke();
|
|
3175
|
+
}
|
|
3176
|
+
</script>
|
|
3177
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3178
|
+
</div>
|
|
3179
|
+
|
|
3180
|
+
|
|
3181
|
+
</div>
|
|
3182
|
+
|
|
3183
|
+
</div>
|
|
3184
|
+
</div>
|
|
3185
|
+
|
|
3186
|
+
|
|
3187
|
+
<div id="ondrawselection" class="member">
|
|
3188
|
+
<div class="member-link">
|
|
3189
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3190
|
+
</div>
|
|
3191
|
+
<div class="member-description hidden">
|
|
3192
|
+
|
|
3193
|
+
<div class="member-text">
|
|
3194
|
+
<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>
|
|
3195
|
+
|
|
3196
|
+
|
|
3197
|
+
|
|
3198
|
+
<ul class="member-list">
|
|
3199
|
+
<h4>Type:</h4>
|
|
3200
|
+
<li>
|
|
3201
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3202
|
+
</li>
|
|
3203
|
+
</ul>
|
|
3204
|
+
<ul class="member-list">
|
|
3205
|
+
<h4>Options:</h4>
|
|
3206
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3207
|
+
<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>
|
|
3208
|
+
<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>
|
|
3209
|
+
<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>
|
|
3210
|
+
<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>
|
|
3211
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3212
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3213
|
+
</ul>
|
|
3214
|
+
|
|
3215
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3216
|
+
|
|
3217
|
+
<div class="paperscript split">
|
|
3218
|
+
|
|
3219
|
+
<div class="buttons">
|
|
3220
|
+
<div class="button run">Run</div>
|
|
3221
|
+
</div>
|
|
3222
|
+
|
|
3223
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3224
|
+
var path = new Path.Star({
|
|
3225
|
+
center: view.center,
|
|
3226
|
+
points: 5,
|
|
3227
|
+
radius1: 20,
|
|
3228
|
+
radius2: 40,
|
|
3229
|
+
strokeColor: 'black',
|
|
3230
|
+
selected: true
|
|
3231
|
+
});
|
|
3232
|
+
|
|
3233
|
+
path.onDrawSelection = function(event) {
|
|
3234
|
+
var ctx = event.context;
|
|
3235
|
+
this.segments.forEach(function(segment) {
|
|
3236
|
+
var point = event.matrix.transform(segment.point);
|
|
3237
|
+
ctx.beginPath();
|
|
3238
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3239
|
+
ctx.fill();
|
|
3240
|
+
});
|
|
3241
|
+
return false;
|
|
3242
|
+
}
|
|
3243
|
+
</script>
|
|
3244
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3245
|
+
</div>
|
|
3246
|
+
|
|
3247
|
+
|
|
3248
|
+
</div>
|
|
3249
|
+
|
|
3250
|
+
</div>
|
|
3251
|
+
</div>
|
|
3252
|
+
|
|
3253
|
+
</div>
|
|
3254
|
+
|
|
3255
|
+
|
|
3256
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3257
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3258
|
+
|
|
3259
|
+
|
|
3260
|
+
<div id="addeffect-effect" class="member">
|
|
3261
|
+
<div class="member-link">
|
|
3262
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3263
|
+
</div>
|
|
3264
|
+
<div class="member-description hidden">
|
|
3265
|
+
<div class="member-text">
|
|
3266
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3267
|
+
|
|
3268
|
+
|
|
3269
|
+
<ul class="member-list">
|
|
3270
|
+
<h4>Parameters:</h4>
|
|
3271
|
+
|
|
3272
|
+
<li>
|
|
3273
|
+
<tt>effect:</tt>
|
|
3274
|
+
<tt>Object</tt>
|
|
3275
|
+
— the plain object describing the effect
|
|
3276
|
+
|
|
3277
|
+
</li>
|
|
3278
|
+
|
|
3279
|
+
</ul>
|
|
3280
|
+
|
|
3281
|
+
|
|
3282
|
+
<ul class="member-list">
|
|
3283
|
+
<h4>Returns:</h4>
|
|
3284
|
+
|
|
3285
|
+
<li>
|
|
3286
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3287
|
+
</li>
|
|
3288
|
+
|
|
3289
|
+
|
|
3290
|
+
</ul>
|
|
3291
|
+
|
|
3292
|
+
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
|
|
3296
|
+
</div>
|
|
3297
|
+
</div>
|
|
3298
|
+
</div>
|
|
3299
|
+
|
|
3300
|
+
|
|
3301
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3302
|
+
<div class="member-link">
|
|
3303
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3304
|
+
</div>
|
|
3305
|
+
<div class="member-description hidden">
|
|
3306
|
+
<div class="member-text">
|
|
3307
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3308
|
+
|
|
3309
|
+
|
|
3310
|
+
<ul class="member-list">
|
|
3311
|
+
<h4>Parameters:</h4>
|
|
3312
|
+
|
|
3313
|
+
<li>
|
|
3314
|
+
<tt>index:</tt>
|
|
3315
|
+
<tt>Number</tt>
|
|
3316
|
+
— the index at which to insert the effect
|
|
3317
|
+
|
|
3318
|
+
</li>
|
|
3319
|
+
|
|
3320
|
+
<li>
|
|
3321
|
+
<tt>effect:</tt>
|
|
3322
|
+
<tt>Object</tt>
|
|
3323
|
+
— the plain object describing the effect
|
|
3324
|
+
|
|
3325
|
+
</li>
|
|
3326
|
+
|
|
3327
|
+
</ul>
|
|
3328
|
+
|
|
3329
|
+
|
|
3330
|
+
<ul class="member-list">
|
|
3331
|
+
<h4>Returns:</h4>
|
|
3332
|
+
|
|
3333
|
+
<li>
|
|
3334
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3335
|
+
</li>
|
|
3336
|
+
|
|
3337
|
+
|
|
3338
|
+
</ul>
|
|
3339
|
+
|
|
3340
|
+
|
|
3341
|
+
|
|
3342
|
+
|
|
3343
|
+
|
|
3344
|
+
</div>
|
|
3345
|
+
</div>
|
|
3346
|
+
</div>
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3350
|
+
<div class="member-link">
|
|
3351
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3352
|
+
</div>
|
|
3353
|
+
<div class="member-description hidden">
|
|
3354
|
+
<div class="member-text">
|
|
3355
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3356
|
+
|
|
3357
|
+
|
|
3358
|
+
<ul class="member-list">
|
|
3359
|
+
<h4>Parameters:</h4>
|
|
3360
|
+
|
|
3361
|
+
<li>
|
|
3362
|
+
<tt>index:</tt>
|
|
3363
|
+
<tt>Number</tt>
|
|
3364
|
+
— the index at which to insert the effects
|
|
3365
|
+
|
|
3366
|
+
</li>
|
|
3367
|
+
|
|
3368
|
+
<li>
|
|
3369
|
+
<tt>effects:</tt>
|
|
3370
|
+
Array of <tt>Object</tt> objects
|
|
3371
|
+
— the plain objects describing the effects
|
|
3372
|
+
|
|
3373
|
+
</li>
|
|
3374
|
+
|
|
3375
|
+
</ul>
|
|
3376
|
+
|
|
3377
|
+
|
|
3378
|
+
<ul class="member-list">
|
|
3379
|
+
<h4>Returns:</h4>
|
|
3380
|
+
|
|
3381
|
+
<li>
|
|
3382
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3383
|
+
</li>
|
|
3384
|
+
|
|
3385
|
+
|
|
3386
|
+
</ul>
|
|
2840
3387
|
|
|
2841
3388
|
|
|
2842
|
-
</div>
|
|
2843
3389
|
|
|
3390
|
+
|
|
3391
|
+
|
|
3392
|
+
</div>
|
|
2844
3393
|
</div>
|
|
2845
3394
|
</div>
|
|
2846
3395
|
|
|
2847
3396
|
|
|
2848
|
-
<div id="
|
|
3397
|
+
<div id="removeeffect-index" class="member">
|
|
2849
3398
|
<div class="member-link">
|
|
2850
|
-
<a name="
|
|
3399
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
2851
3400
|
</div>
|
|
2852
3401
|
<div class="member-description hidden">
|
|
2853
|
-
|
|
2854
3402
|
<div class="member-text">
|
|
2855
|
-
<p>
|
|
3403
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3404
|
+
|
|
2856
3405
|
|
|
3406
|
+
<ul class="member-list">
|
|
3407
|
+
<h4>Parameters:</h4>
|
|
2857
3408
|
|
|
3409
|
+
<li>
|
|
3410
|
+
<tt>index:</tt>
|
|
3411
|
+
<tt>Number</tt>
|
|
3412
|
+
— the index of the effect to remove
|
|
3413
|
+
|
|
3414
|
+
</li>
|
|
2858
3415
|
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
<li>
|
|
2862
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2863
|
-
</li>
|
|
2864
|
-
</ul>
|
|
2865
|
-
|
|
3416
|
+
</ul>
|
|
3417
|
+
|
|
2866
3418
|
|
|
2867
3419
|
<ul class="member-list">
|
|
2868
|
-
<h4>
|
|
3420
|
+
<h4>Returns:</h4>
|
|
2869
3421
|
|
|
2870
|
-
<li
|
|
3422
|
+
<li>
|
|
3423
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3424
|
+
</li>
|
|
3425
|
+
|
|
2871
3426
|
|
|
2872
3427
|
</ul>
|
|
2873
3428
|
|
|
2874
|
-
<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>
|
|
2875
3429
|
|
|
2876
|
-
<div class="paperscript split">
|
|
2877
3430
|
|
|
2878
|
-
|
|
2879
|
-
|
|
3431
|
+
|
|
3432
|
+
|
|
2880
3433
|
</div>
|
|
2881
|
-
|
|
2882
|
-
<script type="text/paperscript" canvas="canvas-33">
|
|
2883
|
-
// Create a circle shaped path at the center of the view:
|
|
2884
|
-
var path = new Path.Circle({
|
|
2885
|
-
center: view.center,
|
|
2886
|
-
radius: 25,
|
|
2887
|
-
fillColor: 'black'
|
|
2888
|
-
});
|
|
2889
|
-
|
|
2890
|
-
// When the mouse enters the item, set its fill color to red:
|
|
2891
|
-
path.onMouseEnter = function(event) {
|
|
2892
|
-
this.fillColor = 'red';
|
|
2893
|
-
}
|
|
2894
|
-
|
|
2895
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2896
|
-
path.onMouseLeave = function(event) {
|
|
2897
|
-
this.fillColor = 'black';
|
|
2898
|
-
}
|
|
2899
|
-
</script>
|
|
2900
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2901
3434
|
</div>
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
<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>
|
|
2905
|
-
|
|
2906
|
-
<div class="paperscript split">
|
|
2907
|
-
|
|
2908
|
-
<div class="buttons">
|
|
2909
|
-
<div class="button run">Run</div>
|
|
2910
3435
|
</div>
|
|
2911
3436
|
|
|
2912
|
-
|
|
2913
|
-
|
|
2914
|
-
|
|
2915
|
-
|
|
2916
|
-
|
|
2917
|
-
|
|
2918
|
-
|
|
2919
|
-
|
|
3437
|
+
|
|
3438
|
+
<div id="removeeffects" class="member">
|
|
3439
|
+
<div class="member-link">
|
|
3440
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
3441
|
+
</div>
|
|
3442
|
+
<div class="member-description hidden">
|
|
3443
|
+
<div class="member-text">
|
|
3444
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3445
|
+
|
|
3446
|
+
|
|
3447
|
+
<ul class="member-list">
|
|
3448
|
+
<h4>Parameters:</h4>
|
|
3449
|
+
|
|
3450
|
+
<li>
|
|
3451
|
+
<tt>start:</tt>
|
|
3452
|
+
<tt>Number</tt>
|
|
3453
|
+
— the index of the first effect to remove
|
|
3454
|
+
— optional, default: <tt>0</tt>
|
|
3455
|
+
</li>
|
|
3456
|
+
|
|
3457
|
+
<li>
|
|
3458
|
+
<tt>end:</tt>
|
|
3459
|
+
<tt>Number</tt>
|
|
3460
|
+
— the index after the last one
|
|
3461
|
+
— optional, default: <tt>effects.length</tt>
|
|
3462
|
+
</li>
|
|
3463
|
+
|
|
3464
|
+
</ul>
|
|
2920
3465
|
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
|
|
2924
|
-
|
|
2925
|
-
|
|
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 removed instances
|
|
3472
|
+
</li>
|
|
2926
3473
|
|
|
2927
|
-
|
|
2928
|
-
|
|
3474
|
+
|
|
3475
|
+
</ul>
|
|
2929
3476
|
|
|
2930
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2931
|
-
path.onMouseLeave = leave;
|
|
2932
|
-
}
|
|
2933
|
-
</script>
|
|
2934
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2935
|
-
</div>
|
|
2936
3477
|
|
|
2937
3478
|
|
|
3479
|
+
|
|
3480
|
+
|
|
2938
3481
|
</div>
|
|
2939
|
-
|
|
2940
3482
|
</div>
|
|
2941
3483
|
</div>
|
|
2942
3484
|
|
|
2943
3485
|
|
|
2944
|
-
<div id="
|
|
3486
|
+
<div id="geteffectoutput" class="member">
|
|
2945
3487
|
<div class="member-link">
|
|
2946
|
-
<a name="
|
|
3488
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
2947
3489
|
</div>
|
|
2948
3490
|
<div class="member-description hidden">
|
|
2949
|
-
|
|
2950
3491
|
<div class="member-text">
|
|
2951
|
-
<p>
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
|
|
2955
|
-
<ul class="member-list">
|
|
2956
|
-
<h4>Type:</h4>
|
|
2957
|
-
<li>
|
|
2958
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2959
|
-
</li>
|
|
2960
|
-
</ul>
|
|
3492
|
+
<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>
|
|
2961
3493
|
|
|
2962
3494
|
|
|
3495
|
+
|
|
2963
3496
|
<ul class="member-list">
|
|
2964
|
-
<h4>
|
|
3497
|
+
<h4>Returns:</h4>
|
|
2965
3498
|
|
|
2966
|
-
<li
|
|
3499
|
+
<li>
|
|
3500
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3501
|
+
</li>
|
|
3502
|
+
|
|
2967
3503
|
|
|
2968
3504
|
</ul>
|
|
2969
3505
|
|
|
2970
|
-
<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>
|
|
2971
|
-
|
|
2972
|
-
<div class="paperscript split">
|
|
2973
|
-
|
|
2974
|
-
<div class="buttons">
|
|
2975
|
-
<div class="button run">Run</div>
|
|
2976
|
-
</div>
|
|
2977
|
-
|
|
2978
|
-
<script type="text/paperscript" canvas="canvas-35">
|
|
2979
|
-
// Create a circle shaped path at the center of the view:
|
|
2980
|
-
var path = new Path.Circle({
|
|
2981
|
-
center: view.center,
|
|
2982
|
-
radius: 25,
|
|
2983
|
-
fillColor: 'black'
|
|
2984
|
-
});
|
|
2985
|
-
|
|
2986
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
2987
|
-
path.onMouseLeave = function(event) {
|
|
2988
|
-
this.fillColor = 'red';
|
|
2989
|
-
}
|
|
2990
|
-
</script>
|
|
2991
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
2992
|
-
</div>
|
|
2993
|
-
|
|
2994
3506
|
|
|
2995
|
-
</div>
|
|
2996
3507
|
|
|
3508
|
+
|
|
3509
|
+
|
|
2997
3510
|
</div>
|
|
2998
3511
|
</div>
|
|
2999
|
-
|
|
3000
3512
|
</div>
|
|
3001
3513
|
|
|
3002
|
-
|
|
3003
|
-
<!-- =========================== inherited methods ========================= -->
|
|
3004
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3005
|
-
|
|
3006
3514
|
|
|
3007
3515
|
<div id="set-props" class="member">
|
|
3008
3516
|
<div class="member-link">
|
|
@@ -3047,7 +3555,7 @@ path.onMouseLeave = function(event) {
|
|
|
3047
3555
|
<div class="button run">Run</div>
|
|
3048
3556
|
</div>
|
|
3049
3557
|
|
|
3050
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3558
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3051
3559
|
var circle = new Path.Circle({
|
|
3052
3560
|
center: [80, 50],
|
|
3053
3561
|
radius: 35
|
|
@@ -3060,7 +3568,7 @@ circle.set({
|
|
|
3060
3568
|
selected: true
|
|
3061
3569
|
});
|
|
3062
3570
|
</script>
|
|
3063
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3571
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3064
3572
|
</div>
|
|
3065
3573
|
|
|
3066
3574
|
|
|
@@ -3116,7 +3624,7 @@ circle.set({
|
|
|
3116
3624
|
<div class="button run">Run</div>
|
|
3117
3625
|
</div>
|
|
3118
3626
|
|
|
3119
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3627
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3120
3628
|
var circle = new Path.Circle({
|
|
3121
3629
|
center: [50, 50],
|
|
3122
3630
|
radius: 10,
|
|
@@ -3131,7 +3639,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3131
3639
|
copy.position.x += i * copy.bounds.width;
|
|
3132
3640
|
}
|
|
3133
3641
|
</script>
|
|
3134
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3642
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3135
3643
|
</div>
|
|
3136
3644
|
|
|
3137
3645
|
|
|
@@ -3257,7 +3765,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3257
3765
|
<div class="button run">Run</div>
|
|
3258
3766
|
</div>
|
|
3259
3767
|
|
|
3260
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3768
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3261
3769
|
var circle = new Path.Circle({
|
|
3262
3770
|
center: [50, 50],
|
|
3263
3771
|
radius: 5,
|
|
@@ -3274,7 +3782,7 @@ raster.position.x += 100;
|
|
|
3274
3782
|
circle.scale(5);
|
|
3275
3783
|
raster.scale(5);
|
|
3276
3784
|
</script>
|
|
3277
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3785
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3278
3786
|
</div>
|
|
3279
3787
|
|
|
3280
3788
|
|
|
@@ -3328,7 +3836,7 @@ raster.scale(5);
|
|
|
3328
3836
|
<div class="button run">Run</div>
|
|
3329
3837
|
</div>
|
|
3330
3838
|
|
|
3331
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3839
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
3332
3840
|
var path = new Path.Star({
|
|
3333
3841
|
center: [50, 50],
|
|
3334
3842
|
points: 12,
|
|
@@ -3349,7 +3857,7 @@ function onMouseDown(event) {
|
|
|
3349
3857
|
}
|
|
3350
3858
|
}
|
|
3351
3859
|
</script>
|
|
3352
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3860
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
3353
3861
|
</div>
|
|
3354
3862
|
|
|
3355
3863
|
|
|
@@ -3867,11 +4375,17 @@ function onMouseDown(event) {
|
|
|
3867
4375
|
</div>
|
|
3868
4376
|
<div class="member-description hidden">
|
|
3869
4377
|
<div class="member-text">
|
|
3870
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4378
|
+
<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>
|
|
3871
4379
|
<ul class="member-list">
|
|
3872
4380
|
<h4>Options:</h4>
|
|
3873
|
-
<li
|
|
3874
|
-
|
|
4381
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4382
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4383
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4384
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4385
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4386
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4387
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4388
|
+
`options.bounds` the identity matrix is used.</li>
|
|
3875
4389
|
<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>
|
|
3876
4390
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
3877
4391
|
<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>
|
|
@@ -3879,6 +4393,12 @@ function onMouseDown(event) {
|
|
|
3879
4393
|
<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>
|
|
3880
4394
|
<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>
|
|
3881
4395
|
<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>
|
|
4396
|
+
<li>[options.processNode] {Function} the function to process the
|
|
4397
|
+
SVG node made for each exported item, receiving an object with the
|
|
4398
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
4399
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
4400
|
+
is called before the item's name, style, visibility and data are set
|
|
4401
|
+
on the node, which replace attributes of the same names.</li>
|
|
3882
4402
|
</ul>
|
|
3883
4403
|
|
|
3884
4404
|
<ul class="member-list">
|
|
@@ -3921,6 +4441,7 @@ function onMouseDown(event) {
|
|
|
3921
4441
|
<div class="member-text">
|
|
3922
4442
|
<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>
|
|
3923
4443
|
<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>
|
|
4444
|
+
<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>
|
|
3924
4445
|
<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>
|
|
3925
4446
|
<ul class="member-list">
|
|
3926
4447
|
<h4>Options:</h4>
|
|
@@ -3932,6 +4453,13 @@ function onMouseDown(event) {
|
|
|
3932
4453
|
<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>
|
|
3933
4454
|
<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>
|
|
3934
4455
|
<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>
|
|
4456
|
+
<li>[options.processItem] {Function} the function to process the
|
|
4457
|
+
item made for each imported SVG element, receiving an object with
|
|
4458
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
4459
|
+
doesn't import, or return an item to replace it with. It is called
|
|
4460
|
+
after the element's attributes and data are applied to the item, so
|
|
4461
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
4462
|
+
copy them over from `item` as needed.</li>
|
|
3935
4463
|
</ul>
|
|
3936
4464
|
|
|
3937
4465
|
<ul class="member-list">
|
|
@@ -5211,7 +5739,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5211
5739
|
<div class="button run">Run</div>
|
|
5212
5740
|
</div>
|
|
5213
5741
|
|
|
5214
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5742
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5215
5743
|
// Create a rectangle shaped path with its top left
|
|
5216
5744
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5217
5745
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5220,7 +5748,7 @@ path.fillColor = 'black';
|
|
|
5220
5748
|
// Rotate the path by 30 degrees:
|
|
5221
5749
|
path.rotate(30);
|
|
5222
5750
|
</script>
|
|
5223
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5751
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
5224
5752
|
</div>
|
|
5225
5753
|
|
|
5226
5754
|
|
|
@@ -5232,7 +5760,7 @@ path.rotate(30);
|
|
|
5232
5760
|
<div class="button run">Run</div>
|
|
5233
5761
|
</div>
|
|
5234
5762
|
|
|
5235
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5763
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5236
5764
|
// Create a rectangle shaped path with its top left
|
|
5237
5765
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5238
5766
|
var topLeft = new Point(175, 50);
|
|
@@ -5254,7 +5782,7 @@ function onFrame(event) {
|
|
|
5254
5782
|
path.rotate(3, view.center);
|
|
5255
5783
|
}
|
|
5256
5784
|
</script>
|
|
5257
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5785
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-44"></canvas></div>
|
|
5258
5786
|
</div>
|
|
5259
5787
|
|
|
5260
5788
|
|
|
@@ -5303,7 +5831,7 @@ function onFrame(event) {
|
|
|
5303
5831
|
<div class="button run">Run</div>
|
|
5304
5832
|
</div>
|
|
5305
5833
|
|
|
5306
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5834
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5307
5835
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5308
5836
|
// with a radius of 20:
|
|
5309
5837
|
var circle = new Path.Circle({
|
|
@@ -5315,7 +5843,7 @@ var circle = new Path.Circle({
|
|
|
5315
5843
|
// Scale the path by 150% from its center point
|
|
5316
5844
|
circle.scale(1.5);
|
|
5317
5845
|
</script>
|
|
5318
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5846
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5319
5847
|
</div>
|
|
5320
5848
|
|
|
5321
5849
|
|
|
@@ -5327,7 +5855,7 @@ circle.scale(1.5);
|
|
|
5327
5855
|
<div class="button run">Run</div>
|
|
5328
5856
|
</div>
|
|
5329
5857
|
|
|
5330
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5858
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5331
5859
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5332
5860
|
// with a radius of 20:
|
|
5333
5861
|
var circle = new Path.Circle({
|
|
@@ -5339,7 +5867,7 @@ var circle = new Path.Circle({
|
|
|
5339
5867
|
// Scale the path 150% from its bottom left corner
|
|
5340
5868
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5341
5869
|
</script>
|
|
5342
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5870
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5343
5871
|
</div>
|
|
5344
5872
|
|
|
5345
5873
|
|
|
@@ -5395,7 +5923,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5395
5923
|
<div class="button run">Run</div>
|
|
5396
5924
|
</div>
|
|
5397
5925
|
|
|
5398
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5926
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5399
5927
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5400
5928
|
// with a radius of 20:
|
|
5401
5929
|
var circle = new Path.Circle({
|
|
@@ -5407,7 +5935,7 @@ var circle = new Path.Circle({
|
|
|
5407
5935
|
// Scale the path horizontally by 300%
|
|
5408
5936
|
circle.scale(3, 1);
|
|
5409
5937
|
</script>
|
|
5410
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5938
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5411
5939
|
</div>
|
|
5412
5940
|
|
|
5413
5941
|
|
|
@@ -5845,7 +6373,7 @@ circle.scale(3, 1);
|
|
|
5845
6373
|
<div class="button run">Run</div>
|
|
5846
6374
|
</div>
|
|
5847
6375
|
|
|
5848
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6376
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5849
6377
|
// Create a rectangle shaped path with its top left corner
|
|
5850
6378
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5851
6379
|
var path = new Path.Rectangle({
|
|
@@ -5866,7 +6394,7 @@ var circlePath = new Path.Circle({
|
|
|
5866
6394
|
// the rectangular path:
|
|
5867
6395
|
circlePath.fitBounds(path.bounds);
|
|
5868
6396
|
</script>
|
|
5869
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6397
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
5870
6398
|
</div>
|
|
5871
6399
|
|
|
5872
6400
|
|
|
@@ -5878,7 +6406,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5878
6406
|
<div class="button run">Run</div>
|
|
5879
6407
|
</div>
|
|
5880
6408
|
|
|
5881
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6409
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
5882
6410
|
// Create a rectangle shaped path with its top left corner
|
|
5883
6411
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5884
6412
|
var path = new Path.Rectangle({
|
|
@@ -5899,7 +6427,7 @@ var circlePath = new Path.Circle({
|
|
|
5899
6427
|
// the rectangular path:
|
|
5900
6428
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
5901
6429
|
</script>
|
|
5902
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6430
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
5903
6431
|
</div>
|
|
5904
6432
|
|
|
5905
6433
|
|
|
@@ -5911,7 +6439,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
5911
6439
|
<div class="button run">Run</div>
|
|
5912
6440
|
</div>
|
|
5913
6441
|
|
|
5914
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6442
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
5915
6443
|
var path = new Path.Circle({
|
|
5916
6444
|
center: [80, 50],
|
|
5917
6445
|
radius: 30,
|
|
@@ -5921,7 +6449,7 @@ var path = new Path.Circle({
|
|
|
5921
6449
|
// Fit the path to the bounding rectangle of the view:
|
|
5922
6450
|
path.fitBounds(view.bounds);
|
|
5923
6451
|
</script>
|
|
5924
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6452
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-50"></canvas></div>
|
|
5925
6453
|
</div>
|
|
5926
6454
|
|
|
5927
6455
|
|
|
@@ -5947,7 +6475,7 @@ path.fitBounds(view.bounds);
|
|
|
5947
6475
|
<li>
|
|
5948
6476
|
<tt>type:</tt>
|
|
5949
6477
|
<tt>String</tt>
|
|
5950
|
-
— 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>
|
|
6478
|
+
— 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>
|
|
5951
6479
|
|
|
5952
6480
|
</li>
|
|
5953
6481
|
|
|
@@ -5982,7 +6510,7 @@ path.fitBounds(view.bounds);
|
|
|
5982
6510
|
<div class="button run">Run</div>
|
|
5983
6511
|
</div>
|
|
5984
6512
|
|
|
5985
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6513
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
5986
6514
|
// Create a circle shaped path at the center of the view:
|
|
5987
6515
|
var path = new Path.Circle({
|
|
5988
6516
|
center: view.center,
|
|
@@ -6000,7 +6528,7 @@ path.on('mouseleave', function() {
|
|
|
6000
6528
|
this.fillColor = 'black';
|
|
6001
6529
|
});
|
|
6002
6530
|
</script>
|
|
6003
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6531
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6004
6532
|
</div>
|
|
6005
6533
|
|
|
6006
6534
|
|
|
@@ -6024,7 +6552,7 @@ path.on('mouseleave', function() {
|
|
|
6024
6552
|
<li>
|
|
6025
6553
|
<tt>object:</tt>
|
|
6026
6554
|
<tt>Object</tt>
|
|
6027
|
-
— 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>
|
|
6555
|
+
— 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>
|
|
6028
6556
|
|
|
6029
6557
|
</li>
|
|
6030
6558
|
|
|
@@ -6052,7 +6580,7 @@ path.on('mouseleave', function() {
|
|
|
6052
6580
|
<div class="button run">Run</div>
|
|
6053
6581
|
</div>
|
|
6054
6582
|
|
|
6055
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6583
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6056
6584
|
// Create a circle shaped path at the center of the view:
|
|
6057
6585
|
var path = new Path.Circle({
|
|
6058
6586
|
center: view.center,
|
|
@@ -6070,7 +6598,7 @@ path.on({
|
|
|
6070
6598
|
}
|
|
6071
6599
|
});
|
|
6072
6600
|
</script>
|
|
6073
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6601
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6074
6602
|
</div>
|
|
6075
6603
|
|
|
6076
6604
|
|
|
@@ -6082,7 +6610,7 @@ path.on({
|
|
|
6082
6610
|
<div class="button run">Run</div>
|
|
6083
6611
|
</div>
|
|
6084
6612
|
|
|
6085
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6613
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6086
6614
|
var pathHandlers = {
|
|
6087
6615
|
mouseenter: function(event) {
|
|
6088
6616
|
this.fillColor = 'red';
|
|
@@ -6105,7 +6633,7 @@ function onMouseDown(event) {
|
|
|
6105
6633
|
path.on(pathHandlers);
|
|
6106
6634
|
}
|
|
6107
6635
|
</script>
|
|
6108
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6636
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
|
|
6109
6637
|
</div>
|
|
6110
6638
|
|
|
6111
6639
|
|
|
@@ -6129,7 +6657,7 @@ function onMouseDown(event) {
|
|
|
6129
6657
|
<li>
|
|
6130
6658
|
<tt>type:</tt>
|
|
6131
6659
|
<tt>String</tt>
|
|
6132
|
-
— 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>
|
|
6660
|
+
— 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>
|
|
6133
6661
|
|
|
6134
6662
|
</li>
|
|
6135
6663
|
|
|
@@ -6177,7 +6705,7 @@ function onMouseDown(event) {
|
|
|
6177
6705
|
<li>
|
|
6178
6706
|
<tt>object:</tt>
|
|
6179
6707
|
<tt>Object</tt>
|
|
6180
|
-
— 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>
|
|
6708
|
+
— 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>
|
|
6181
6709
|
|
|
6182
6710
|
</li>
|
|
6183
6711
|
|
|
@@ -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>type:</tt>
|
|
6268
6796
|
<tt>String</tt>
|
|
6269
|
-
— 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>
|
|
6797
|
+
— 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>
|
|
6270
6798
|
|
|
6271
6799
|
</li>
|
|
6272
6800
|
|
|
@@ -6333,7 +6861,7 @@ function onMouseDown(event) {
|
|
|
6333
6861
|
<div class="button run">Run</div>
|
|
6334
6862
|
</div>
|
|
6335
6863
|
|
|
6336
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6864
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6337
6865
|
function onMouseDrag(event) {
|
|
6338
6866
|
// Create a circle shaped path at the mouse position,
|
|
6339
6867
|
// with a radius of 10:
|
|
@@ -6350,7 +6878,7 @@ function onMouseDrag(event) {
|
|
|
6350
6878
|
});
|
|
6351
6879
|
}
|
|
6352
6880
|
</script>
|
|
6353
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6881
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6354
6882
|
</div>
|
|
6355
6883
|
|
|
6356
6884
|
|
|
@@ -6380,7 +6908,7 @@ function onMouseDrag(event) {
|
|
|
6380
6908
|
<div class="button run">Run</div>
|
|
6381
6909
|
</div>
|
|
6382
6910
|
|
|
6383
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6911
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6384
6912
|
function onMouseMove(event) {
|
|
6385
6913
|
// Create a circle shaped path at the mouse position,
|
|
6386
6914
|
// with a radius of 10:
|
|
@@ -6394,7 +6922,7 @@ function onMouseMove(event) {
|
|
|
6394
6922
|
path.removeOnMove();
|
|
6395
6923
|
}
|
|
6396
6924
|
</script>
|
|
6397
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6925
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6398
6926
|
</div>
|
|
6399
6927
|
|
|
6400
6928
|
|
|
@@ -6424,7 +6952,7 @@ function onMouseMove(event) {
|
|
|
6424
6952
|
<div class="button run">Run</div>
|
|
6425
6953
|
</div>
|
|
6426
6954
|
|
|
6427
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6955
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6428
6956
|
function onMouseDown(event) {
|
|
6429
6957
|
// Create a circle shaped path at the mouse position,
|
|
6430
6958
|
// with a radius of 10:
|
|
@@ -6438,7 +6966,7 @@ function onMouseDown(event) {
|
|
|
6438
6966
|
path.removeOnDown();
|
|
6439
6967
|
}
|
|
6440
6968
|
</script>
|
|
6441
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6969
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6442
6970
|
</div>
|
|
6443
6971
|
|
|
6444
6972
|
|
|
@@ -6468,7 +6996,7 @@ function onMouseDown(event) {
|
|
|
6468
6996
|
<div class="button run">Run</div>
|
|
6469
6997
|
</div>
|
|
6470
6998
|
|
|
6471
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6999
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6472
7000
|
function onMouseDrag(event) {
|
|
6473
7001
|
// Create a circle shaped path at the mouse position,
|
|
6474
7002
|
// with a radius of 10:
|
|
@@ -6482,7 +7010,7 @@ function onMouseDrag(event) {
|
|
|
6482
7010
|
path.removeOnDrag();
|
|
6483
7011
|
}
|
|
6484
7012
|
</script>
|
|
6485
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7013
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
|
|
6486
7014
|
</div>
|
|
6487
7015
|
|
|
6488
7016
|
|
|
@@ -6512,7 +7040,7 @@ function onMouseDrag(event) {
|
|
|
6512
7040
|
<div class="button run">Run</div>
|
|
6513
7041
|
</div>
|
|
6514
7042
|
|
|
6515
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7043
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6516
7044
|
function onMouseDown(event) {
|
|
6517
7045
|
// Create a circle shaped path at the mouse position,
|
|
6518
7046
|
// with a radius of 10:
|
|
@@ -6526,7 +7054,7 @@ function onMouseDown(event) {
|
|
|
6526
7054
|
path.removeOnUp();
|
|
6527
7055
|
}
|
|
6528
7056
|
</script>
|
|
6529
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7057
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
|
|
6530
7058
|
</div>
|
|
6531
7059
|
|
|
6532
7060
|
|
|
@@ -6599,7 +7127,7 @@ function onMouseDown(event) {
|
|
|
6599
7127
|
<div class="button run">Run</div>
|
|
6600
7128
|
</div>
|
|
6601
7129
|
|
|
6602
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7130
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6603
7131
|
var path = new Path.Circle({
|
|
6604
7132
|
radius: view.bounds.height * 0.4,
|
|
6605
7133
|
center: view.center
|
|
@@ -6610,7 +7138,7 @@ path.tween(
|
|
|
6610
7138
|
3000
|
|
6611
7139
|
);
|
|
6612
7140
|
</script>
|
|
6613
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7141
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
6614
7142
|
</div>
|
|
6615
7143
|
|
|
6616
7144
|
|
|
@@ -6622,7 +7150,7 @@ path.tween(
|
|
|
6622
7150
|
<div class="button run">Run</div>
|
|
6623
7151
|
</div>
|
|
6624
7152
|
|
|
6625
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7153
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6626
7154
|
var path = new Shape.Rectangle({
|
|
6627
7155
|
fillColor: 'red',
|
|
6628
7156
|
center: [50, view.center.y],
|
|
@@ -6637,7 +7165,7 @@ path.tween({
|
|
|
6637
7165
|
duration: 2000
|
|
6638
7166
|
});
|
|
6639
7167
|
</script>
|
|
6640
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7168
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
|
|
6641
7169
|
</div>
|
|
6642
7170
|
|
|
6643
7171
|
|
|
@@ -6703,7 +7231,7 @@ path.tween({
|
|
|
6703
7231
|
<div class="button run">Run</div>
|
|
6704
7232
|
</div>
|
|
6705
7233
|
|
|
6706
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7234
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6707
7235
|
var path = new Path.Rectangle({
|
|
6708
7236
|
size: [100, 100],
|
|
6709
7237
|
position: view.center,
|
|
@@ -6717,7 +7245,7 @@ path.tween({
|
|
|
6717
7245
|
'segments[2].point.x': '-= 50'
|
|
6718
7246
|
}, 3000);
|
|
6719
7247
|
</script>
|
|
6720
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7248
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
|
|
6721
7249
|
</div>
|
|
6722
7250
|
|
|
6723
7251
|
|
|
@@ -6776,7 +7304,7 @@ path.tween({
|
|
|
6776
7304
|
<div class="button run">Run</div>
|
|
6777
7305
|
</div>
|
|
6778
7306
|
|
|
6779
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7307
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
6780
7308
|
var path = new Path.Circle({
|
|
6781
7309
|
fillColor: 'blue',
|
|
6782
7310
|
radius: view.bounds.height * 0.4,
|
|
@@ -6792,7 +7320,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6792
7320
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6793
7321
|
};
|
|
6794
7322
|
</script>
|
|
6795
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7323
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
6796
7324
|
</div>
|
|
6797
7325
|
|
|
6798
7326
|
|
|
@@ -6913,7 +7441,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6913
7441
|
<div class="button run">Run</div>
|
|
6914
7442
|
</div>
|
|
6915
7443
|
|
|
6916
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7444
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
6917
7445
|
var path = new Path.Circle({
|
|
6918
7446
|
fillColor: 'blue',
|
|
6919
7447
|
radius: view.bounds.height * 0.4,
|
|
@@ -6921,7 +7449,7 @@ var path = new Path.Circle({
|
|
|
6921
7449
|
});
|
|
6922
7450
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
6923
7451
|
</script>
|
|
6924
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7452
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
6925
7453
|
</div>
|
|
6926
7454
|
|
|
6927
7455
|
|
|
@@ -8054,7 +8582,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
|
|
|
8054
8582
|
<div class="member-description hidden">
|
|
8055
8583
|
|
|
8056
8584
|
<div class="member-text">
|
|
8057
|
-
<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>
|
|
8585
|
+
<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>
|
|
8058
8586
|
|
|
8059
8587
|
|
|
8060
8588
|
<ul class="member-list">
|
|
@@ -8430,7 +8958,7 @@ wordsLongerThan, afterFirst, beforeLast, limit, zone, capitalized }</code>. Kept
|
|
|
8430
8958
|
|
|
8431
8959
|
<!-- =========================== copyright notice ========================== -->
|
|
8432
8960
|
<p class="footer">
|
|
8433
|
-
Paper.js v0.
|
|
8961
|
+
Paper.js v0.17.0<br>
|
|
8434
8962
|
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>
|
|
8435
8963
|
<div class="content-end"></div>
|
|
8436
8964
|
|