paper 0.16.0 → 0.17.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +95 -0
- package/dist/docs/assets/js/paper.js +4565 -733
- package/dist/docs/classes/AreaText.html +720 -242
- package/dist/docs/classes/ChangeFlag.html +1 -1
- package/dist/docs/classes/Color.html +218 -21
- package/dist/docs/classes/CompoundPath.html +1146 -296
- package/dist/docs/classes/Curve.html +1 -1
- package/dist/docs/classes/CurveLocation.html +1 -1
- package/dist/docs/classes/DrawEvent.html +69 -0
- package/dist/docs/classes/Effect.html +434 -0
- package/dist/docs/classes/EffectInstance.html +304 -0
- package/dist/docs/classes/Event.html +1 -1
- package/dist/docs/classes/Gradient.html +1 -1
- package/dist/docs/classes/GradientStop.html +1 -1
- package/dist/docs/classes/Group.html +792 -243
- package/dist/docs/classes/HitResult.html +1 -1
- package/dist/docs/classes/HostItem.html +720 -242
- package/dist/docs/classes/Item.html +777 -242
- package/dist/docs/classes/Key.html +1 -1
- package/dist/docs/classes/KeyEvent.html +1 -1
- package/dist/docs/classes/Layer.html +734 -185
- package/dist/docs/classes/Matrix.html +1 -1
- package/dist/docs/classes/MouseEvent.html +1 -1
- package/dist/docs/classes/PaperScope.html +1 -1
- package/dist/docs/classes/PaperScript.html +4 -2
- package/dist/docs/classes/Path.html +1195 -252
- package/dist/docs/classes/PathItem.html +1148 -298
- package/dist/docs/classes/PathText.html +720 -242
- package/dist/docs/classes/PatternDefinition.html +367 -0
- package/dist/docs/classes/Point.html +1 -1
- package/dist/docs/classes/PointText.html +720 -242
- package/dist/docs/classes/Project.html +177 -7
- package/dist/docs/classes/Raster.html +720 -242
- package/dist/docs/classes/Rectangle.html +1 -1
- package/dist/docs/classes/Segment.html +3 -3
- package/dist/docs/classes/Shape.html +720 -242
- package/dist/docs/classes/Size.html +1 -1
- package/dist/docs/classes/StrokeProfileStop.html +346 -0
- package/dist/docs/classes/Style.html +1 -1
- package/dist/docs/classes/SymbolDefinition.html +28 -2
- package/dist/docs/classes/SymbolItem.html +720 -242
- package/dist/docs/classes/TextItem.html +720 -242
- package/dist/docs/classes/TextRange.html +1 -1
- package/dist/docs/classes/TextStory.html +1 -1
- package/dist/docs/classes/Tool.html +2 -2
- package/dist/docs/classes/ToolEvent.html +1 -1
- package/dist/docs/classes/Tween.html +1 -1
- package/dist/docs/classes/View.html +2 -2
- package/dist/docs/classes/global.html +1 -1
- package/dist/docs/classes/index.html +2 -2
- package/dist/docs/index.html +1 -1
- package/dist/node/browser.js +15 -0
- package/dist/paper-core.js +4476 -674
- package/dist/paper-core.min.js +3 -3
- package/dist/paper-full.js +4565 -733
- package/dist/paper-full.min.js +3 -3
- package/dist/paper-hosted.js +5111 -823
- package/dist/paper.d.ts +898 -47
- package/examples/Paperjs.org/LiveEffects.html +366 -0
- package/examples/Paperjs.org/Offsetting.html +379 -0
- package/examples/Paperjs.org/StrokeProfiles.html +706 -0
- package/examples/Scripts/Patterns.html +57 -0
- package/package.json +5 -3
|
@@ -267,7 +267,7 @@ function onFrame(event) {
|
|
|
267
267
|
<div class="member-description hidden">
|
|
268
268
|
|
|
269
269
|
<div class="member-text">
|
|
270
|
-
<p>Specifies whether the group is isolated, drawn through a temporary canvas, so that the blend modes of its children only apply within it, like CSS’s <code>isolation: isolate</code>. Without it, a compositing mode such as <code>'destination-out'</code> affects everything drawn below the group, also in other layers. Groups with an <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> below 1 or a <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a> are isolated anyway
|
|
270
|
+
<p>Specifies whether the group is isolated, drawn through a temporary canvas, so that the blend modes of its children only apply within it, like CSS’s <code>isolation: isolate</code>. Without it, a compositing mode such as <code>'destination-out'</code> affects everything drawn below the group, also in other layers. Groups with an <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> below 1 or a <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a> are isolated anyway, and buffered groups always, see <a href="../classes/Group.html#buffered"><tt>buffered</tt></a>.</p>
|
|
271
271
|
|
|
272
272
|
|
|
273
273
|
|
|
@@ -285,6 +285,77 @@ function onFrame(event) {
|
|
|
285
285
|
|
|
286
286
|
|
|
287
287
|
|
|
288
|
+
</div>
|
|
289
|
+
|
|
290
|
+
</div>
|
|
291
|
+
</div>
|
|
292
|
+
|
|
293
|
+
|
|
294
|
+
<div id="buffered" class="member">
|
|
295
|
+
<div class="member-link">
|
|
296
|
+
<a name="buffered" href="#buffered"><tt><b>buffered</b></tt></a>
|
|
297
|
+
</div>
|
|
298
|
+
<div class="member-description hidden">
|
|
299
|
+
|
|
300
|
+
<div class="member-text">
|
|
301
|
+
<p>Specifies whether the group is buffered: when a view draws it, it draws its content into a canvas of its own, which it keeps, and only draws into it again when something in the group changes, or the part of it that the view shows does, e.g. after zooming or panning. Otherwise, the view only composites the buffer, with the group’s <a href="../classes/Item.html#opacity"><tt>item.opacity</tt></a> and <a href="../classes/Item.html#blendmode"><tt>item.blendMode</tt></a>. This pays off for large groups and layers that rarely change, such as a complex background below animated items.</p>
|
|
302
|
+
<p>It doesn’t pay off when the buffer is drawn again on every frame: while the view pans or zooms on every frame, while the group itself is moved or transformed, or when an item inside it is animated. Put animated items into another group or layer instead.</p>
|
|
303
|
+
<p>The buffer costs memory: it covers the part of the group that the view shows, at up to <code>width × height × 4 × pixelRatio²</code> bytes for a group that fills the whole view.</p>
|
|
304
|
+
<p>Buffered groups are always <a href="../classes/Group.html#isolated"><tt>isolated</tt></a>: the blend modes of their children only apply within them, not to the items below them, also in other layers.</p>
|
|
305
|
+
<p>Hit-testing, SVG export, <a href="../classes/Item.html#rasterize"><tt>item.rasterize</tt></a>() and drawing into other canvases than the view’s don’t use the buffer.</p>
|
|
306
|
+
<p>A buffered group keeps one buffer, so inside a <a href="../classes/SymbolDefinition.html"><tt>SymbolDefinition</tt></a> that is placed several times, it draws into it again for each placement. Changes to any symbol definition make all buffers stale, as do forced updates through <code>view.update(true)</code>.</p>
|
|
307
|
+
|
|
308
|
+
|
|
309
|
+
|
|
310
|
+
<ul class="member-list">
|
|
311
|
+
<h4>Default:</h4>
|
|
312
|
+
<li><tt>false</tt></li>
|
|
313
|
+
</ul>
|
|
314
|
+
|
|
315
|
+
<ul class="member-list">
|
|
316
|
+
<h4>Type:</h4>
|
|
317
|
+
<li>
|
|
318
|
+
<tt>Boolean</tt>
|
|
319
|
+
</li>
|
|
320
|
+
</ul>
|
|
321
|
+
|
|
322
|
+
|
|
323
|
+
<h4>Example:<span class="description">Draw many circles into a buffered layer, which is drawn once, while the circle in the layer above moves on every frame:</span></h4>
|
|
324
|
+
|
|
325
|
+
<div class="paperscript split">
|
|
326
|
+
|
|
327
|
+
<div class="buttons">
|
|
328
|
+
<div class="button run">Run</div>
|
|
329
|
+
</div>
|
|
330
|
+
|
|
331
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
332
|
+
var background = project.activeLayer;
|
|
333
|
+
background.buffered = true;
|
|
334
|
+
for (var i = 0; i < 2000; i++) {
|
|
335
|
+
new Path.Circle({
|
|
336
|
+
center: Point.random() * view.size,
|
|
337
|
+
radius: 5 + Math.random() * 10,
|
|
338
|
+
fillColor: { hue: Math.random() * 360, saturation: 0.5,
|
|
339
|
+
brightness: 1 },
|
|
340
|
+
opacity: 0.5
|
|
341
|
+
});
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
var circle = new Path.Circle({
|
|
345
|
+
center: view.center,
|
|
346
|
+
radius: 20,
|
|
347
|
+
fillColor: 'black'
|
|
348
|
+
});
|
|
349
|
+
new Layer([circle]);
|
|
350
|
+
|
|
351
|
+
function onFrame(event) {
|
|
352
|
+
circle.position.x = view.center.x + Math.sin(event.time) * 100;
|
|
353
|
+
}
|
|
354
|
+
</script>
|
|
355
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-4"></canvas></div>
|
|
356
|
+
</div>
|
|
357
|
+
|
|
358
|
+
|
|
288
359
|
</div>
|
|
289
360
|
|
|
290
361
|
</div>
|
|
@@ -340,6 +411,91 @@ function onFrame(event) {
|
|
|
340
411
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
341
412
|
|
|
342
413
|
|
|
414
|
+
<div id="effects" class="member">
|
|
415
|
+
<div class="member-link">
|
|
416
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
417
|
+
</div>
|
|
418
|
+
<div class="member-description hidden">
|
|
419
|
+
|
|
420
|
+
<div class="member-text">
|
|
421
|
+
<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,
|
|
422
|
+
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>
|
|
423
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
424
|
+
<ul>
|
|
425
|
+
<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>
|
|
426
|
+
<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>
|
|
427
|
+
</ul>
|
|
428
|
+
|
|
429
|
+
|
|
430
|
+
|
|
431
|
+
<ul class="member-list">
|
|
432
|
+
<h4>Type:</h4>
|
|
433
|
+
<li>
|
|
434
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
435
|
+
</li>
|
|
436
|
+
</ul>
|
|
437
|
+
|
|
438
|
+
|
|
439
|
+
<h4>Example:</h4>
|
|
440
|
+
|
|
441
|
+
<div class="paperscript split">
|
|
442
|
+
|
|
443
|
+
<div class="buttons">
|
|
444
|
+
<div class="button run">Run</div>
|
|
445
|
+
</div>
|
|
446
|
+
|
|
447
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
448
|
+
var path = new Path.Star({
|
|
449
|
+
center: view.center,
|
|
450
|
+
points: 5,
|
|
451
|
+
radius1: 20,
|
|
452
|
+
radius2: 40,
|
|
453
|
+
strokeColor: 'black',
|
|
454
|
+
strokeWidth: 8
|
|
455
|
+
});
|
|
456
|
+
path.effects = [
|
|
457
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
458
|
+
{ type: 'outline' }
|
|
459
|
+
];
|
|
460
|
+
</script>
|
|
461
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
462
|
+
</div>
|
|
463
|
+
|
|
464
|
+
|
|
465
|
+
</div>
|
|
466
|
+
|
|
467
|
+
</div>
|
|
468
|
+
</div>
|
|
469
|
+
|
|
470
|
+
|
|
471
|
+
<div id="previewbounds-matrix" class="member">
|
|
472
|
+
<div class="member-link">
|
|
473
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
474
|
+
</div>
|
|
475
|
+
<div class="member-description hidden">
|
|
476
|
+
|
|
477
|
+
<div class="member-text">
|
|
478
|
+
<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>
|
|
479
|
+
|
|
480
|
+
<p>Read only.</p>
|
|
481
|
+
|
|
482
|
+
|
|
483
|
+
|
|
484
|
+
<ul class="member-list">
|
|
485
|
+
<h4>Type:</h4>
|
|
486
|
+
<li>
|
|
487
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
488
|
+
</li>
|
|
489
|
+
</ul>
|
|
490
|
+
|
|
491
|
+
|
|
492
|
+
|
|
493
|
+
</div>
|
|
494
|
+
|
|
495
|
+
</div>
|
|
496
|
+
</div>
|
|
497
|
+
|
|
498
|
+
|
|
343
499
|
<div id="key" class="member">
|
|
344
500
|
<div class="member-link">
|
|
345
501
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -452,7 +608,7 @@ function onFrame(event) {
|
|
|
452
608
|
<div class="button run">Run</div>
|
|
453
609
|
</div>
|
|
454
610
|
|
|
455
|
-
<script type="text/paperscript" canvas="canvas-
|
|
611
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
456
612
|
var path = new Path.Circle({
|
|
457
613
|
center: [80, 50],
|
|
458
614
|
radius: 35
|
|
@@ -467,7 +623,7 @@ group.addChild(path);
|
|
|
467
623
|
// The path can be accessed by name:
|
|
468
624
|
group.children['example'].fillColor = 'red';
|
|
469
625
|
</script>
|
|
470
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
626
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
471
627
|
</div>
|
|
472
628
|
|
|
473
629
|
|
|
@@ -505,7 +661,7 @@ group.children['example'].fillColor = 'red';
|
|
|
505
661
|
<div class="button run">Run</div>
|
|
506
662
|
</div>
|
|
507
663
|
|
|
508
|
-
<script type="text/paperscript" canvas="canvas-
|
|
664
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
509
665
|
var circle = new Path.Circle({
|
|
510
666
|
center: [80, 50],
|
|
511
667
|
radius: 30
|
|
@@ -516,7 +672,7 @@ circle.style = {
|
|
|
516
672
|
strokeWidth: 5
|
|
517
673
|
};
|
|
518
674
|
</script>
|
|
519
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
675
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
520
676
|
</div>
|
|
521
677
|
|
|
522
678
|
|
|
@@ -528,7 +684,7 @@ circle.style = {
|
|
|
528
684
|
<div class="button run">Run</div>
|
|
529
685
|
</div>
|
|
530
686
|
|
|
531
|
-
<script type="text/paperscript" canvas="canvas-
|
|
687
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
532
688
|
var path = new Path.Circle({
|
|
533
689
|
center: [50, 50],
|
|
534
690
|
radius: 30,
|
|
@@ -543,7 +699,7 @@ var path2 = new Path.Circle({
|
|
|
543
699
|
// Copy the path style of path:
|
|
544
700
|
path2.style = path.style;
|
|
545
701
|
</script>
|
|
546
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
702
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
547
703
|
</div>
|
|
548
704
|
|
|
549
705
|
|
|
@@ -555,7 +711,7 @@ path2.style = path.style;
|
|
|
555
711
|
<div class="button run">Run</div>
|
|
556
712
|
</div>
|
|
557
713
|
|
|
558
|
-
<script type="text/paperscript" canvas="canvas-
|
|
714
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
559
715
|
var myStyle = {
|
|
560
716
|
fillColor: 'red',
|
|
561
717
|
strokeColor: 'blue',
|
|
@@ -574,7 +730,7 @@ var path2 = new Path.Circle({
|
|
|
574
730
|
});
|
|
575
731
|
path2.style = myStyle;
|
|
576
732
|
</script>
|
|
577
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
733
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
578
734
|
</div>
|
|
579
735
|
|
|
580
736
|
|
|
@@ -616,7 +772,7 @@ path2.style = myStyle;
|
|
|
616
772
|
<div class="button run">Run</div>
|
|
617
773
|
</div>
|
|
618
774
|
|
|
619
|
-
<script type="text/paperscript" canvas="canvas-
|
|
775
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
620
776
|
var unlockedItem = new Path.Circle({
|
|
621
777
|
center: view.center - [35, 0],
|
|
622
778
|
radius: 30,
|
|
@@ -643,7 +799,7 @@ new PointText({
|
|
|
643
799
|
justification: 'center'
|
|
644
800
|
});
|
|
645
801
|
</script>
|
|
646
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
802
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
647
803
|
</div>
|
|
648
804
|
|
|
649
805
|
|
|
@@ -685,7 +841,7 @@ new PointText({
|
|
|
685
841
|
<div class="button run">Run</div>
|
|
686
842
|
</div>
|
|
687
843
|
|
|
688
|
-
<script type="text/paperscript" canvas="canvas-
|
|
844
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
689
845
|
var path = new Path.Circle({
|
|
690
846
|
center: [50, 50],
|
|
691
847
|
radius: 20,
|
|
@@ -695,7 +851,7 @@ var path = new Path.Circle({
|
|
|
695
851
|
// Hide the path:
|
|
696
852
|
path.visible = false;
|
|
697
853
|
</script>
|
|
698
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
854
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
699
855
|
</div>
|
|
700
856
|
|
|
701
857
|
|
|
@@ -743,7 +899,7 @@ path.visible = false;
|
|
|
743
899
|
<div class="button run">Run</div>
|
|
744
900
|
</div>
|
|
745
901
|
|
|
746
|
-
<script type="text/paperscript" canvas="canvas-
|
|
902
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
747
903
|
// Create a white rectangle in the background
|
|
748
904
|
// with the same dimensions as the view:
|
|
749
905
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -764,7 +920,7 @@ var circle2 = new Path.Circle({
|
|
|
764
920
|
// Set the blend mode of circle2:
|
|
765
921
|
circle2.blendMode = 'multiply';
|
|
766
922
|
</script>
|
|
767
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
923
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
768
924
|
</div>
|
|
769
925
|
|
|
770
926
|
|
|
@@ -806,7 +962,7 @@ circle2.blendMode = 'multiply';
|
|
|
806
962
|
<div class="button run">Run</div>
|
|
807
963
|
</div>
|
|
808
964
|
|
|
809
|
-
<script type="text/paperscript" canvas="canvas-
|
|
965
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
810
966
|
var circle = new Path.Circle({
|
|
811
967
|
center: [80, 50],
|
|
812
968
|
radius: 35,
|
|
@@ -824,7 +980,7 @@ var circle2 = new Path.Circle({
|
|
|
824
980
|
// Make circle2 50% transparent:
|
|
825
981
|
circle2.opacity = 0.5;
|
|
826
982
|
</script>
|
|
827
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
983
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
828
984
|
</div>
|
|
829
985
|
|
|
830
986
|
|
|
@@ -947,14 +1103,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
947
1103
|
<div class="button run">Run</div>
|
|
948
1104
|
</div>
|
|
949
1105
|
|
|
950
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1106
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
951
1107
|
var path = new Path.Circle({
|
|
952
1108
|
center: [80, 50],
|
|
953
1109
|
radius: 35
|
|
954
1110
|
});
|
|
955
1111
|
path.selected = true; // Select the path
|
|
956
1112
|
</script>
|
|
957
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1113
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
958
1114
|
</div>
|
|
959
1115
|
|
|
960
1116
|
|
|
@@ -1111,7 +1267,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
1111
1267
|
<div class="button run">Run</div>
|
|
1112
1268
|
</div>
|
|
1113
1269
|
|
|
1114
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1270
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1115
1271
|
// Create a circle at position { x: 10, y: 10 }
|
|
1116
1272
|
var circle = new Path.Circle({
|
|
1117
1273
|
center: new Point(10, 10),
|
|
@@ -1125,7 +1281,7 @@ circle.position = new Point(20, 20);
|
|
|
1125
1281
|
// Move the circle 100 points to the right and 50 points down
|
|
1126
1282
|
circle.position += new Point(100, 50);
|
|
1127
1283
|
</script>
|
|
1128
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1284
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1129
1285
|
</div>
|
|
1130
1286
|
|
|
1131
1287
|
|
|
@@ -1137,7 +1293,7 @@ circle.position += new Point(100, 50);
|
|
|
1137
1293
|
<div class="button run">Run</div>
|
|
1138
1294
|
</div>
|
|
1139
1295
|
|
|
1140
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1296
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1141
1297
|
// Create a circle at position { x: 20, y: 20 }
|
|
1142
1298
|
var circle = new Path.Circle({
|
|
1143
1299
|
center: new Point(20, 20),
|
|
@@ -1148,7 +1304,7 @@ var circle = new Path.Circle({
|
|
|
1148
1304
|
// Move the circle 100 points to the right
|
|
1149
1305
|
circle.position.x += 100;
|
|
1150
1306
|
</script>
|
|
1151
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1307
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1152
1308
|
</div>
|
|
1153
1309
|
|
|
1154
1310
|
|
|
@@ -1674,7 +1830,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1674
1830
|
<div class="button run">Run</div>
|
|
1675
1831
|
</div>
|
|
1676
1832
|
|
|
1677
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1833
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1678
1834
|
var path = new Path.Circle({
|
|
1679
1835
|
center: [80, 50],
|
|
1680
1836
|
radius: 35
|
|
@@ -1687,7 +1843,7 @@ group.addChild(path);
|
|
|
1687
1843
|
// Access the path through the group's children array:
|
|
1688
1844
|
group.children[0].fillColor = 'red';
|
|
1689
1845
|
</script>
|
|
1690
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1846
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
1691
1847
|
</div>
|
|
1692
1848
|
|
|
1693
1849
|
|
|
@@ -1699,7 +1855,7 @@ group.children[0].fillColor = 'red';
|
|
|
1699
1855
|
<div class="button run">Run</div>
|
|
1700
1856
|
</div>
|
|
1701
1857
|
|
|
1702
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1858
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1703
1859
|
var path = new Path.Circle({
|
|
1704
1860
|
center: [80, 50],
|
|
1705
1861
|
radius: 35
|
|
@@ -1714,7 +1870,7 @@ group.addChild(path);
|
|
|
1714
1870
|
// The path can be accessed by name:
|
|
1715
1871
|
group.children['example'].fillColor = 'orange';
|
|
1716
1872
|
</script>
|
|
1717
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1873
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
|
|
1718
1874
|
</div>
|
|
1719
1875
|
|
|
1720
1876
|
|
|
@@ -1726,7 +1882,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1726
1882
|
<div class="button run">Run</div>
|
|
1727
1883
|
</div>
|
|
1728
1884
|
|
|
1729
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1885
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1730
1886
|
var path = new Path.Circle({
|
|
1731
1887
|
center: [80, 50],
|
|
1732
1888
|
radius: 35
|
|
@@ -1738,7 +1894,7 @@ group.children = [path];
|
|
|
1738
1894
|
// The path is the first child of the group:
|
|
1739
1895
|
group.firstChild.fillColor = 'green';
|
|
1740
1896
|
</script>
|
|
1741
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1897
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
|
|
1742
1898
|
</div>
|
|
1743
1899
|
|
|
1744
1900
|
|
|
@@ -1915,7 +2071,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1915
2071
|
<div class="button run">Run</div>
|
|
1916
2072
|
</div>
|
|
1917
2073
|
|
|
1918
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2074
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
1919
2075
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1920
2076
|
// with a radius of 35:
|
|
1921
2077
|
var circle = new Path.Circle({
|
|
@@ -1926,7 +2082,7 @@ var circle = new Path.Circle({
|
|
|
1926
2082
|
// Set its stroke color to RGB red:
|
|
1927
2083
|
circle.strokeColor = new Color(1, 0, 0);
|
|
1928
2084
|
</script>
|
|
1929
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2085
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
1930
2086
|
</div>
|
|
1931
2087
|
|
|
1932
2088
|
|
|
@@ -1963,7 +2119,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
1963
2119
|
<div class="button run">Run</div>
|
|
1964
2120
|
</div>
|
|
1965
2121
|
|
|
1966
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2122
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
1967
2123
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1968
2124
|
// with a radius of 35:
|
|
1969
2125
|
var circle = new Path.Circle({
|
|
@@ -1975,7 +2131,7 @@ var circle = new Path.Circle({
|
|
|
1975
2131
|
// Set its stroke width to 10:
|
|
1976
2132
|
circle.strokeWidth = 10;
|
|
1977
2133
|
</script>
|
|
1978
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2134
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
1979
2135
|
</div>
|
|
1980
2136
|
|
|
1981
2137
|
|
|
@@ -2022,7 +2178,7 @@ circle.strokeWidth = 10;
|
|
|
2022
2178
|
<div class="button run">Run</div>
|
|
2023
2179
|
</div>
|
|
2024
2180
|
|
|
2025
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2181
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2026
2182
|
var line = new Path({
|
|
2027
2183
|
segments: [[80, 50], [420, 50]],
|
|
2028
2184
|
strokeColor: 'black',
|
|
@@ -2043,7 +2199,7 @@ var line2 = line.clone();
|
|
|
2043
2199
|
line2.position.y += 100;
|
|
2044
2200
|
line2.strokeCap = 'butt';
|
|
2045
2201
|
</script>
|
|
2046
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
2202
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-22"></canvas></div>
|
|
2047
2203
|
</div>
|
|
2048
2204
|
|
|
2049
2205
|
|
|
@@ -2090,7 +2246,7 @@ line2.strokeCap = 'butt';
|
|
|
2090
2246
|
<div class="button run">Run</div>
|
|
2091
2247
|
</div>
|
|
2092
2248
|
|
|
2093
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2249
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2094
2250
|
var path = new Path({
|
|
2095
2251
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
2096
2252
|
strokeColor: 'black',
|
|
@@ -2107,7 +2263,7 @@ var path3 = path2.clone();
|
|
|
2107
2263
|
path3.position.x += path3.bounds.width * 1.5;
|
|
2108
2264
|
path3.strokeJoin = 'bevel';
|
|
2109
2265
|
</script>
|
|
2110
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
2266
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-23"></canvas></div>
|
|
2111
2267
|
</div>
|
|
2112
2268
|
|
|
2113
2269
|
|
|
@@ -2211,7 +2367,7 @@ path3.strokeJoin = 'bevel';
|
|
|
2211
2367
|
<div class="button run">Run</div>
|
|
2212
2368
|
</div>
|
|
2213
2369
|
|
|
2214
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2370
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2215
2371
|
var path = new Path.Circle({
|
|
2216
2372
|
center: [80, 50],
|
|
2217
2373
|
radius: 40,
|
|
@@ -2222,7 +2378,7 @@ var path = new Path.Circle({
|
|
|
2222
2378
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
2223
2379
|
path.dashArray = [10, 4];
|
|
2224
2380
|
</script>
|
|
2225
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2381
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2226
2382
|
</div>
|
|
2227
2383
|
|
|
2228
2384
|
|
|
@@ -2328,7 +2484,7 @@ path.dashArray = [10, 4];
|
|
|
2328
2484
|
<div class="button run">Run</div>
|
|
2329
2485
|
</div>
|
|
2330
2486
|
|
|
2331
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2487
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2332
2488
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2333
2489
|
// with a radius of 35:
|
|
2334
2490
|
var circle = new Path.Circle({
|
|
@@ -2339,7 +2495,7 @@ var circle = new Path.Circle({
|
|
|
2339
2495
|
// Set the fill color of the circle to RGB red:
|
|
2340
2496
|
circle.fillColor = new Color(1, 0, 0);
|
|
2341
2497
|
</script>
|
|
2342
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2498
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2343
2499
|
</div>
|
|
2344
2500
|
|
|
2345
2501
|
|
|
@@ -2414,7 +2570,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2414
2570
|
<div class="button run">Run</div>
|
|
2415
2571
|
</div>
|
|
2416
2572
|
|
|
2417
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2573
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2418
2574
|
var circle = new Path.Circle({
|
|
2419
2575
|
center: [80, 50],
|
|
2420
2576
|
radius: 35,
|
|
@@ -2427,7 +2583,7 @@ var circle = new Path.Circle({
|
|
|
2427
2583
|
shadowOffset: new Point(5, 5)
|
|
2428
2584
|
});
|
|
2429
2585
|
</script>
|
|
2430
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2586
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
2431
2587
|
</div>
|
|
2432
2588
|
|
|
2433
2589
|
|
|
@@ -2568,7 +2724,7 @@ var circle = new Path.Circle({
|
|
|
2568
2724
|
<div class="button run">Run</div>
|
|
2569
2725
|
</div>
|
|
2570
2726
|
|
|
2571
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2727
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2572
2728
|
// Create a rectangle shaped path with its top left point at:
|
|
2573
2729
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2574
2730
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2579,7 +2735,7 @@ path.onFrame = function(event) {
|
|
|
2579
2735
|
this.rotate(3);
|
|
2580
2736
|
}
|
|
2581
2737
|
</script>
|
|
2582
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2738
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2583
2739
|
</div>
|
|
2584
2740
|
|
|
2585
2741
|
|
|
@@ -2623,7 +2779,7 @@ path.onFrame = function(event) {
|
|
|
2623
2779
|
<div class="button run">Run</div>
|
|
2624
2780
|
</div>
|
|
2625
2781
|
|
|
2626
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2782
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2627
2783
|
// Create a circle shaped path at the center of the view:
|
|
2628
2784
|
var path = new Path.Circle({
|
|
2629
2785
|
center: view.center,
|
|
@@ -2637,7 +2793,7 @@ path.onMouseDown = function(event) {
|
|
|
2637
2793
|
this.fillColor = 'red';
|
|
2638
2794
|
}
|
|
2639
2795
|
</script>
|
|
2640
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2796
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2641
2797
|
</div>
|
|
2642
2798
|
|
|
2643
2799
|
|
|
@@ -2649,7 +2805,7 @@ path.onMouseDown = function(event) {
|
|
|
2649
2805
|
<div class="button run">Run</div>
|
|
2650
2806
|
</div>
|
|
2651
2807
|
|
|
2652
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2808
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2653
2809
|
// Loop 30 times:
|
|
2654
2810
|
for (var i = 0; i < 30; i++) {
|
|
2655
2811
|
// Create a circle shaped path at a random position
|
|
@@ -2667,7 +2823,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2667
2823
|
}
|
|
2668
2824
|
}
|
|
2669
2825
|
</script>
|
|
2670
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2826
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2671
2827
|
</div>
|
|
2672
2828
|
|
|
2673
2829
|
|
|
@@ -2711,7 +2867,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2711
2867
|
<div class="button run">Run</div>
|
|
2712
2868
|
</div>
|
|
2713
2869
|
|
|
2714
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2870
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2715
2871
|
// Create a circle shaped path at the center of the view:
|
|
2716
2872
|
var path = new Path.Circle({
|
|
2717
2873
|
center: view.center,
|
|
@@ -2724,7 +2880,7 @@ path.onMouseDrag = function(event) {
|
|
|
2724
2880
|
path.position += event.delta;
|
|
2725
2881
|
}
|
|
2726
2882
|
</script>
|
|
2727
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2883
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-30"></canvas></div>
|
|
2728
2884
|
</div>
|
|
2729
2885
|
|
|
2730
2886
|
|
|
@@ -2768,7 +2924,7 @@ path.onMouseDrag = function(event) {
|
|
|
2768
2924
|
<div class="button run">Run</div>
|
|
2769
2925
|
</div>
|
|
2770
2926
|
|
|
2771
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2927
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2772
2928
|
// Create a circle shaped path at the center of the view:
|
|
2773
2929
|
var path = new Path.Circle({
|
|
2774
2930
|
center: view.center,
|
|
@@ -2782,7 +2938,7 @@ path.onMouseUp = function(event) {
|
|
|
2782
2938
|
this.fillColor = 'red';
|
|
2783
2939
|
}
|
|
2784
2940
|
</script>
|
|
2785
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2941
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2786
2942
|
</div>
|
|
2787
2943
|
|
|
2788
2944
|
|
|
@@ -2826,7 +2982,7 @@ path.onMouseUp = function(event) {
|
|
|
2826
2982
|
<div class="button run">Run</div>
|
|
2827
2983
|
</div>
|
|
2828
2984
|
|
|
2829
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2985
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2830
2986
|
// Create a circle shaped path at the center of the view:
|
|
2831
2987
|
var path = new Path.Circle({
|
|
2832
2988
|
center: view.center,
|
|
@@ -2840,7 +2996,7 @@ path.onClick = function(event) {
|
|
|
2840
2996
|
this.fillColor = 'red';
|
|
2841
2997
|
}
|
|
2842
2998
|
</script>
|
|
2843
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2999
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2844
3000
|
</div>
|
|
2845
3001
|
|
|
2846
3002
|
|
|
@@ -2852,7 +3008,7 @@ path.onClick = function(event) {
|
|
|
2852
3008
|
<div class="button run">Run</div>
|
|
2853
3009
|
</div>
|
|
2854
3010
|
|
|
2855
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3011
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
2856
3012
|
// Loop 30 times:
|
|
2857
3013
|
for (var i = 0; i < 30; i++) {
|
|
2858
3014
|
// Create a circle shaped path at a random position
|
|
@@ -2870,7 +3026,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2870
3026
|
}
|
|
2871
3027
|
}
|
|
2872
3028
|
</script>
|
|
2873
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3029
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2874
3030
|
</div>
|
|
2875
3031
|
|
|
2876
3032
|
|
|
@@ -2914,7 +3070,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2914
3070
|
<div class="button run">Run</div>
|
|
2915
3071
|
</div>
|
|
2916
3072
|
|
|
2917
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3073
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
2918
3074
|
// Create a circle shaped path at the center of the view:
|
|
2919
3075
|
var path = new Path.Circle({
|
|
2920
3076
|
center: view.center,
|
|
@@ -2928,7 +3084,7 @@ path.onDoubleClick = function(event) {
|
|
|
2928
3084
|
this.fillColor = 'red';
|
|
2929
3085
|
}
|
|
2930
3086
|
</script>
|
|
2931
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3087
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2932
3088
|
</div>
|
|
2933
3089
|
|
|
2934
3090
|
|
|
@@ -2940,7 +3096,7 @@ path.onDoubleClick = function(event) {
|
|
|
2940
3096
|
<div class="button run">Run</div>
|
|
2941
3097
|
</div>
|
|
2942
3098
|
|
|
2943
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3099
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
2944
3100
|
// Loop 30 times:
|
|
2945
3101
|
for (var i = 0; i < 30; i++) {
|
|
2946
3102
|
// Create a circle shaped path at a random position
|
|
@@ -2958,7 +3114,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2958
3114
|
}
|
|
2959
3115
|
}
|
|
2960
3116
|
</script>
|
|
2961
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3117
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
2962
3118
|
</div>
|
|
2963
3119
|
|
|
2964
3120
|
|
|
@@ -3002,7 +3158,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3002
3158
|
<div class="button run">Run</div>
|
|
3003
3159
|
</div>
|
|
3004
3160
|
|
|
3005
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3161
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3006
3162
|
// Create a circle shaped path at the center of the view:
|
|
3007
3163
|
var path = new Path.Circle({
|
|
3008
3164
|
center: view.center,
|
|
@@ -3010,180 +3166,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
3010
3166
|
fillColor: 'black'
|
|
3011
3167
|
});
|
|
3012
3168
|
|
|
3013
|
-
// When the mouse moves on top of the item, set its opacity
|
|
3014
|
-
// to a random value between 0 and 1:
|
|
3015
|
-
path.onMouseMove = function(event) {
|
|
3016
|
-
this.opacity = Math.random();
|
|
3017
|
-
}
|
|
3018
|
-
</script>
|
|
3019
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3020
|
-
</div>
|
|
3169
|
+
// When the mouse moves on top of the item, set its opacity
|
|
3170
|
+
// to a random value between 0 and 1:
|
|
3171
|
+
path.onMouseMove = function(event) {
|
|
3172
|
+
this.opacity = Math.random();
|
|
3173
|
+
}
|
|
3174
|
+
</script>
|
|
3175
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3176
|
+
</div>
|
|
3177
|
+
|
|
3178
|
+
|
|
3179
|
+
</div>
|
|
3180
|
+
|
|
3181
|
+
</div>
|
|
3182
|
+
</div>
|
|
3183
|
+
|
|
3184
|
+
|
|
3185
|
+
<div id="onmouseenter" class="member">
|
|
3186
|
+
<div class="member-link">
|
|
3187
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
3188
|
+
</div>
|
|
3189
|
+
<div class="member-description hidden">
|
|
3190
|
+
|
|
3191
|
+
<div class="member-text">
|
|
3192
|
+
<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>
|
|
3193
|
+
|
|
3194
|
+
|
|
3195
|
+
|
|
3196
|
+
<ul class="member-list">
|
|
3197
|
+
<h4>Type:</h4>
|
|
3198
|
+
<li>
|
|
3199
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3200
|
+
</li>
|
|
3201
|
+
</ul>
|
|
3202
|
+
|
|
3203
|
+
|
|
3204
|
+
<ul class="member-list">
|
|
3205
|
+
<h4>See also:</h4>
|
|
3206
|
+
|
|
3207
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
3208
|
+
|
|
3209
|
+
</ul>
|
|
3210
|
+
|
|
3211
|
+
<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>
|
|
3212
|
+
|
|
3213
|
+
<div class="paperscript split">
|
|
3214
|
+
|
|
3215
|
+
<div class="buttons">
|
|
3216
|
+
<div class="button run">Run</div>
|
|
3217
|
+
</div>
|
|
3218
|
+
|
|
3219
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3220
|
+
// Create a circle shaped path at the center of the view:
|
|
3221
|
+
var path = new Path.Circle({
|
|
3222
|
+
center: view.center,
|
|
3223
|
+
radius: 25,
|
|
3224
|
+
fillColor: 'black'
|
|
3225
|
+
});
|
|
3226
|
+
|
|
3227
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3228
|
+
path.onMouseEnter = function(event) {
|
|
3229
|
+
this.fillColor = 'red';
|
|
3230
|
+
}
|
|
3231
|
+
|
|
3232
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3233
|
+
path.onMouseLeave = function(event) {
|
|
3234
|
+
this.fillColor = 'black';
|
|
3235
|
+
}
|
|
3236
|
+
</script>
|
|
3237
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3238
|
+
</div>
|
|
3239
|
+
|
|
3240
|
+
|
|
3241
|
+
<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>
|
|
3242
|
+
|
|
3243
|
+
<div class="paperscript split">
|
|
3244
|
+
|
|
3245
|
+
<div class="buttons">
|
|
3246
|
+
<div class="button run">Run</div>
|
|
3247
|
+
</div>
|
|
3248
|
+
|
|
3249
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3250
|
+
function enter(event) {
|
|
3251
|
+
this.fillColor = 'red';
|
|
3252
|
+
}
|
|
3253
|
+
|
|
3254
|
+
function leave(event) {
|
|
3255
|
+
this.fillColor = 'black';
|
|
3256
|
+
}
|
|
3257
|
+
|
|
3258
|
+
// When the mouse is pressed:
|
|
3259
|
+
function onMouseDown(event) {
|
|
3260
|
+
// Create a circle shaped path at the position of the mouse:
|
|
3261
|
+
var path = new Path.Circle(event.point, 25);
|
|
3262
|
+
path.fillColor = 'black';
|
|
3263
|
+
|
|
3264
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3265
|
+
path.onMouseEnter = enter;
|
|
3266
|
+
|
|
3267
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3268
|
+
path.onMouseLeave = leave;
|
|
3269
|
+
}
|
|
3270
|
+
</script>
|
|
3271
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3272
|
+
</div>
|
|
3273
|
+
|
|
3274
|
+
|
|
3275
|
+
</div>
|
|
3276
|
+
|
|
3277
|
+
</div>
|
|
3278
|
+
</div>
|
|
3279
|
+
|
|
3280
|
+
|
|
3281
|
+
<div id="onmouseleave" class="member">
|
|
3282
|
+
<div class="member-link">
|
|
3283
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
3284
|
+
</div>
|
|
3285
|
+
<div class="member-description hidden">
|
|
3286
|
+
|
|
3287
|
+
<div class="member-text">
|
|
3288
|
+
<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>
|
|
3289
|
+
|
|
3290
|
+
|
|
3291
|
+
|
|
3292
|
+
<ul class="member-list">
|
|
3293
|
+
<h4>Type:</h4>
|
|
3294
|
+
<li>
|
|
3295
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3296
|
+
</li>
|
|
3297
|
+
</ul>
|
|
3298
|
+
|
|
3299
|
+
|
|
3300
|
+
<ul class="member-list">
|
|
3301
|
+
<h4>See also:</h4>
|
|
3302
|
+
|
|
3303
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
3304
|
+
|
|
3305
|
+
</ul>
|
|
3306
|
+
|
|
3307
|
+
<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>
|
|
3308
|
+
|
|
3309
|
+
<div class="paperscript split">
|
|
3310
|
+
|
|
3311
|
+
<div class="buttons">
|
|
3312
|
+
<div class="button run">Run</div>
|
|
3313
|
+
</div>
|
|
3314
|
+
|
|
3315
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3316
|
+
// Create a circle shaped path at the center of the view:
|
|
3317
|
+
var path = new Path.Circle({
|
|
3318
|
+
center: view.center,
|
|
3319
|
+
radius: 25,
|
|
3320
|
+
fillColor: 'black'
|
|
3321
|
+
});
|
|
3322
|
+
|
|
3323
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
3324
|
+
path.onMouseLeave = function(event) {
|
|
3325
|
+
this.fillColor = 'red';
|
|
3326
|
+
}
|
|
3327
|
+
</script>
|
|
3328
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3329
|
+
</div>
|
|
3330
|
+
|
|
3331
|
+
|
|
3332
|
+
</div>
|
|
3333
|
+
|
|
3334
|
+
</div>
|
|
3335
|
+
</div>
|
|
3336
|
+
|
|
3337
|
+
|
|
3338
|
+
<div id="ondraw" class="member">
|
|
3339
|
+
<div class="member-link">
|
|
3340
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
3341
|
+
</div>
|
|
3342
|
+
<div class="member-description hidden">
|
|
3343
|
+
|
|
3344
|
+
<div class="member-text">
|
|
3345
|
+
<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>
|
|
3346
|
+
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
<ul class="member-list">
|
|
3350
|
+
<h4>Type:</h4>
|
|
3351
|
+
<li>
|
|
3352
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3353
|
+
</li>
|
|
3354
|
+
</ul>
|
|
3355
|
+
<ul class="member-list">
|
|
3356
|
+
<h4>Options:</h4>
|
|
3357
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
3358
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
3359
|
+
<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>
|
|
3360
|
+
<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>
|
|
3361
|
+
<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>()
|
|
3362
|
+
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>
|
|
3363
|
+
</ul>
|
|
3364
|
+
|
|
3365
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
3366
|
+
|
|
3367
|
+
<div class="paperscript split">
|
|
3368
|
+
|
|
3369
|
+
<div class="buttons">
|
|
3370
|
+
<div class="button run">Run</div>
|
|
3371
|
+
</div>
|
|
3372
|
+
|
|
3373
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3374
|
+
var path = new Path.Circle({
|
|
3375
|
+
center: view.center,
|
|
3376
|
+
radius: 25,
|
|
3377
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3378
|
+
});
|
|
3379
|
+
|
|
3380
|
+
path.onDraw = function(event) {
|
|
3381
|
+
var ctx = event.context,
|
|
3382
|
+
center = this.position,
|
|
3383
|
+
scale = event.matrix.scaling.x;
|
|
3384
|
+
ctx.beginPath();
|
|
3385
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3386
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3387
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3388
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3389
|
+
ctx.lineWidth = 1 / scale;
|
|
3390
|
+
ctx.stroke();
|
|
3391
|
+
}
|
|
3392
|
+
</script>
|
|
3393
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3394
|
+
</div>
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
</div>
|
|
3398
|
+
|
|
3399
|
+
</div>
|
|
3400
|
+
</div>
|
|
3401
|
+
|
|
3402
|
+
|
|
3403
|
+
<div id="ondrawselection" class="member">
|
|
3404
|
+
<div class="member-link">
|
|
3405
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3406
|
+
</div>
|
|
3407
|
+
<div class="member-description hidden">
|
|
3408
|
+
|
|
3409
|
+
<div class="member-text">
|
|
3410
|
+
<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>
|
|
3411
|
+
|
|
3412
|
+
|
|
3413
|
+
|
|
3414
|
+
<ul class="member-list">
|
|
3415
|
+
<h4>Type:</h4>
|
|
3416
|
+
<li>
|
|
3417
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3418
|
+
</li>
|
|
3419
|
+
</ul>
|
|
3420
|
+
<ul class="member-list">
|
|
3421
|
+
<h4>Options:</h4>
|
|
3422
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3423
|
+
<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>
|
|
3424
|
+
<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>
|
|
3425
|
+
<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>
|
|
3426
|
+
<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>
|
|
3427
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3428
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3429
|
+
</ul>
|
|
3430
|
+
|
|
3431
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3432
|
+
|
|
3433
|
+
<div class="paperscript split">
|
|
3434
|
+
|
|
3435
|
+
<div class="buttons">
|
|
3436
|
+
<div class="button run">Run</div>
|
|
3437
|
+
</div>
|
|
3438
|
+
|
|
3439
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3440
|
+
var path = new Path.Star({
|
|
3441
|
+
center: view.center,
|
|
3442
|
+
points: 5,
|
|
3443
|
+
radius1: 20,
|
|
3444
|
+
radius2: 40,
|
|
3445
|
+
strokeColor: 'black',
|
|
3446
|
+
selected: true
|
|
3447
|
+
});
|
|
3448
|
+
|
|
3449
|
+
path.onDrawSelection = function(event) {
|
|
3450
|
+
var ctx = event.context;
|
|
3451
|
+
this.segments.forEach(function(segment) {
|
|
3452
|
+
var point = event.matrix.transform(segment.point);
|
|
3453
|
+
ctx.beginPath();
|
|
3454
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3455
|
+
ctx.fill();
|
|
3456
|
+
});
|
|
3457
|
+
return false;
|
|
3458
|
+
}
|
|
3459
|
+
</script>
|
|
3460
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3461
|
+
</div>
|
|
3462
|
+
|
|
3463
|
+
|
|
3464
|
+
</div>
|
|
3465
|
+
|
|
3466
|
+
</div>
|
|
3467
|
+
</div>
|
|
3468
|
+
|
|
3469
|
+
</div>
|
|
3470
|
+
|
|
3471
|
+
|
|
3472
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3473
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3474
|
+
|
|
3475
|
+
|
|
3476
|
+
<div id="addeffect-effect" class="member">
|
|
3477
|
+
<div class="member-link">
|
|
3478
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3479
|
+
</div>
|
|
3480
|
+
<div class="member-description hidden">
|
|
3481
|
+
<div class="member-text">
|
|
3482
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3483
|
+
|
|
3484
|
+
|
|
3485
|
+
<ul class="member-list">
|
|
3486
|
+
<h4>Parameters:</h4>
|
|
3487
|
+
|
|
3488
|
+
<li>
|
|
3489
|
+
<tt>effect:</tt>
|
|
3490
|
+
<tt>Object</tt>
|
|
3491
|
+
— the plain object describing the effect
|
|
3492
|
+
|
|
3493
|
+
</li>
|
|
3494
|
+
|
|
3495
|
+
</ul>
|
|
3496
|
+
|
|
3497
|
+
|
|
3498
|
+
<ul class="member-list">
|
|
3499
|
+
<h4>Returns:</h4>
|
|
3500
|
+
|
|
3501
|
+
<li>
|
|
3502
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3503
|
+
</li>
|
|
3504
|
+
|
|
3505
|
+
|
|
3506
|
+
</ul>
|
|
3507
|
+
|
|
3508
|
+
|
|
3509
|
+
|
|
3510
|
+
|
|
3511
|
+
|
|
3512
|
+
</div>
|
|
3513
|
+
</div>
|
|
3514
|
+
</div>
|
|
3515
|
+
|
|
3516
|
+
|
|
3517
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3518
|
+
<div class="member-link">
|
|
3519
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3520
|
+
</div>
|
|
3521
|
+
<div class="member-description hidden">
|
|
3522
|
+
<div class="member-text">
|
|
3523
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3524
|
+
|
|
3525
|
+
|
|
3526
|
+
<ul class="member-list">
|
|
3527
|
+
<h4>Parameters:</h4>
|
|
3528
|
+
|
|
3529
|
+
<li>
|
|
3530
|
+
<tt>index:</tt>
|
|
3531
|
+
<tt>Number</tt>
|
|
3532
|
+
— the index at which to insert the effect
|
|
3533
|
+
|
|
3534
|
+
</li>
|
|
3535
|
+
|
|
3536
|
+
<li>
|
|
3537
|
+
<tt>effect:</tt>
|
|
3538
|
+
<tt>Object</tt>
|
|
3539
|
+
— the plain object describing the effect
|
|
3540
|
+
|
|
3541
|
+
</li>
|
|
3542
|
+
|
|
3543
|
+
</ul>
|
|
3544
|
+
|
|
3545
|
+
|
|
3546
|
+
<ul class="member-list">
|
|
3547
|
+
<h4>Returns:</h4>
|
|
3548
|
+
|
|
3549
|
+
<li>
|
|
3550
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3551
|
+
</li>
|
|
3552
|
+
|
|
3553
|
+
|
|
3554
|
+
</ul>
|
|
3555
|
+
|
|
3556
|
+
|
|
3557
|
+
|
|
3558
|
+
|
|
3559
|
+
|
|
3560
|
+
</div>
|
|
3561
|
+
</div>
|
|
3562
|
+
</div>
|
|
3563
|
+
|
|
3564
|
+
|
|
3565
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3566
|
+
<div class="member-link">
|
|
3567
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3568
|
+
</div>
|
|
3569
|
+
<div class="member-description hidden">
|
|
3570
|
+
<div class="member-text">
|
|
3571
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3572
|
+
|
|
3573
|
+
|
|
3574
|
+
<ul class="member-list">
|
|
3575
|
+
<h4>Parameters:</h4>
|
|
3576
|
+
|
|
3577
|
+
<li>
|
|
3578
|
+
<tt>index:</tt>
|
|
3579
|
+
<tt>Number</tt>
|
|
3580
|
+
— the index at which to insert the effects
|
|
3581
|
+
|
|
3582
|
+
</li>
|
|
3583
|
+
|
|
3584
|
+
<li>
|
|
3585
|
+
<tt>effects:</tt>
|
|
3586
|
+
Array of <tt>Object</tt> objects
|
|
3587
|
+
— the plain objects describing the effects
|
|
3588
|
+
|
|
3589
|
+
</li>
|
|
3590
|
+
|
|
3591
|
+
</ul>
|
|
3592
|
+
|
|
3593
|
+
|
|
3594
|
+
<ul class="member-list">
|
|
3595
|
+
<h4>Returns:</h4>
|
|
3596
|
+
|
|
3597
|
+
<li>
|
|
3598
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3599
|
+
</li>
|
|
3600
|
+
|
|
3601
|
+
|
|
3602
|
+
</ul>
|
|
3021
3603
|
|
|
3022
3604
|
|
|
3023
|
-
</div>
|
|
3024
3605
|
|
|
3606
|
+
|
|
3607
|
+
|
|
3608
|
+
</div>
|
|
3025
3609
|
</div>
|
|
3026
3610
|
</div>
|
|
3027
3611
|
|
|
3028
3612
|
|
|
3029
|
-
<div id="
|
|
3613
|
+
<div id="removeeffect-index" class="member">
|
|
3030
3614
|
<div class="member-link">
|
|
3031
|
-
<a name="
|
|
3615
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
3032
3616
|
</div>
|
|
3033
3617
|
<div class="member-description hidden">
|
|
3034
|
-
|
|
3035
3618
|
<div class="member-text">
|
|
3036
|
-
<p>
|
|
3619
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3620
|
+
|
|
3037
3621
|
|
|
3622
|
+
<ul class="member-list">
|
|
3623
|
+
<h4>Parameters:</h4>
|
|
3038
3624
|
|
|
3625
|
+
<li>
|
|
3626
|
+
<tt>index:</tt>
|
|
3627
|
+
<tt>Number</tt>
|
|
3628
|
+
— the index of the effect to remove
|
|
3629
|
+
|
|
3630
|
+
</li>
|
|
3039
3631
|
|
|
3040
|
-
|
|
3041
|
-
|
|
3042
|
-
<li>
|
|
3043
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3044
|
-
</li>
|
|
3045
|
-
</ul>
|
|
3046
|
-
|
|
3632
|
+
</ul>
|
|
3633
|
+
|
|
3047
3634
|
|
|
3048
3635
|
<ul class="member-list">
|
|
3049
|
-
<h4>
|
|
3636
|
+
<h4>Returns:</h4>
|
|
3050
3637
|
|
|
3051
|
-
<li
|
|
3638
|
+
<li>
|
|
3639
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3640
|
+
</li>
|
|
3641
|
+
|
|
3052
3642
|
|
|
3053
3643
|
</ul>
|
|
3054
3644
|
|
|
3055
|
-
<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>
|
|
3056
3645
|
|
|
3057
|
-
<div class="paperscript split">
|
|
3058
3646
|
|
|
3059
|
-
|
|
3060
|
-
|
|
3647
|
+
|
|
3648
|
+
|
|
3061
3649
|
</div>
|
|
3062
|
-
|
|
3063
|
-
<script type="text/paperscript" canvas="canvas-35">
|
|
3064
|
-
// Create a circle shaped path at the center of the view:
|
|
3065
|
-
var path = new Path.Circle({
|
|
3066
|
-
center: view.center,
|
|
3067
|
-
radius: 25,
|
|
3068
|
-
fillColor: 'black'
|
|
3069
|
-
});
|
|
3070
|
-
|
|
3071
|
-
// When the mouse enters the item, set its fill color to red:
|
|
3072
|
-
path.onMouseEnter = function(event) {
|
|
3073
|
-
this.fillColor = 'red';
|
|
3074
|
-
}
|
|
3075
|
-
|
|
3076
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3077
|
-
path.onMouseLeave = function(event) {
|
|
3078
|
-
this.fillColor = 'black';
|
|
3079
|
-
}
|
|
3080
|
-
</script>
|
|
3081
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3082
3650
|
</div>
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
<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>
|
|
3086
|
-
|
|
3087
|
-
<div class="paperscript split">
|
|
3088
|
-
|
|
3089
|
-
<div class="buttons">
|
|
3090
|
-
<div class="button run">Run</div>
|
|
3091
3651
|
</div>
|
|
3092
3652
|
|
|
3093
|
-
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3653
|
+
|
|
3654
|
+
<div id="removeeffects" class="member">
|
|
3655
|
+
<div class="member-link">
|
|
3656
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
3657
|
+
</div>
|
|
3658
|
+
<div class="member-description hidden">
|
|
3659
|
+
<div class="member-text">
|
|
3660
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3661
|
+
|
|
3662
|
+
|
|
3663
|
+
<ul class="member-list">
|
|
3664
|
+
<h4>Parameters:</h4>
|
|
3665
|
+
|
|
3666
|
+
<li>
|
|
3667
|
+
<tt>start:</tt>
|
|
3668
|
+
<tt>Number</tt>
|
|
3669
|
+
— the index of the first effect to remove
|
|
3670
|
+
— optional, default: <tt>0</tt>
|
|
3671
|
+
</li>
|
|
3672
|
+
|
|
3673
|
+
<li>
|
|
3674
|
+
<tt>end:</tt>
|
|
3675
|
+
<tt>Number</tt>
|
|
3676
|
+
— the index after the last one
|
|
3677
|
+
— optional, default: <tt>effects.length</tt>
|
|
3678
|
+
</li>
|
|
3679
|
+
|
|
3680
|
+
</ul>
|
|
3101
3681
|
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3682
|
+
|
|
3683
|
+
<ul class="member-list">
|
|
3684
|
+
<h4>Returns:</h4>
|
|
3685
|
+
|
|
3686
|
+
<li>
|
|
3687
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3688
|
+
</li>
|
|
3107
3689
|
|
|
3108
|
-
|
|
3109
|
-
|
|
3690
|
+
|
|
3691
|
+
</ul>
|
|
3110
3692
|
|
|
3111
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3112
|
-
path.onMouseLeave = leave;
|
|
3113
|
-
}
|
|
3114
|
-
</script>
|
|
3115
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3116
|
-
</div>
|
|
3117
3693
|
|
|
3118
3694
|
|
|
3695
|
+
|
|
3696
|
+
|
|
3119
3697
|
</div>
|
|
3120
|
-
|
|
3121
3698
|
</div>
|
|
3122
3699
|
</div>
|
|
3123
3700
|
|
|
3124
3701
|
|
|
3125
|
-
<div id="
|
|
3702
|
+
<div id="geteffectoutput" class="member">
|
|
3126
3703
|
<div class="member-link">
|
|
3127
|
-
<a name="
|
|
3704
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
3128
3705
|
</div>
|
|
3129
3706
|
<div class="member-description hidden">
|
|
3130
|
-
|
|
3131
3707
|
<div class="member-text">
|
|
3132
|
-
<p>
|
|
3133
|
-
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
<ul class="member-list">
|
|
3137
|
-
<h4>Type:</h4>
|
|
3138
|
-
<li>
|
|
3139
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3140
|
-
</li>
|
|
3141
|
-
</ul>
|
|
3708
|
+
<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>
|
|
3142
3709
|
|
|
3143
3710
|
|
|
3711
|
+
|
|
3144
3712
|
<ul class="member-list">
|
|
3145
|
-
<h4>
|
|
3713
|
+
<h4>Returns:</h4>
|
|
3146
3714
|
|
|
3147
|
-
<li
|
|
3715
|
+
<li>
|
|
3716
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3717
|
+
</li>
|
|
3718
|
+
|
|
3148
3719
|
|
|
3149
3720
|
</ul>
|
|
3150
3721
|
|
|
3151
|
-
<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>
|
|
3152
|
-
|
|
3153
|
-
<div class="paperscript split">
|
|
3154
|
-
|
|
3155
|
-
<div class="buttons">
|
|
3156
|
-
<div class="button run">Run</div>
|
|
3157
|
-
</div>
|
|
3158
|
-
|
|
3159
|
-
<script type="text/paperscript" canvas="canvas-37">
|
|
3160
|
-
// Create a circle shaped path at the center of the view:
|
|
3161
|
-
var path = new Path.Circle({
|
|
3162
|
-
center: view.center,
|
|
3163
|
-
radius: 25,
|
|
3164
|
-
fillColor: 'black'
|
|
3165
|
-
});
|
|
3166
|
-
|
|
3167
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
3168
|
-
path.onMouseLeave = function(event) {
|
|
3169
|
-
this.fillColor = 'red';
|
|
3170
|
-
}
|
|
3171
|
-
</script>
|
|
3172
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3173
|
-
</div>
|
|
3174
|
-
|
|
3175
3722
|
|
|
3176
|
-
</div>
|
|
3177
3723
|
|
|
3724
|
+
|
|
3725
|
+
|
|
3178
3726
|
</div>
|
|
3179
3727
|
</div>
|
|
3180
|
-
|
|
3181
3728
|
</div>
|
|
3182
3729
|
|
|
3183
|
-
|
|
3184
|
-
<!-- =========================== inherited methods ========================= -->
|
|
3185
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3186
|
-
|
|
3187
3730
|
|
|
3188
3731
|
<div id="set-props" class="member">
|
|
3189
3732
|
<div class="member-link">
|
|
@@ -3228,7 +3771,7 @@ path.onMouseLeave = function(event) {
|
|
|
3228
3771
|
<div class="button run">Run</div>
|
|
3229
3772
|
</div>
|
|
3230
3773
|
|
|
3231
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3774
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
3232
3775
|
var circle = new Path.Circle({
|
|
3233
3776
|
center: [80, 50],
|
|
3234
3777
|
radius: 35
|
|
@@ -3241,7 +3784,7 @@ circle.set({
|
|
|
3241
3784
|
selected: true
|
|
3242
3785
|
});
|
|
3243
3786
|
</script>
|
|
3244
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3787
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
3245
3788
|
</div>
|
|
3246
3789
|
|
|
3247
3790
|
|
|
@@ -3297,7 +3840,7 @@ circle.set({
|
|
|
3297
3840
|
<div class="button run">Run</div>
|
|
3298
3841
|
</div>
|
|
3299
3842
|
|
|
3300
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3843
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
3301
3844
|
var circle = new Path.Circle({
|
|
3302
3845
|
center: [50, 50],
|
|
3303
3846
|
radius: 10,
|
|
@@ -3312,7 +3855,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3312
3855
|
copy.position.x += i * copy.bounds.width;
|
|
3313
3856
|
}
|
|
3314
3857
|
</script>
|
|
3315
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3858
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
3316
3859
|
</div>
|
|
3317
3860
|
|
|
3318
3861
|
|
|
@@ -3438,7 +3981,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3438
3981
|
<div class="button run">Run</div>
|
|
3439
3982
|
</div>
|
|
3440
3983
|
|
|
3441
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3984
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
3442
3985
|
var circle = new Path.Circle({
|
|
3443
3986
|
center: [50, 50],
|
|
3444
3987
|
radius: 5,
|
|
@@ -3455,7 +3998,7 @@ raster.position.x += 100;
|
|
|
3455
3998
|
circle.scale(5);
|
|
3456
3999
|
raster.scale(5);
|
|
3457
4000
|
</script>
|
|
3458
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4001
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
3459
4002
|
</div>
|
|
3460
4003
|
|
|
3461
4004
|
|
|
@@ -3509,7 +4052,7 @@ raster.scale(5);
|
|
|
3509
4052
|
<div class="button run">Run</div>
|
|
3510
4053
|
</div>
|
|
3511
4054
|
|
|
3512
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4055
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
3513
4056
|
var path = new Path.Star({
|
|
3514
4057
|
center: [50, 50],
|
|
3515
4058
|
points: 12,
|
|
@@ -3530,7 +4073,7 @@ function onMouseDown(event) {
|
|
|
3530
4073
|
}
|
|
3531
4074
|
}
|
|
3532
4075
|
</script>
|
|
3533
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4076
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
3534
4077
|
</div>
|
|
3535
4078
|
|
|
3536
4079
|
|
|
@@ -4048,11 +4591,17 @@ function onMouseDown(event) {
|
|
|
4048
4591
|
</div>
|
|
4049
4592
|
<div class="member-description hidden">
|
|
4050
4593
|
<div class="member-text">
|
|
4051
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4594
|
+
<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>
|
|
4052
4595
|
<ul class="member-list">
|
|
4053
4596
|
<h4>Options:</h4>
|
|
4054
|
-
<li
|
|
4055
|
-
|
|
4597
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4598
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4599
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4600
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4601
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4602
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4603
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4604
|
+
`options.bounds` the identity matrix is used.</li>
|
|
4056
4605
|
<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>
|
|
4057
4606
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
4058
4607
|
<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>
|
|
@@ -5406,7 +5955,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5406
5955
|
<div class="button run">Run</div>
|
|
5407
5956
|
</div>
|
|
5408
5957
|
|
|
5409
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5958
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5410
5959
|
// Create a rectangle shaped path with its top left
|
|
5411
5960
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5412
5961
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5415,7 +5964,7 @@ path.fillColor = 'black';
|
|
|
5415
5964
|
// Rotate the path by 30 degrees:
|
|
5416
5965
|
path.rotate(30);
|
|
5417
5966
|
</script>
|
|
5418
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5967
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5419
5968
|
</div>
|
|
5420
5969
|
|
|
5421
5970
|
|
|
@@ -5427,7 +5976,7 @@ path.rotate(30);
|
|
|
5427
5976
|
<div class="button run">Run</div>
|
|
5428
5977
|
</div>
|
|
5429
5978
|
|
|
5430
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5979
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5431
5980
|
// Create a rectangle shaped path with its top left
|
|
5432
5981
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5433
5982
|
var topLeft = new Point(175, 50);
|
|
@@ -5449,7 +5998,7 @@ function onFrame(event) {
|
|
|
5449
5998
|
path.rotate(3, view.center);
|
|
5450
5999
|
}
|
|
5451
6000
|
</script>
|
|
5452
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6001
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-47"></canvas></div>
|
|
5453
6002
|
</div>
|
|
5454
6003
|
|
|
5455
6004
|
|
|
@@ -5498,7 +6047,7 @@ function onFrame(event) {
|
|
|
5498
6047
|
<div class="button run">Run</div>
|
|
5499
6048
|
</div>
|
|
5500
6049
|
|
|
5501
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6050
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5502
6051
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5503
6052
|
// with a radius of 20:
|
|
5504
6053
|
var circle = new Path.Circle({
|
|
@@ -5510,7 +6059,7 @@ var circle = new Path.Circle({
|
|
|
5510
6059
|
// Scale the path by 150% from its center point
|
|
5511
6060
|
circle.scale(1.5);
|
|
5512
6061
|
</script>
|
|
5513
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6062
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
5514
6063
|
</div>
|
|
5515
6064
|
|
|
5516
6065
|
|
|
@@ -5522,7 +6071,7 @@ circle.scale(1.5);
|
|
|
5522
6071
|
<div class="button run">Run</div>
|
|
5523
6072
|
</div>
|
|
5524
6073
|
|
|
5525
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6074
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
5526
6075
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5527
6076
|
// with a radius of 20:
|
|
5528
6077
|
var circle = new Path.Circle({
|
|
@@ -5534,7 +6083,7 @@ var circle = new Path.Circle({
|
|
|
5534
6083
|
// Scale the path 150% from its bottom left corner
|
|
5535
6084
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5536
6085
|
</script>
|
|
5537
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6086
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-49"></canvas></div>
|
|
5538
6087
|
</div>
|
|
5539
6088
|
|
|
5540
6089
|
|
|
@@ -5590,7 +6139,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5590
6139
|
<div class="button run">Run</div>
|
|
5591
6140
|
</div>
|
|
5592
6141
|
|
|
5593
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6142
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
5594
6143
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5595
6144
|
// with a radius of 20:
|
|
5596
6145
|
var circle = new Path.Circle({
|
|
@@ -5602,7 +6151,7 @@ var circle = new Path.Circle({
|
|
|
5602
6151
|
// Scale the path horizontally by 300%
|
|
5603
6152
|
circle.scale(3, 1);
|
|
5604
6153
|
</script>
|
|
5605
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6154
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
5606
6155
|
</div>
|
|
5607
6156
|
|
|
5608
6157
|
|
|
@@ -6040,7 +6589,7 @@ circle.scale(3, 1);
|
|
|
6040
6589
|
<div class="button run">Run</div>
|
|
6041
6590
|
</div>
|
|
6042
6591
|
|
|
6043
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6592
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
6044
6593
|
// Create a rectangle shaped path with its top left corner
|
|
6045
6594
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6046
6595
|
var path = new Path.Rectangle({
|
|
@@ -6061,7 +6610,7 @@ var circlePath = new Path.Circle({
|
|
|
6061
6610
|
// the rectangular path:
|
|
6062
6611
|
circlePath.fitBounds(path.bounds);
|
|
6063
6612
|
</script>
|
|
6064
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6613
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6065
6614
|
</div>
|
|
6066
6615
|
|
|
6067
6616
|
|
|
@@ -6073,7 +6622,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
6073
6622
|
<div class="button run">Run</div>
|
|
6074
6623
|
</div>
|
|
6075
6624
|
|
|
6076
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6625
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6077
6626
|
// Create a rectangle shaped path with its top left corner
|
|
6078
6627
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6079
6628
|
var path = new Path.Rectangle({
|
|
@@ -6094,7 +6643,7 @@ var circlePath = new Path.Circle({
|
|
|
6094
6643
|
// the rectangular path:
|
|
6095
6644
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
6096
6645
|
</script>
|
|
6097
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6646
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6098
6647
|
</div>
|
|
6099
6648
|
|
|
6100
6649
|
|
|
@@ -6106,7 +6655,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
6106
6655
|
<div class="button run">Run</div>
|
|
6107
6656
|
</div>
|
|
6108
6657
|
|
|
6109
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6658
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6110
6659
|
var path = new Path.Circle({
|
|
6111
6660
|
center: [80, 50],
|
|
6112
6661
|
radius: 30,
|
|
@@ -6116,7 +6665,7 @@ var path = new Path.Circle({
|
|
|
6116
6665
|
// Fit the path to the bounding rectangle of the view:
|
|
6117
6666
|
path.fitBounds(view.bounds);
|
|
6118
6667
|
</script>
|
|
6119
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6668
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
|
|
6120
6669
|
</div>
|
|
6121
6670
|
|
|
6122
6671
|
|
|
@@ -6142,7 +6691,7 @@ path.fitBounds(view.bounds);
|
|
|
6142
6691
|
<li>
|
|
6143
6692
|
<tt>type:</tt>
|
|
6144
6693
|
<tt>String</tt>
|
|
6145
|
-
— 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>
|
|
6694
|
+
— 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>
|
|
6146
6695
|
|
|
6147
6696
|
</li>
|
|
6148
6697
|
|
|
@@ -6177,7 +6726,7 @@ path.fitBounds(view.bounds);
|
|
|
6177
6726
|
<div class="button run">Run</div>
|
|
6178
6727
|
</div>
|
|
6179
6728
|
|
|
6180
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6729
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6181
6730
|
// Create a circle shaped path at the center of the view:
|
|
6182
6731
|
var path = new Path.Circle({
|
|
6183
6732
|
center: view.center,
|
|
@@ -6195,7 +6744,7 @@ path.on('mouseleave', function() {
|
|
|
6195
6744
|
this.fillColor = 'black';
|
|
6196
6745
|
});
|
|
6197
6746
|
</script>
|
|
6198
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6747
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
|
|
6199
6748
|
</div>
|
|
6200
6749
|
|
|
6201
6750
|
|
|
@@ -6219,7 +6768,7 @@ path.on('mouseleave', function() {
|
|
|
6219
6768
|
<li>
|
|
6220
6769
|
<tt>object:</tt>
|
|
6221
6770
|
<tt>Object</tt>
|
|
6222
|
-
— 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>
|
|
6771
|
+
— 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>
|
|
6223
6772
|
|
|
6224
6773
|
</li>
|
|
6225
6774
|
|
|
@@ -6247,7 +6796,7 @@ path.on('mouseleave', function() {
|
|
|
6247
6796
|
<div class="button run">Run</div>
|
|
6248
6797
|
</div>
|
|
6249
6798
|
|
|
6250
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6799
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6251
6800
|
// Create a circle shaped path at the center of the view:
|
|
6252
6801
|
var path = new Path.Circle({
|
|
6253
6802
|
center: view.center,
|
|
@@ -6265,7 +6814,7 @@ path.on({
|
|
|
6265
6814
|
}
|
|
6266
6815
|
});
|
|
6267
6816
|
</script>
|
|
6268
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6817
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
|
|
6269
6818
|
</div>
|
|
6270
6819
|
|
|
6271
6820
|
|
|
@@ -6277,7 +6826,7 @@ path.on({
|
|
|
6277
6826
|
<div class="button run">Run</div>
|
|
6278
6827
|
</div>
|
|
6279
6828
|
|
|
6280
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6829
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6281
6830
|
var pathHandlers = {
|
|
6282
6831
|
mouseenter: function(event) {
|
|
6283
6832
|
this.fillColor = 'red';
|
|
@@ -6300,7 +6849,7 @@ function onMouseDown(event) {
|
|
|
6300
6849
|
path.on(pathHandlers);
|
|
6301
6850
|
}
|
|
6302
6851
|
</script>
|
|
6303
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6852
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
|
|
6304
6853
|
</div>
|
|
6305
6854
|
|
|
6306
6855
|
|
|
@@ -6324,7 +6873,7 @@ function onMouseDown(event) {
|
|
|
6324
6873
|
<li>
|
|
6325
6874
|
<tt>type:</tt>
|
|
6326
6875
|
<tt>String</tt>
|
|
6327
|
-
— 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>
|
|
6876
|
+
— 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>
|
|
6328
6877
|
|
|
6329
6878
|
</li>
|
|
6330
6879
|
|
|
@@ -6372,7 +6921,7 @@ function onMouseDown(event) {
|
|
|
6372
6921
|
<li>
|
|
6373
6922
|
<tt>object:</tt>
|
|
6374
6923
|
<tt>Object</tt>
|
|
6375
|
-
— 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>
|
|
6924
|
+
— 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>
|
|
6376
6925
|
|
|
6377
6926
|
</li>
|
|
6378
6927
|
|
|
@@ -6413,7 +6962,7 @@ function onMouseDown(event) {
|
|
|
6413
6962
|
<li>
|
|
6414
6963
|
<tt>type:</tt>
|
|
6415
6964
|
<tt>String</tt>
|
|
6416
|
-
— 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>
|
|
6965
|
+
— 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>
|
|
6417
6966
|
|
|
6418
6967
|
</li>
|
|
6419
6968
|
|
|
@@ -6461,7 +7010,7 @@ function onMouseDown(event) {
|
|
|
6461
7010
|
<li>
|
|
6462
7011
|
<tt>type:</tt>
|
|
6463
7012
|
<tt>String</tt>
|
|
6464
|
-
— 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>
|
|
7013
|
+
— 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>
|
|
6465
7014
|
|
|
6466
7015
|
</li>
|
|
6467
7016
|
|
|
@@ -6528,7 +7077,7 @@ function onMouseDown(event) {
|
|
|
6528
7077
|
<div class="button run">Run</div>
|
|
6529
7078
|
</div>
|
|
6530
7079
|
|
|
6531
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7080
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6532
7081
|
function onMouseDrag(event) {
|
|
6533
7082
|
// Create a circle shaped path at the mouse position,
|
|
6534
7083
|
// with a radius of 10:
|
|
@@ -6545,7 +7094,7 @@ function onMouseDrag(event) {
|
|
|
6545
7094
|
});
|
|
6546
7095
|
}
|
|
6547
7096
|
</script>
|
|
6548
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7097
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
|
|
6549
7098
|
</div>
|
|
6550
7099
|
|
|
6551
7100
|
|
|
@@ -6575,7 +7124,7 @@ function onMouseDrag(event) {
|
|
|
6575
7124
|
<div class="button run">Run</div>
|
|
6576
7125
|
</div>
|
|
6577
7126
|
|
|
6578
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7127
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6579
7128
|
function onMouseMove(event) {
|
|
6580
7129
|
// Create a circle shaped path at the mouse position,
|
|
6581
7130
|
// with a radius of 10:
|
|
@@ -6589,7 +7138,7 @@ function onMouseMove(event) {
|
|
|
6589
7138
|
path.removeOnMove();
|
|
6590
7139
|
}
|
|
6591
7140
|
</script>
|
|
6592
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7141
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-58"></canvas></div>
|
|
6593
7142
|
</div>
|
|
6594
7143
|
|
|
6595
7144
|
|
|
@@ -6619,7 +7168,7 @@ function onMouseMove(event) {
|
|
|
6619
7168
|
<div class="button run">Run</div>
|
|
6620
7169
|
</div>
|
|
6621
7170
|
|
|
6622
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7171
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6623
7172
|
function onMouseDown(event) {
|
|
6624
7173
|
// Create a circle shaped path at the mouse position,
|
|
6625
7174
|
// with a radius of 10:
|
|
@@ -6633,7 +7182,7 @@ function onMouseDown(event) {
|
|
|
6633
7182
|
path.removeOnDown();
|
|
6634
7183
|
}
|
|
6635
7184
|
</script>
|
|
6636
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7185
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
|
|
6637
7186
|
</div>
|
|
6638
7187
|
|
|
6639
7188
|
|
|
@@ -6663,7 +7212,7 @@ function onMouseDown(event) {
|
|
|
6663
7212
|
<div class="button run">Run</div>
|
|
6664
7213
|
</div>
|
|
6665
7214
|
|
|
6666
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7215
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6667
7216
|
function onMouseDrag(event) {
|
|
6668
7217
|
// Create a circle shaped path at the mouse position,
|
|
6669
7218
|
// with a radius of 10:
|
|
@@ -6677,7 +7226,7 @@ function onMouseDrag(event) {
|
|
|
6677
7226
|
path.removeOnDrag();
|
|
6678
7227
|
}
|
|
6679
7228
|
</script>
|
|
6680
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7229
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
|
|
6681
7230
|
</div>
|
|
6682
7231
|
|
|
6683
7232
|
|
|
@@ -6707,7 +7256,7 @@ function onMouseDrag(event) {
|
|
|
6707
7256
|
<div class="button run">Run</div>
|
|
6708
7257
|
</div>
|
|
6709
7258
|
|
|
6710
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7259
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6711
7260
|
function onMouseDown(event) {
|
|
6712
7261
|
// Create a circle shaped path at the mouse position,
|
|
6713
7262
|
// with a radius of 10:
|
|
@@ -6721,7 +7270,7 @@ function onMouseDown(event) {
|
|
|
6721
7270
|
path.removeOnUp();
|
|
6722
7271
|
}
|
|
6723
7272
|
</script>
|
|
6724
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7273
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
|
|
6725
7274
|
</div>
|
|
6726
7275
|
|
|
6727
7276
|
|
|
@@ -6794,7 +7343,7 @@ function onMouseDown(event) {
|
|
|
6794
7343
|
<div class="button run">Run</div>
|
|
6795
7344
|
</div>
|
|
6796
7345
|
|
|
6797
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7346
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
6798
7347
|
var path = new Path.Circle({
|
|
6799
7348
|
radius: view.bounds.height * 0.4,
|
|
6800
7349
|
center: view.center
|
|
@@ -6805,7 +7354,7 @@ path.tween(
|
|
|
6805
7354
|
3000
|
|
6806
7355
|
);
|
|
6807
7356
|
</script>
|
|
6808
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7357
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
6809
7358
|
</div>
|
|
6810
7359
|
|
|
6811
7360
|
|
|
@@ -6817,7 +7366,7 @@ path.tween(
|
|
|
6817
7366
|
<div class="button run">Run</div>
|
|
6818
7367
|
</div>
|
|
6819
7368
|
|
|
6820
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7369
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
6821
7370
|
var path = new Shape.Rectangle({
|
|
6822
7371
|
fillColor: 'red',
|
|
6823
7372
|
center: [50, view.center.y],
|
|
@@ -6832,7 +7381,7 @@ path.tween({
|
|
|
6832
7381
|
duration: 2000
|
|
6833
7382
|
});
|
|
6834
7383
|
</script>
|
|
6835
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7384
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
6836
7385
|
</div>
|
|
6837
7386
|
|
|
6838
7387
|
|
|
@@ -6898,7 +7447,7 @@ path.tween({
|
|
|
6898
7447
|
<div class="button run">Run</div>
|
|
6899
7448
|
</div>
|
|
6900
7449
|
|
|
6901
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7450
|
+
<script type="text/paperscript" canvas="canvas-64">
|
|
6902
7451
|
var path = new Path.Rectangle({
|
|
6903
7452
|
size: [100, 100],
|
|
6904
7453
|
position: view.center,
|
|
@@ -6912,7 +7461,7 @@ path.tween({
|
|
|
6912
7461
|
'segments[2].point.x': '-= 50'
|
|
6913
7462
|
}, 3000);
|
|
6914
7463
|
</script>
|
|
6915
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7464
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-64"></canvas></div>
|
|
6916
7465
|
</div>
|
|
6917
7466
|
|
|
6918
7467
|
|
|
@@ -6971,7 +7520,7 @@ path.tween({
|
|
|
6971
7520
|
<div class="button run">Run</div>
|
|
6972
7521
|
</div>
|
|
6973
7522
|
|
|
6974
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7523
|
+
<script type="text/paperscript" canvas="canvas-65">
|
|
6975
7524
|
var path = new Path.Circle({
|
|
6976
7525
|
fillColor: 'blue',
|
|
6977
7526
|
radius: view.bounds.height * 0.4,
|
|
@@ -6987,7 +7536,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6987
7536
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6988
7537
|
};
|
|
6989
7538
|
</script>
|
|
6990
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7539
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
|
|
6991
7540
|
</div>
|
|
6992
7541
|
|
|
6993
7542
|
|
|
@@ -7108,7 +7657,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7108
7657
|
<div class="button run">Run</div>
|
|
7109
7658
|
</div>
|
|
7110
7659
|
|
|
7111
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7660
|
+
<script type="text/paperscript" canvas="canvas-66">
|
|
7112
7661
|
var path = new Path.Circle({
|
|
7113
7662
|
fillColor: 'blue',
|
|
7114
7663
|
radius: view.bounds.height * 0.4,
|
|
@@ -7116,7 +7665,7 @@ var path = new Path.Circle({
|
|
|
7116
7665
|
});
|
|
7117
7666
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
7118
7667
|
</script>
|
|
7119
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7668
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
|
|
7120
7669
|
</div>
|
|
7121
7670
|
|
|
7122
7671
|
|
|
@@ -7130,7 +7679,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
7130
7679
|
|
|
7131
7680
|
<!-- =========================== copyright notice ========================== -->
|
|
7132
7681
|
<p class="footer">
|
|
7133
|
-
Paper.js v0.
|
|
7682
|
+
Paper.js v0.17.0<br>
|
|
7134
7683
|
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>
|
|
7135
7684
|
<div class="content-end"></div>
|
|
7136
7685
|
|