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
|
@@ -156,6 +156,43 @@ for (var i = 0; i < 100; i++) {
|
|
|
156
156
|
|
|
157
157
|
|
|
158
158
|
|
|
159
|
+
<!-- ============================== methods ================================ -->
|
|
160
|
+
<div class="reference-members">
|
|
161
|
+
<h2>Methods</h2>
|
|
162
|
+
|
|
163
|
+
|
|
164
|
+
<div id="embed" class="member">
|
|
165
|
+
<div class="member-link">
|
|
166
|
+
<a name="embed" href="#embed"><tt><b>embed</b>()</tt></a>
|
|
167
|
+
</div>
|
|
168
|
+
<div class="member-description hidden">
|
|
169
|
+
<div class="member-text">
|
|
170
|
+
<p>Replaces the symbol item with a copy of its definition’s item, which keeps the symbol item’s appearance: its matrix is applied to the copy, its opacity, visibility, blend mode and other attributes are combined with the copy’s, and its name, data and selection are passed on.</p>
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
<ul class="member-list">
|
|
175
|
+
<h4>Returns:</h4>
|
|
176
|
+
|
|
177
|
+
<li>
|
|
178
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a></tt> — the copy of the definition’s item, or <code>null</code> if the symbol item has no parent
|
|
179
|
+
</li>
|
|
180
|
+
|
|
181
|
+
|
|
182
|
+
</ul>
|
|
183
|
+
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
</div>
|
|
189
|
+
</div>
|
|
190
|
+
</div>
|
|
191
|
+
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
</div>
|
|
195
|
+
|
|
159
196
|
|
|
160
197
|
|
|
161
198
|
|
|
@@ -163,6 +200,91 @@ for (var i = 0; i < 100; i++) {
|
|
|
163
200
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
164
201
|
|
|
165
202
|
|
|
203
|
+
<div id="effects" class="member">
|
|
204
|
+
<div class="member-link">
|
|
205
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
206
|
+
</div>
|
|
207
|
+
<div class="member-description hidden">
|
|
208
|
+
|
|
209
|
+
<div class="member-text">
|
|
210
|
+
<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,
|
|
211
|
+
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>
|
|
212
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
213
|
+
<ul>
|
|
214
|
+
<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>
|
|
215
|
+
<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>
|
|
216
|
+
</ul>
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
|
|
220
|
+
<ul class="member-list">
|
|
221
|
+
<h4>Type:</h4>
|
|
222
|
+
<li>
|
|
223
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
224
|
+
</li>
|
|
225
|
+
</ul>
|
|
226
|
+
|
|
227
|
+
|
|
228
|
+
<h4>Example:</h4>
|
|
229
|
+
|
|
230
|
+
<div class="paperscript split">
|
|
231
|
+
|
|
232
|
+
<div class="buttons">
|
|
233
|
+
<div class="button run">Run</div>
|
|
234
|
+
</div>
|
|
235
|
+
|
|
236
|
+
<script type="text/paperscript" canvas="canvas-1">
|
|
237
|
+
var path = new Path.Star({
|
|
238
|
+
center: view.center,
|
|
239
|
+
points: 5,
|
|
240
|
+
radius1: 20,
|
|
241
|
+
radius2: 40,
|
|
242
|
+
strokeColor: 'black',
|
|
243
|
+
strokeWidth: 8
|
|
244
|
+
});
|
|
245
|
+
path.effects = [
|
|
246
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
247
|
+
{ type: 'outline' }
|
|
248
|
+
];
|
|
249
|
+
</script>
|
|
250
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-1"></canvas></div>
|
|
251
|
+
</div>
|
|
252
|
+
|
|
253
|
+
|
|
254
|
+
</div>
|
|
255
|
+
|
|
256
|
+
</div>
|
|
257
|
+
</div>
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
<div id="previewbounds-matrix" class="member">
|
|
261
|
+
<div class="member-link">
|
|
262
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
263
|
+
</div>
|
|
264
|
+
<div class="member-description hidden">
|
|
265
|
+
|
|
266
|
+
<div class="member-text">
|
|
267
|
+
<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>
|
|
268
|
+
|
|
269
|
+
<p>Read only.</p>
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
|
|
273
|
+
<ul class="member-list">
|
|
274
|
+
<h4>Type:</h4>
|
|
275
|
+
<li>
|
|
276
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
277
|
+
</li>
|
|
278
|
+
</ul>
|
|
279
|
+
|
|
280
|
+
|
|
281
|
+
|
|
282
|
+
</div>
|
|
283
|
+
|
|
284
|
+
</div>
|
|
285
|
+
</div>
|
|
286
|
+
|
|
287
|
+
|
|
166
288
|
<div id="key" class="member">
|
|
167
289
|
<div class="member-link">
|
|
168
290
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -275,7 +397,7 @@ for (var i = 0; i < 100; i++) {
|
|
|
275
397
|
<div class="button run">Run</div>
|
|
276
398
|
</div>
|
|
277
399
|
|
|
278
|
-
<script type="text/paperscript" canvas="canvas-
|
|
400
|
+
<script type="text/paperscript" canvas="canvas-2">
|
|
279
401
|
var path = new Path.Circle({
|
|
280
402
|
center: [80, 50],
|
|
281
403
|
radius: 35
|
|
@@ -290,7 +412,7 @@ group.addChild(path);
|
|
|
290
412
|
// The path can be accessed by name:
|
|
291
413
|
group.children['example'].fillColor = 'red';
|
|
292
414
|
</script>
|
|
293
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
415
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-2"></canvas></div>
|
|
294
416
|
</div>
|
|
295
417
|
|
|
296
418
|
|
|
@@ -328,7 +450,7 @@ group.children['example'].fillColor = 'red';
|
|
|
328
450
|
<div class="button run">Run</div>
|
|
329
451
|
</div>
|
|
330
452
|
|
|
331
|
-
<script type="text/paperscript" canvas="canvas-
|
|
453
|
+
<script type="text/paperscript" canvas="canvas-3">
|
|
332
454
|
var circle = new Path.Circle({
|
|
333
455
|
center: [80, 50],
|
|
334
456
|
radius: 30
|
|
@@ -339,7 +461,7 @@ circle.style = {
|
|
|
339
461
|
strokeWidth: 5
|
|
340
462
|
};
|
|
341
463
|
</script>
|
|
342
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
464
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-3"></canvas></div>
|
|
343
465
|
</div>
|
|
344
466
|
|
|
345
467
|
|
|
@@ -351,7 +473,7 @@ circle.style = {
|
|
|
351
473
|
<div class="button run">Run</div>
|
|
352
474
|
</div>
|
|
353
475
|
|
|
354
|
-
<script type="text/paperscript" canvas="canvas-
|
|
476
|
+
<script type="text/paperscript" canvas="canvas-4">
|
|
355
477
|
var path = new Path.Circle({
|
|
356
478
|
center: [50, 50],
|
|
357
479
|
radius: 30,
|
|
@@ -366,7 +488,7 @@ var path2 = new Path.Circle({
|
|
|
366
488
|
// Copy the path style of path:
|
|
367
489
|
path2.style = path.style;
|
|
368
490
|
</script>
|
|
369
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
491
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-4"></canvas></div>
|
|
370
492
|
</div>
|
|
371
493
|
|
|
372
494
|
|
|
@@ -378,7 +500,7 @@ path2.style = path.style;
|
|
|
378
500
|
<div class="button run">Run</div>
|
|
379
501
|
</div>
|
|
380
502
|
|
|
381
|
-
<script type="text/paperscript" canvas="canvas-
|
|
503
|
+
<script type="text/paperscript" canvas="canvas-5">
|
|
382
504
|
var myStyle = {
|
|
383
505
|
fillColor: 'red',
|
|
384
506
|
strokeColor: 'blue',
|
|
@@ -397,7 +519,7 @@ var path2 = new Path.Circle({
|
|
|
397
519
|
});
|
|
398
520
|
path2.style = myStyle;
|
|
399
521
|
</script>
|
|
400
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
522
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-5"></canvas></div>
|
|
401
523
|
</div>
|
|
402
524
|
|
|
403
525
|
|
|
@@ -439,7 +561,7 @@ path2.style = myStyle;
|
|
|
439
561
|
<div class="button run">Run</div>
|
|
440
562
|
</div>
|
|
441
563
|
|
|
442
|
-
<script type="text/paperscript" canvas="canvas-
|
|
564
|
+
<script type="text/paperscript" canvas="canvas-6">
|
|
443
565
|
var unlockedItem = new Path.Circle({
|
|
444
566
|
center: view.center - [35, 0],
|
|
445
567
|
radius: 30,
|
|
@@ -466,7 +588,7 @@ new PointText({
|
|
|
466
588
|
justification: 'center'
|
|
467
589
|
});
|
|
468
590
|
</script>
|
|
469
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
591
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-6"></canvas></div>
|
|
470
592
|
</div>
|
|
471
593
|
|
|
472
594
|
|
|
@@ -508,7 +630,7 @@ new PointText({
|
|
|
508
630
|
<div class="button run">Run</div>
|
|
509
631
|
</div>
|
|
510
632
|
|
|
511
|
-
<script type="text/paperscript" canvas="canvas-
|
|
633
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
512
634
|
var path = new Path.Circle({
|
|
513
635
|
center: [50, 50],
|
|
514
636
|
radius: 20,
|
|
@@ -518,7 +640,7 @@ var path = new Path.Circle({
|
|
|
518
640
|
// Hide the path:
|
|
519
641
|
path.visible = false;
|
|
520
642
|
</script>
|
|
521
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
643
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
522
644
|
</div>
|
|
523
645
|
|
|
524
646
|
|
|
@@ -566,7 +688,7 @@ path.visible = false;
|
|
|
566
688
|
<div class="button run">Run</div>
|
|
567
689
|
</div>
|
|
568
690
|
|
|
569
|
-
<script type="text/paperscript" canvas="canvas-
|
|
691
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
570
692
|
// Create a white rectangle in the background
|
|
571
693
|
// with the same dimensions as the view:
|
|
572
694
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -587,7 +709,7 @@ var circle2 = new Path.Circle({
|
|
|
587
709
|
// Set the blend mode of circle2:
|
|
588
710
|
circle2.blendMode = 'multiply';
|
|
589
711
|
</script>
|
|
590
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
712
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
591
713
|
</div>
|
|
592
714
|
|
|
593
715
|
|
|
@@ -629,7 +751,7 @@ circle2.blendMode = 'multiply';
|
|
|
629
751
|
<div class="button run">Run</div>
|
|
630
752
|
</div>
|
|
631
753
|
|
|
632
|
-
<script type="text/paperscript" canvas="canvas-
|
|
754
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
633
755
|
var circle = new Path.Circle({
|
|
634
756
|
center: [80, 50],
|
|
635
757
|
radius: 35,
|
|
@@ -647,7 +769,7 @@ var circle2 = new Path.Circle({
|
|
|
647
769
|
// Make circle2 50% transparent:
|
|
648
770
|
circle2.opacity = 0.5;
|
|
649
771
|
</script>
|
|
650
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
772
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
651
773
|
</div>
|
|
652
774
|
|
|
653
775
|
|
|
@@ -770,14 +892,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
770
892
|
<div class="button run">Run</div>
|
|
771
893
|
</div>
|
|
772
894
|
|
|
773
|
-
<script type="text/paperscript" canvas="canvas-
|
|
895
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
774
896
|
var path = new Path.Circle({
|
|
775
897
|
center: [80, 50],
|
|
776
898
|
radius: 35
|
|
777
899
|
});
|
|
778
900
|
path.selected = true; // Select the path
|
|
779
901
|
</script>
|
|
780
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
902
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
781
903
|
</div>
|
|
782
904
|
|
|
783
905
|
|
|
@@ -934,7 +1056,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
934
1056
|
<div class="button run">Run</div>
|
|
935
1057
|
</div>
|
|
936
1058
|
|
|
937
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1059
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
938
1060
|
// Create a circle at position { x: 10, y: 10 }
|
|
939
1061
|
var circle = new Path.Circle({
|
|
940
1062
|
center: new Point(10, 10),
|
|
@@ -948,7 +1070,7 @@ circle.position = new Point(20, 20);
|
|
|
948
1070
|
// Move the circle 100 points to the right and 50 points down
|
|
949
1071
|
circle.position += new Point(100, 50);
|
|
950
1072
|
</script>
|
|
951
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1073
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
952
1074
|
</div>
|
|
953
1075
|
|
|
954
1076
|
|
|
@@ -960,7 +1082,7 @@ circle.position += new Point(100, 50);
|
|
|
960
1082
|
<div class="button run">Run</div>
|
|
961
1083
|
</div>
|
|
962
1084
|
|
|
963
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1085
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
964
1086
|
// Create a circle at position { x: 20, y: 20 }
|
|
965
1087
|
var circle = new Path.Circle({
|
|
966
1088
|
center: new Point(20, 20),
|
|
@@ -971,7 +1093,7 @@ var circle = new Path.Circle({
|
|
|
971
1093
|
// Move the circle 100 points to the right
|
|
972
1094
|
circle.position.x += 100;
|
|
973
1095
|
</script>
|
|
974
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1096
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
975
1097
|
</div>
|
|
976
1098
|
|
|
977
1099
|
|
|
@@ -1497,7 +1619,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
1497
1619
|
<div class="button run">Run</div>
|
|
1498
1620
|
</div>
|
|
1499
1621
|
|
|
1500
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1622
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1501
1623
|
var path = new Path.Circle({
|
|
1502
1624
|
center: [80, 50],
|
|
1503
1625
|
radius: 35
|
|
@@ -1510,7 +1632,7 @@ group.addChild(path);
|
|
|
1510
1632
|
// Access the path through the group's children array:
|
|
1511
1633
|
group.children[0].fillColor = 'red';
|
|
1512
1634
|
</script>
|
|
1513
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1635
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1514
1636
|
</div>
|
|
1515
1637
|
|
|
1516
1638
|
|
|
@@ -1522,7 +1644,7 @@ group.children[0].fillColor = 'red';
|
|
|
1522
1644
|
<div class="button run">Run</div>
|
|
1523
1645
|
</div>
|
|
1524
1646
|
|
|
1525
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1647
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1526
1648
|
var path = new Path.Circle({
|
|
1527
1649
|
center: [80, 50],
|
|
1528
1650
|
radius: 35
|
|
@@ -1537,7 +1659,7 @@ group.addChild(path);
|
|
|
1537
1659
|
// The path can be accessed by name:
|
|
1538
1660
|
group.children['example'].fillColor = 'orange';
|
|
1539
1661
|
</script>
|
|
1540
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1662
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1541
1663
|
</div>
|
|
1542
1664
|
|
|
1543
1665
|
|
|
@@ -1549,7 +1671,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
1549
1671
|
<div class="button run">Run</div>
|
|
1550
1672
|
</div>
|
|
1551
1673
|
|
|
1552
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1674
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1553
1675
|
var path = new Path.Circle({
|
|
1554
1676
|
center: [80, 50],
|
|
1555
1677
|
radius: 35
|
|
@@ -1561,7 +1683,7 @@ group.children = [path];
|
|
|
1561
1683
|
// The path is the first child of the group:
|
|
1562
1684
|
group.firstChild.fillColor = 'green';
|
|
1563
1685
|
</script>
|
|
1564
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1686
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1565
1687
|
</div>
|
|
1566
1688
|
|
|
1567
1689
|
|
|
@@ -1738,7 +1860,7 @@ group.firstChild.fillColor = 'green';
|
|
|
1738
1860
|
<div class="button run">Run</div>
|
|
1739
1861
|
</div>
|
|
1740
1862
|
|
|
1741
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1863
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1742
1864
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1743
1865
|
// with a radius of 35:
|
|
1744
1866
|
var circle = new Path.Circle({
|
|
@@ -1749,7 +1871,7 @@ var circle = new Path.Circle({
|
|
|
1749
1871
|
// Set its stroke color to RGB red:
|
|
1750
1872
|
circle.strokeColor = new Color(1, 0, 0);
|
|
1751
1873
|
</script>
|
|
1752
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1874
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1753
1875
|
</div>
|
|
1754
1876
|
|
|
1755
1877
|
|
|
@@ -1786,7 +1908,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
1786
1908
|
<div class="button run">Run</div>
|
|
1787
1909
|
</div>
|
|
1788
1910
|
|
|
1789
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1911
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
1790
1912
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
1791
1913
|
// with a radius of 35:
|
|
1792
1914
|
var circle = new Path.Circle({
|
|
@@ -1798,7 +1920,7 @@ var circle = new Path.Circle({
|
|
|
1798
1920
|
// Set its stroke width to 10:
|
|
1799
1921
|
circle.strokeWidth = 10;
|
|
1800
1922
|
</script>
|
|
1801
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1923
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
1802
1924
|
</div>
|
|
1803
1925
|
|
|
1804
1926
|
|
|
@@ -1845,7 +1967,7 @@ circle.strokeWidth = 10;
|
|
|
1845
1967
|
<div class="button run">Run</div>
|
|
1846
1968
|
</div>
|
|
1847
1969
|
|
|
1848
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1970
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
1849
1971
|
var line = new Path({
|
|
1850
1972
|
segments: [[80, 50], [420, 50]],
|
|
1851
1973
|
strokeColor: 'black',
|
|
@@ -1866,7 +1988,7 @@ var line2 = line.clone();
|
|
|
1866
1988
|
line2.position.y += 100;
|
|
1867
1989
|
line2.strokeCap = 'butt';
|
|
1868
1990
|
</script>
|
|
1869
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
1991
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-18"></canvas></div>
|
|
1870
1992
|
</div>
|
|
1871
1993
|
|
|
1872
1994
|
|
|
@@ -1913,7 +2035,7 @@ line2.strokeCap = 'butt';
|
|
|
1913
2035
|
<div class="button run">Run</div>
|
|
1914
2036
|
</div>
|
|
1915
2037
|
|
|
1916
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2038
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
1917
2039
|
var path = new Path({
|
|
1918
2040
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
1919
2041
|
strokeColor: 'black',
|
|
@@ -1930,7 +2052,7 @@ var path3 = path2.clone();
|
|
|
1930
2052
|
path3.position.x += path3.bounds.width * 1.5;
|
|
1931
2053
|
path3.strokeJoin = 'bevel';
|
|
1932
2054
|
</script>
|
|
1933
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
2055
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-19"></canvas></div>
|
|
1934
2056
|
</div>
|
|
1935
2057
|
|
|
1936
2058
|
|
|
@@ -2034,7 +2156,7 @@ path3.strokeJoin = 'bevel';
|
|
|
2034
2156
|
<div class="button run">Run</div>
|
|
2035
2157
|
</div>
|
|
2036
2158
|
|
|
2037
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2159
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
2038
2160
|
var path = new Path.Circle({
|
|
2039
2161
|
center: [80, 50],
|
|
2040
2162
|
radius: 40,
|
|
@@ -2045,7 +2167,7 @@ var path = new Path.Circle({
|
|
|
2045
2167
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
2046
2168
|
path.dashArray = [10, 4];
|
|
2047
2169
|
</script>
|
|
2048
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2170
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
2049
2171
|
</div>
|
|
2050
2172
|
|
|
2051
2173
|
|
|
@@ -2080,6 +2202,42 @@ path.dashArray = [10, 4];
|
|
|
2080
2202
|
|
|
2081
2203
|
|
|
2082
2204
|
|
|
2205
|
+
</div>
|
|
2206
|
+
|
|
2207
|
+
</div>
|
|
2208
|
+
</div>
|
|
2209
|
+
|
|
2210
|
+
|
|
2211
|
+
<div id="paintorder" class="member">
|
|
2212
|
+
<div class="member-link">
|
|
2213
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
2214
|
+
</div>
|
|
2215
|
+
<div class="member-description hidden">
|
|
2216
|
+
|
|
2217
|
+
<div class="member-text">
|
|
2218
|
+
<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>
|
|
2219
|
+
|
|
2220
|
+
|
|
2221
|
+
<ul class="member-list">
|
|
2222
|
+
<h4>Values:</h4>
|
|
2223
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
2224
|
+
</ul>
|
|
2225
|
+
|
|
2226
|
+
|
|
2227
|
+
<ul class="member-list">
|
|
2228
|
+
<h4>Default:</h4>
|
|
2229
|
+
<li><tt>'fill'</tt></li>
|
|
2230
|
+
</ul>
|
|
2231
|
+
|
|
2232
|
+
<ul class="member-list">
|
|
2233
|
+
<h4>Type:</h4>
|
|
2234
|
+
<li>
|
|
2235
|
+
<tt>String</tt>
|
|
2236
|
+
</li>
|
|
2237
|
+
</ul>
|
|
2238
|
+
|
|
2239
|
+
|
|
2240
|
+
|
|
2083
2241
|
</div>
|
|
2084
2242
|
|
|
2085
2243
|
</div>
|
|
@@ -2115,7 +2273,7 @@ path.dashArray = [10, 4];
|
|
|
2115
2273
|
<div class="button run">Run</div>
|
|
2116
2274
|
</div>
|
|
2117
2275
|
|
|
2118
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2276
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2119
2277
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2120
2278
|
// with a radius of 35:
|
|
2121
2279
|
var circle = new Path.Circle({
|
|
@@ -2126,7 +2284,7 @@ var circle = new Path.Circle({
|
|
|
2126
2284
|
// Set the fill color of the circle to RGB red:
|
|
2127
2285
|
circle.fillColor = new Color(1, 0, 0);
|
|
2128
2286
|
</script>
|
|
2129
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2287
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2130
2288
|
</div>
|
|
2131
2289
|
|
|
2132
2290
|
|
|
@@ -2201,7 +2359,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
2201
2359
|
<div class="button run">Run</div>
|
|
2202
2360
|
</div>
|
|
2203
2361
|
|
|
2204
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2362
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2205
2363
|
var circle = new Path.Circle({
|
|
2206
2364
|
center: [80, 50],
|
|
2207
2365
|
radius: 35,
|
|
@@ -2214,7 +2372,7 @@ var circle = new Path.Circle({
|
|
|
2214
2372
|
shadowOffset: new Point(5, 5)
|
|
2215
2373
|
});
|
|
2216
2374
|
</script>
|
|
2217
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2375
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2218
2376
|
</div>
|
|
2219
2377
|
|
|
2220
2378
|
|
|
@@ -2355,7 +2513,7 @@ var circle = new Path.Circle({
|
|
|
2355
2513
|
<div class="button run">Run</div>
|
|
2356
2514
|
</div>
|
|
2357
2515
|
|
|
2358
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2516
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2359
2517
|
// Create a rectangle shaped path with its top left point at:
|
|
2360
2518
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
2361
2519
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -2366,7 +2524,7 @@ path.onFrame = function(event) {
|
|
|
2366
2524
|
this.rotate(3);
|
|
2367
2525
|
}
|
|
2368
2526
|
</script>
|
|
2369
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2527
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2370
2528
|
</div>
|
|
2371
2529
|
|
|
2372
2530
|
|
|
@@ -2410,7 +2568,7 @@ path.onFrame = function(event) {
|
|
|
2410
2568
|
<div class="button run">Run</div>
|
|
2411
2569
|
</div>
|
|
2412
2570
|
|
|
2413
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2571
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2414
2572
|
// Create a circle shaped path at the center of the view:
|
|
2415
2573
|
var path = new Path.Circle({
|
|
2416
2574
|
center: view.center,
|
|
@@ -2424,7 +2582,7 @@ path.onMouseDown = function(event) {
|
|
|
2424
2582
|
this.fillColor = 'red';
|
|
2425
2583
|
}
|
|
2426
2584
|
</script>
|
|
2427
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2585
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
2428
2586
|
</div>
|
|
2429
2587
|
|
|
2430
2588
|
|
|
@@ -2436,7 +2594,7 @@ path.onMouseDown = function(event) {
|
|
|
2436
2594
|
<div class="button run">Run</div>
|
|
2437
2595
|
</div>
|
|
2438
2596
|
|
|
2439
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2597
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
2440
2598
|
// Loop 30 times:
|
|
2441
2599
|
for (var i = 0; i < 30; i++) {
|
|
2442
2600
|
// Create a circle shaped path at a random position
|
|
@@ -2454,7 +2612,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2454
2612
|
}
|
|
2455
2613
|
}
|
|
2456
2614
|
</script>
|
|
2457
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2615
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
2458
2616
|
</div>
|
|
2459
2617
|
|
|
2460
2618
|
|
|
@@ -2498,7 +2656,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2498
2656
|
<div class="button run">Run</div>
|
|
2499
2657
|
</div>
|
|
2500
2658
|
|
|
2501
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2659
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
2502
2660
|
// Create a circle shaped path at the center of the view:
|
|
2503
2661
|
var path = new Path.Circle({
|
|
2504
2662
|
center: view.center,
|
|
@@ -2511,7 +2669,7 @@ path.onMouseDrag = function(event) {
|
|
|
2511
2669
|
path.position += event.delta;
|
|
2512
2670
|
}
|
|
2513
2671
|
</script>
|
|
2514
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
2672
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-26"></canvas></div>
|
|
2515
2673
|
</div>
|
|
2516
2674
|
|
|
2517
2675
|
|
|
@@ -2555,7 +2713,7 @@ path.onMouseDrag = function(event) {
|
|
|
2555
2713
|
<div class="button run">Run</div>
|
|
2556
2714
|
</div>
|
|
2557
2715
|
|
|
2558
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2716
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
2559
2717
|
// Create a circle shaped path at the center of the view:
|
|
2560
2718
|
var path = new Path.Circle({
|
|
2561
2719
|
center: view.center,
|
|
@@ -2569,7 +2727,7 @@ path.onMouseUp = function(event) {
|
|
|
2569
2727
|
this.fillColor = 'red';
|
|
2570
2728
|
}
|
|
2571
2729
|
</script>
|
|
2572
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2730
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
2573
2731
|
</div>
|
|
2574
2732
|
|
|
2575
2733
|
|
|
@@ -2613,7 +2771,7 @@ path.onMouseUp = function(event) {
|
|
|
2613
2771
|
<div class="button run">Run</div>
|
|
2614
2772
|
</div>
|
|
2615
2773
|
|
|
2616
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2774
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
2617
2775
|
// Create a circle shaped path at the center of the view:
|
|
2618
2776
|
var path = new Path.Circle({
|
|
2619
2777
|
center: view.center,
|
|
@@ -2627,7 +2785,7 @@ path.onClick = function(event) {
|
|
|
2627
2785
|
this.fillColor = 'red';
|
|
2628
2786
|
}
|
|
2629
2787
|
</script>
|
|
2630
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2788
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
2631
2789
|
</div>
|
|
2632
2790
|
|
|
2633
2791
|
|
|
@@ -2639,7 +2797,7 @@ path.onClick = function(event) {
|
|
|
2639
2797
|
<div class="button run">Run</div>
|
|
2640
2798
|
</div>
|
|
2641
2799
|
|
|
2642
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2800
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
2643
2801
|
// Loop 30 times:
|
|
2644
2802
|
for (var i = 0; i < 30; i++) {
|
|
2645
2803
|
// Create a circle shaped path at a random position
|
|
@@ -2657,7 +2815,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2657
2815
|
}
|
|
2658
2816
|
}
|
|
2659
2817
|
</script>
|
|
2660
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2818
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
2661
2819
|
</div>
|
|
2662
2820
|
|
|
2663
2821
|
|
|
@@ -2701,7 +2859,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2701
2859
|
<div class="button run">Run</div>
|
|
2702
2860
|
</div>
|
|
2703
2861
|
|
|
2704
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2862
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
2705
2863
|
// Create a circle shaped path at the center of the view:
|
|
2706
2864
|
var path = new Path.Circle({
|
|
2707
2865
|
center: view.center,
|
|
@@ -2715,7 +2873,7 @@ path.onDoubleClick = function(event) {
|
|
|
2715
2873
|
this.fillColor = 'red';
|
|
2716
2874
|
}
|
|
2717
2875
|
</script>
|
|
2718
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2876
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
2719
2877
|
</div>
|
|
2720
2878
|
|
|
2721
2879
|
|
|
@@ -2727,7 +2885,7 @@ path.onDoubleClick = function(event) {
|
|
|
2727
2885
|
<div class="button run">Run</div>
|
|
2728
2886
|
</div>
|
|
2729
2887
|
|
|
2730
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2888
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
2731
2889
|
// Loop 30 times:
|
|
2732
2890
|
for (var i = 0; i < 30; i++) {
|
|
2733
2891
|
// Create a circle shaped path at a random position
|
|
@@ -2745,7 +2903,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2745
2903
|
}
|
|
2746
2904
|
}
|
|
2747
2905
|
</script>
|
|
2748
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2906
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
2749
2907
|
</div>
|
|
2750
2908
|
|
|
2751
2909
|
|
|
@@ -2789,7 +2947,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
2789
2947
|
<div class="button run">Run</div>
|
|
2790
2948
|
</div>
|
|
2791
2949
|
|
|
2792
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2950
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
2793
2951
|
// Create a circle shaped path at the center of the view:
|
|
2794
2952
|
var path = new Path.Circle({
|
|
2795
2953
|
center: view.center,
|
|
@@ -2797,180 +2955,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
2797
2955
|
fillColor: 'black'
|
|
2798
2956
|
});
|
|
2799
2957
|
|
|
2800
|
-
// When the mouse moves on top of the item, set its opacity
|
|
2801
|
-
// to a random value between 0 and 1:
|
|
2802
|
-
path.onMouseMove = function(event) {
|
|
2803
|
-
this.opacity = Math.random();
|
|
2804
|
-
}
|
|
2805
|
-
</script>
|
|
2806
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2807
|
-
</div>
|
|
2958
|
+
// When the mouse moves on top of the item, set its opacity
|
|
2959
|
+
// to a random value between 0 and 1:
|
|
2960
|
+
path.onMouseMove = function(event) {
|
|
2961
|
+
this.opacity = Math.random();
|
|
2962
|
+
}
|
|
2963
|
+
</script>
|
|
2964
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2965
|
+
</div>
|
|
2966
|
+
|
|
2967
|
+
|
|
2968
|
+
</div>
|
|
2969
|
+
|
|
2970
|
+
</div>
|
|
2971
|
+
</div>
|
|
2972
|
+
|
|
2973
|
+
|
|
2974
|
+
<div id="onmouseenter" class="member">
|
|
2975
|
+
<div class="member-link">
|
|
2976
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
2977
|
+
</div>
|
|
2978
|
+
<div class="member-description hidden">
|
|
2979
|
+
|
|
2980
|
+
<div class="member-text">
|
|
2981
|
+
<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>
|
|
2982
|
+
|
|
2983
|
+
|
|
2984
|
+
|
|
2985
|
+
<ul class="member-list">
|
|
2986
|
+
<h4>Type:</h4>
|
|
2987
|
+
<li>
|
|
2988
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
2989
|
+
</li>
|
|
2990
|
+
</ul>
|
|
2991
|
+
|
|
2992
|
+
|
|
2993
|
+
<ul class="member-list">
|
|
2994
|
+
<h4>See also:</h4>
|
|
2995
|
+
|
|
2996
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
2997
|
+
|
|
2998
|
+
</ul>
|
|
2999
|
+
|
|
3000
|
+
<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>
|
|
3001
|
+
|
|
3002
|
+
<div class="paperscript split">
|
|
3003
|
+
|
|
3004
|
+
<div class="buttons">
|
|
3005
|
+
<div class="button run">Run</div>
|
|
3006
|
+
</div>
|
|
3007
|
+
|
|
3008
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
3009
|
+
// Create a circle shaped path at the center of the view:
|
|
3010
|
+
var path = new Path.Circle({
|
|
3011
|
+
center: view.center,
|
|
3012
|
+
radius: 25,
|
|
3013
|
+
fillColor: 'black'
|
|
3014
|
+
});
|
|
3015
|
+
|
|
3016
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3017
|
+
path.onMouseEnter = function(event) {
|
|
3018
|
+
this.fillColor = 'red';
|
|
3019
|
+
}
|
|
3020
|
+
|
|
3021
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3022
|
+
path.onMouseLeave = function(event) {
|
|
3023
|
+
this.fillColor = 'black';
|
|
3024
|
+
}
|
|
3025
|
+
</script>
|
|
3026
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
3027
|
+
</div>
|
|
3028
|
+
|
|
3029
|
+
|
|
3030
|
+
<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>
|
|
3031
|
+
|
|
3032
|
+
<div class="paperscript split">
|
|
3033
|
+
|
|
3034
|
+
<div class="buttons">
|
|
3035
|
+
<div class="button run">Run</div>
|
|
3036
|
+
</div>
|
|
3037
|
+
|
|
3038
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
3039
|
+
function enter(event) {
|
|
3040
|
+
this.fillColor = 'red';
|
|
3041
|
+
}
|
|
3042
|
+
|
|
3043
|
+
function leave(event) {
|
|
3044
|
+
this.fillColor = 'black';
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
// When the mouse is pressed:
|
|
3048
|
+
function onMouseDown(event) {
|
|
3049
|
+
// Create a circle shaped path at the position of the mouse:
|
|
3050
|
+
var path = new Path.Circle(event.point, 25);
|
|
3051
|
+
path.fillColor = 'black';
|
|
3052
|
+
|
|
3053
|
+
// When the mouse enters the item, set its fill color to red:
|
|
3054
|
+
path.onMouseEnter = enter;
|
|
3055
|
+
|
|
3056
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
3057
|
+
path.onMouseLeave = leave;
|
|
3058
|
+
}
|
|
3059
|
+
</script>
|
|
3060
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3061
|
+
</div>
|
|
3062
|
+
|
|
3063
|
+
|
|
3064
|
+
</div>
|
|
3065
|
+
|
|
3066
|
+
</div>
|
|
3067
|
+
</div>
|
|
3068
|
+
|
|
3069
|
+
|
|
3070
|
+
<div id="onmouseleave" class="member">
|
|
3071
|
+
<div class="member-link">
|
|
3072
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
3073
|
+
</div>
|
|
3074
|
+
<div class="member-description hidden">
|
|
3075
|
+
|
|
3076
|
+
<div class="member-text">
|
|
3077
|
+
<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>
|
|
3078
|
+
|
|
3079
|
+
|
|
3080
|
+
|
|
3081
|
+
<ul class="member-list">
|
|
3082
|
+
<h4>Type:</h4>
|
|
3083
|
+
<li>
|
|
3084
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3085
|
+
</li>
|
|
3086
|
+
</ul>
|
|
3087
|
+
|
|
3088
|
+
|
|
3089
|
+
<ul class="member-list">
|
|
3090
|
+
<h4>See also:</h4>
|
|
3091
|
+
|
|
3092
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
3093
|
+
|
|
3094
|
+
</ul>
|
|
3095
|
+
|
|
3096
|
+
<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>
|
|
3097
|
+
|
|
3098
|
+
<div class="paperscript split">
|
|
3099
|
+
|
|
3100
|
+
<div class="buttons">
|
|
3101
|
+
<div class="button run">Run</div>
|
|
3102
|
+
</div>
|
|
3103
|
+
|
|
3104
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
3105
|
+
// Create a circle shaped path at the center of the view:
|
|
3106
|
+
var path = new Path.Circle({
|
|
3107
|
+
center: view.center,
|
|
3108
|
+
radius: 25,
|
|
3109
|
+
fillColor: 'black'
|
|
3110
|
+
});
|
|
3111
|
+
|
|
3112
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
3113
|
+
path.onMouseLeave = function(event) {
|
|
3114
|
+
this.fillColor = 'red';
|
|
3115
|
+
}
|
|
3116
|
+
</script>
|
|
3117
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3118
|
+
</div>
|
|
3119
|
+
|
|
3120
|
+
|
|
3121
|
+
</div>
|
|
3122
|
+
|
|
3123
|
+
</div>
|
|
3124
|
+
</div>
|
|
3125
|
+
|
|
3126
|
+
|
|
3127
|
+
<div id="ondraw" class="member">
|
|
3128
|
+
<div class="member-link">
|
|
3129
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
3130
|
+
</div>
|
|
3131
|
+
<div class="member-description hidden">
|
|
3132
|
+
|
|
3133
|
+
<div class="member-text">
|
|
3134
|
+
<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>
|
|
3135
|
+
|
|
3136
|
+
|
|
3137
|
+
|
|
3138
|
+
<ul class="member-list">
|
|
3139
|
+
<h4>Type:</h4>
|
|
3140
|
+
<li>
|
|
3141
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3142
|
+
</li>
|
|
3143
|
+
</ul>
|
|
3144
|
+
<ul class="member-list">
|
|
3145
|
+
<h4>Options:</h4>
|
|
3146
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
3147
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
3148
|
+
<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>
|
|
3149
|
+
<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>
|
|
3150
|
+
<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>()
|
|
3151
|
+
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>
|
|
3152
|
+
</ul>
|
|
3153
|
+
|
|
3154
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
3155
|
+
|
|
3156
|
+
<div class="paperscript split">
|
|
3157
|
+
|
|
3158
|
+
<div class="buttons">
|
|
3159
|
+
<div class="button run">Run</div>
|
|
3160
|
+
</div>
|
|
3161
|
+
|
|
3162
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3163
|
+
var path = new Path.Circle({
|
|
3164
|
+
center: view.center,
|
|
3165
|
+
radius: 25,
|
|
3166
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
3167
|
+
});
|
|
3168
|
+
|
|
3169
|
+
path.onDraw = function(event) {
|
|
3170
|
+
var ctx = event.context,
|
|
3171
|
+
center = this.position,
|
|
3172
|
+
scale = event.matrix.scaling.x;
|
|
3173
|
+
ctx.beginPath();
|
|
3174
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
3175
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
3176
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
3177
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
3178
|
+
ctx.lineWidth = 1 / scale;
|
|
3179
|
+
ctx.stroke();
|
|
3180
|
+
}
|
|
3181
|
+
</script>
|
|
3182
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3183
|
+
</div>
|
|
3184
|
+
|
|
3185
|
+
|
|
3186
|
+
</div>
|
|
3187
|
+
|
|
3188
|
+
</div>
|
|
3189
|
+
</div>
|
|
3190
|
+
|
|
3191
|
+
|
|
3192
|
+
<div id="ondrawselection" class="member">
|
|
3193
|
+
<div class="member-link">
|
|
3194
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
3195
|
+
</div>
|
|
3196
|
+
<div class="member-description hidden">
|
|
3197
|
+
|
|
3198
|
+
<div class="member-text">
|
|
3199
|
+
<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>
|
|
3200
|
+
|
|
3201
|
+
|
|
3202
|
+
|
|
3203
|
+
<ul class="member-list">
|
|
3204
|
+
<h4>Type:</h4>
|
|
3205
|
+
<li>
|
|
3206
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
3207
|
+
</li>
|
|
3208
|
+
</ul>
|
|
3209
|
+
<ul class="member-list">
|
|
3210
|
+
<h4>Options:</h4>
|
|
3211
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
3212
|
+
<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>
|
|
3213
|
+
<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>
|
|
3214
|
+
<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>
|
|
3215
|
+
<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>
|
|
3216
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
3217
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
3218
|
+
</ul>
|
|
3219
|
+
|
|
3220
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
3221
|
+
|
|
3222
|
+
<div class="paperscript split">
|
|
3223
|
+
|
|
3224
|
+
<div class="buttons">
|
|
3225
|
+
<div class="button run">Run</div>
|
|
3226
|
+
</div>
|
|
3227
|
+
|
|
3228
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3229
|
+
var path = new Path.Star({
|
|
3230
|
+
center: view.center,
|
|
3231
|
+
points: 5,
|
|
3232
|
+
radius1: 20,
|
|
3233
|
+
radius2: 40,
|
|
3234
|
+
strokeColor: 'black',
|
|
3235
|
+
selected: true
|
|
3236
|
+
});
|
|
3237
|
+
|
|
3238
|
+
path.onDrawSelection = function(event) {
|
|
3239
|
+
var ctx = event.context;
|
|
3240
|
+
this.segments.forEach(function(segment) {
|
|
3241
|
+
var point = event.matrix.transform(segment.point);
|
|
3242
|
+
ctx.beginPath();
|
|
3243
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
3244
|
+
ctx.fill();
|
|
3245
|
+
});
|
|
3246
|
+
return false;
|
|
3247
|
+
}
|
|
3248
|
+
</script>
|
|
3249
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3250
|
+
</div>
|
|
3251
|
+
|
|
3252
|
+
|
|
3253
|
+
</div>
|
|
3254
|
+
|
|
3255
|
+
</div>
|
|
3256
|
+
</div>
|
|
3257
|
+
|
|
3258
|
+
</div>
|
|
3259
|
+
|
|
3260
|
+
|
|
3261
|
+
<!-- =========================== inherited methods ========================= -->
|
|
3262
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3263
|
+
|
|
3264
|
+
|
|
3265
|
+
<div id="addeffect-effect" class="member">
|
|
3266
|
+
<div class="member-link">
|
|
3267
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
3268
|
+
</div>
|
|
3269
|
+
<div class="member-description hidden">
|
|
3270
|
+
<div class="member-text">
|
|
3271
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
3272
|
+
|
|
3273
|
+
|
|
3274
|
+
<ul class="member-list">
|
|
3275
|
+
<h4>Parameters:</h4>
|
|
3276
|
+
|
|
3277
|
+
<li>
|
|
3278
|
+
<tt>effect:</tt>
|
|
3279
|
+
<tt>Object</tt>
|
|
3280
|
+
— the plain object describing the effect
|
|
3281
|
+
|
|
3282
|
+
</li>
|
|
3283
|
+
|
|
3284
|
+
</ul>
|
|
3285
|
+
|
|
3286
|
+
|
|
3287
|
+
<ul class="member-list">
|
|
3288
|
+
<h4>Returns:</h4>
|
|
3289
|
+
|
|
3290
|
+
<li>
|
|
3291
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
3292
|
+
</li>
|
|
3293
|
+
|
|
3294
|
+
|
|
3295
|
+
</ul>
|
|
3296
|
+
|
|
3297
|
+
|
|
3298
|
+
|
|
3299
|
+
|
|
3300
|
+
|
|
3301
|
+
</div>
|
|
3302
|
+
</div>
|
|
3303
|
+
</div>
|
|
3304
|
+
|
|
3305
|
+
|
|
3306
|
+
<div id="inserteffect-index-effect" class="member">
|
|
3307
|
+
<div class="member-link">
|
|
3308
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
3309
|
+
</div>
|
|
3310
|
+
<div class="member-description hidden">
|
|
3311
|
+
<div class="member-text">
|
|
3312
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
3313
|
+
|
|
3314
|
+
|
|
3315
|
+
<ul class="member-list">
|
|
3316
|
+
<h4>Parameters:</h4>
|
|
3317
|
+
|
|
3318
|
+
<li>
|
|
3319
|
+
<tt>index:</tt>
|
|
3320
|
+
<tt>Number</tt>
|
|
3321
|
+
— the index at which to insert the effect
|
|
3322
|
+
|
|
3323
|
+
</li>
|
|
3324
|
+
|
|
3325
|
+
<li>
|
|
3326
|
+
<tt>effect:</tt>
|
|
3327
|
+
<tt>Object</tt>
|
|
3328
|
+
— the plain object describing the effect
|
|
3329
|
+
|
|
3330
|
+
</li>
|
|
3331
|
+
|
|
3332
|
+
</ul>
|
|
3333
|
+
|
|
3334
|
+
|
|
3335
|
+
<ul class="member-list">
|
|
3336
|
+
<h4>Returns:</h4>
|
|
3337
|
+
|
|
3338
|
+
<li>
|
|
3339
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
3340
|
+
</li>
|
|
3341
|
+
|
|
3342
|
+
|
|
3343
|
+
</ul>
|
|
3344
|
+
|
|
3345
|
+
|
|
3346
|
+
|
|
3347
|
+
|
|
3348
|
+
|
|
3349
|
+
</div>
|
|
3350
|
+
</div>
|
|
3351
|
+
</div>
|
|
3352
|
+
|
|
3353
|
+
|
|
3354
|
+
<div id="inserteffects-index-effects" class="member">
|
|
3355
|
+
<div class="member-link">
|
|
3356
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
3357
|
+
</div>
|
|
3358
|
+
<div class="member-description hidden">
|
|
3359
|
+
<div class="member-text">
|
|
3360
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
3361
|
+
|
|
3362
|
+
|
|
3363
|
+
<ul class="member-list">
|
|
3364
|
+
<h4>Parameters:</h4>
|
|
3365
|
+
|
|
3366
|
+
<li>
|
|
3367
|
+
<tt>index:</tt>
|
|
3368
|
+
<tt>Number</tt>
|
|
3369
|
+
— the index at which to insert the effects
|
|
3370
|
+
|
|
3371
|
+
</li>
|
|
3372
|
+
|
|
3373
|
+
<li>
|
|
3374
|
+
<tt>effects:</tt>
|
|
3375
|
+
Array of <tt>Object</tt> objects
|
|
3376
|
+
— the plain objects describing the effects
|
|
3377
|
+
|
|
3378
|
+
</li>
|
|
3379
|
+
|
|
3380
|
+
</ul>
|
|
3381
|
+
|
|
3382
|
+
|
|
3383
|
+
<ul class="member-list">
|
|
3384
|
+
<h4>Returns:</h4>
|
|
3385
|
+
|
|
3386
|
+
<li>
|
|
3387
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
3388
|
+
</li>
|
|
3389
|
+
|
|
3390
|
+
|
|
3391
|
+
</ul>
|
|
2808
3392
|
|
|
2809
3393
|
|
|
2810
|
-
</div>
|
|
2811
3394
|
|
|
3395
|
+
|
|
3396
|
+
|
|
3397
|
+
</div>
|
|
2812
3398
|
</div>
|
|
2813
3399
|
</div>
|
|
2814
3400
|
|
|
2815
3401
|
|
|
2816
|
-
<div id="
|
|
3402
|
+
<div id="removeeffect-index" class="member">
|
|
2817
3403
|
<div class="member-link">
|
|
2818
|
-
<a name="
|
|
3404
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
2819
3405
|
</div>
|
|
2820
3406
|
<div class="member-description hidden">
|
|
2821
|
-
|
|
2822
3407
|
<div class="member-text">
|
|
2823
|
-
<p>
|
|
3408
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
3409
|
+
|
|
2824
3410
|
|
|
3411
|
+
<ul class="member-list">
|
|
3412
|
+
<h4>Parameters:</h4>
|
|
2825
3413
|
|
|
3414
|
+
<li>
|
|
3415
|
+
<tt>index:</tt>
|
|
3416
|
+
<tt>Number</tt>
|
|
3417
|
+
— the index of the effect to remove
|
|
3418
|
+
|
|
3419
|
+
</li>
|
|
2826
3420
|
|
|
2827
|
-
|
|
2828
|
-
|
|
2829
|
-
<li>
|
|
2830
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2831
|
-
</li>
|
|
2832
|
-
</ul>
|
|
2833
|
-
|
|
3421
|
+
</ul>
|
|
3422
|
+
|
|
2834
3423
|
|
|
2835
3424
|
<ul class="member-list">
|
|
2836
|
-
<h4>
|
|
3425
|
+
<h4>Returns:</h4>
|
|
2837
3426
|
|
|
2838
|
-
<li
|
|
3427
|
+
<li>
|
|
3428
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
3429
|
+
</li>
|
|
3430
|
+
|
|
2839
3431
|
|
|
2840
3432
|
</ul>
|
|
2841
3433
|
|
|
2842
|
-
<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>
|
|
2843
3434
|
|
|
2844
|
-
<div class="paperscript split">
|
|
2845
3435
|
|
|
2846
|
-
|
|
2847
|
-
|
|
3436
|
+
|
|
3437
|
+
|
|
2848
3438
|
</div>
|
|
2849
|
-
|
|
2850
|
-
<script type="text/paperscript" canvas="canvas-32">
|
|
2851
|
-
// Create a circle shaped path at the center of the view:
|
|
2852
|
-
var path = new Path.Circle({
|
|
2853
|
-
center: view.center,
|
|
2854
|
-
radius: 25,
|
|
2855
|
-
fillColor: 'black'
|
|
2856
|
-
});
|
|
2857
|
-
|
|
2858
|
-
// When the mouse enters the item, set its fill color to red:
|
|
2859
|
-
path.onMouseEnter = function(event) {
|
|
2860
|
-
this.fillColor = 'red';
|
|
2861
|
-
}
|
|
2862
|
-
|
|
2863
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2864
|
-
path.onMouseLeave = function(event) {
|
|
2865
|
-
this.fillColor = 'black';
|
|
2866
|
-
}
|
|
2867
|
-
</script>
|
|
2868
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
2869
3439
|
</div>
|
|
2870
|
-
|
|
2871
|
-
|
|
2872
|
-
<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>
|
|
2873
|
-
|
|
2874
|
-
<div class="paperscript split">
|
|
2875
|
-
|
|
2876
|
-
<div class="buttons">
|
|
2877
|
-
<div class="button run">Run</div>
|
|
2878
3440
|
</div>
|
|
2879
3441
|
|
|
2880
|
-
|
|
2881
|
-
|
|
2882
|
-
|
|
2883
|
-
|
|
2884
|
-
|
|
2885
|
-
|
|
2886
|
-
|
|
2887
|
-
|
|
3442
|
+
|
|
3443
|
+
<div id="removeeffects" class="member">
|
|
3444
|
+
<div class="member-link">
|
|
3445
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
3446
|
+
</div>
|
|
3447
|
+
<div class="member-description hidden">
|
|
3448
|
+
<div class="member-text">
|
|
3449
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
3450
|
+
|
|
3451
|
+
|
|
3452
|
+
<ul class="member-list">
|
|
3453
|
+
<h4>Parameters:</h4>
|
|
3454
|
+
|
|
3455
|
+
<li>
|
|
3456
|
+
<tt>start:</tt>
|
|
3457
|
+
<tt>Number</tt>
|
|
3458
|
+
— the index of the first effect to remove
|
|
3459
|
+
— optional, default: <tt>0</tt>
|
|
3460
|
+
</li>
|
|
3461
|
+
|
|
3462
|
+
<li>
|
|
3463
|
+
<tt>end:</tt>
|
|
3464
|
+
<tt>Number</tt>
|
|
3465
|
+
— the index after the last one
|
|
3466
|
+
— optional, default: <tt>effects.length</tt>
|
|
3467
|
+
</li>
|
|
3468
|
+
|
|
3469
|
+
</ul>
|
|
2888
3470
|
|
|
2889
|
-
|
|
2890
|
-
|
|
2891
|
-
|
|
2892
|
-
|
|
2893
|
-
|
|
3471
|
+
|
|
3472
|
+
<ul class="member-list">
|
|
3473
|
+
<h4>Returns:</h4>
|
|
3474
|
+
|
|
3475
|
+
<li>
|
|
3476
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
3477
|
+
</li>
|
|
2894
3478
|
|
|
2895
|
-
|
|
2896
|
-
|
|
3479
|
+
|
|
3480
|
+
</ul>
|
|
2897
3481
|
|
|
2898
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
2899
|
-
path.onMouseLeave = leave;
|
|
2900
|
-
}
|
|
2901
|
-
</script>
|
|
2902
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
2903
|
-
</div>
|
|
2904
3482
|
|
|
2905
3483
|
|
|
3484
|
+
|
|
3485
|
+
|
|
2906
3486
|
</div>
|
|
2907
|
-
|
|
2908
3487
|
</div>
|
|
2909
3488
|
</div>
|
|
2910
3489
|
|
|
2911
3490
|
|
|
2912
|
-
<div id="
|
|
3491
|
+
<div id="geteffectoutput" class="member">
|
|
2913
3492
|
<div class="member-link">
|
|
2914
|
-
<a name="
|
|
3493
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
2915
3494
|
</div>
|
|
2916
3495
|
<div class="member-description hidden">
|
|
2917
|
-
|
|
2918
3496
|
<div class="member-text">
|
|
2919
|
-
<p>
|
|
2920
|
-
|
|
2921
|
-
|
|
2922
|
-
|
|
2923
|
-
<ul class="member-list">
|
|
2924
|
-
<h4>Type:</h4>
|
|
2925
|
-
<li>
|
|
2926
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
2927
|
-
</li>
|
|
2928
|
-
</ul>
|
|
3497
|
+
<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>
|
|
2929
3498
|
|
|
2930
3499
|
|
|
3500
|
+
|
|
2931
3501
|
<ul class="member-list">
|
|
2932
|
-
<h4>
|
|
3502
|
+
<h4>Returns:</h4>
|
|
2933
3503
|
|
|
2934
|
-
<li
|
|
3504
|
+
<li>
|
|
3505
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
3506
|
+
</li>
|
|
3507
|
+
|
|
2935
3508
|
|
|
2936
3509
|
</ul>
|
|
2937
3510
|
|
|
2938
|
-
<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>
|
|
2939
|
-
|
|
2940
|
-
<div class="paperscript split">
|
|
2941
|
-
|
|
2942
|
-
<div class="buttons">
|
|
2943
|
-
<div class="button run">Run</div>
|
|
2944
|
-
</div>
|
|
2945
|
-
|
|
2946
|
-
<script type="text/paperscript" canvas="canvas-34">
|
|
2947
|
-
// Create a circle shaped path at the center of the view:
|
|
2948
|
-
var path = new Path.Circle({
|
|
2949
|
-
center: view.center,
|
|
2950
|
-
radius: 25,
|
|
2951
|
-
fillColor: 'black'
|
|
2952
|
-
});
|
|
2953
|
-
|
|
2954
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
2955
|
-
path.onMouseLeave = function(event) {
|
|
2956
|
-
this.fillColor = 'red';
|
|
2957
|
-
}
|
|
2958
|
-
</script>
|
|
2959
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2960
|
-
</div>
|
|
2961
|
-
|
|
2962
3511
|
|
|
2963
|
-
</div>
|
|
2964
3512
|
|
|
3513
|
+
|
|
3514
|
+
|
|
2965
3515
|
</div>
|
|
2966
3516
|
</div>
|
|
2967
|
-
|
|
2968
3517
|
</div>
|
|
2969
3518
|
|
|
2970
|
-
|
|
2971
|
-
<!-- =========================== inherited methods ========================= -->
|
|
2972
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
2973
|
-
|
|
2974
3519
|
|
|
2975
3520
|
<div id="set-props" class="member">
|
|
2976
3521
|
<div class="member-link">
|
|
@@ -3015,7 +3560,7 @@ path.onMouseLeave = function(event) {
|
|
|
3015
3560
|
<div class="button run">Run</div>
|
|
3016
3561
|
</div>
|
|
3017
3562
|
|
|
3018
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3563
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3019
3564
|
var circle = new Path.Circle({
|
|
3020
3565
|
center: [80, 50],
|
|
3021
3566
|
radius: 35
|
|
@@ -3028,7 +3573,7 @@ circle.set({
|
|
|
3028
3573
|
selected: true
|
|
3029
3574
|
});
|
|
3030
3575
|
</script>
|
|
3031
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3576
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3032
3577
|
</div>
|
|
3033
3578
|
|
|
3034
3579
|
|
|
@@ -3084,7 +3629,7 @@ circle.set({
|
|
|
3084
3629
|
<div class="button run">Run</div>
|
|
3085
3630
|
</div>
|
|
3086
3631
|
|
|
3087
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3632
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
3088
3633
|
var circle = new Path.Circle({
|
|
3089
3634
|
center: [50, 50],
|
|
3090
3635
|
radius: 10,
|
|
@@ -3099,7 +3644,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3099
3644
|
copy.position.x += i * copy.bounds.width;
|
|
3100
3645
|
}
|
|
3101
3646
|
</script>
|
|
3102
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3647
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
3103
3648
|
</div>
|
|
3104
3649
|
|
|
3105
3650
|
|
|
@@ -3225,7 +3770,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
3225
3770
|
<div class="button run">Run</div>
|
|
3226
3771
|
</div>
|
|
3227
3772
|
|
|
3228
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3773
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
3229
3774
|
var circle = new Path.Circle({
|
|
3230
3775
|
center: [50, 50],
|
|
3231
3776
|
radius: 5,
|
|
@@ -3242,7 +3787,7 @@ raster.position.x += 100;
|
|
|
3242
3787
|
circle.scale(5);
|
|
3243
3788
|
raster.scale(5);
|
|
3244
3789
|
</script>
|
|
3245
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3790
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
3246
3791
|
</div>
|
|
3247
3792
|
|
|
3248
3793
|
|
|
@@ -3296,7 +3841,7 @@ raster.scale(5);
|
|
|
3296
3841
|
<div class="button run">Run</div>
|
|
3297
3842
|
</div>
|
|
3298
3843
|
|
|
3299
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3844
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
3300
3845
|
var path = new Path.Star({
|
|
3301
3846
|
center: [50, 50],
|
|
3302
3847
|
points: 12,
|
|
@@ -3317,7 +3862,7 @@ function onMouseDown(event) {
|
|
|
3317
3862
|
}
|
|
3318
3863
|
}
|
|
3319
3864
|
</script>
|
|
3320
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3865
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
3321
3866
|
</div>
|
|
3322
3867
|
|
|
3323
3868
|
|
|
@@ -3835,11 +4380,17 @@ function onMouseDown(event) {
|
|
|
3835
4380
|
</div>
|
|
3836
4381
|
<div class="member-description hidden">
|
|
3837
4382
|
<div class="member-text">
|
|
3838
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
4383
|
+
<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>
|
|
3839
4384
|
<ul class="member-list">
|
|
3840
4385
|
<h4>Options:</h4>
|
|
3841
|
-
<li
|
|
3842
|
-
|
|
4386
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
4387
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
4388
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
4389
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
4390
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
4391
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
4392
|
+
`paper.view.matrix` is used, for all other settings of
|
|
4393
|
+
`options.bounds` the identity matrix is used.</li>
|
|
3843
4394
|
<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>
|
|
3844
4395
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
3845
4396
|
<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>
|
|
@@ -3847,6 +4398,12 @@ function onMouseDown(event) {
|
|
|
3847
4398
|
<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>
|
|
3848
4399
|
<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>
|
|
3849
4400
|
<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>
|
|
4401
|
+
<li>[options.processNode] {Function} the function to process the
|
|
4402
|
+
SVG node made for each exported item, receiving an object with the
|
|
4403
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
4404
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
4405
|
+
is called before the item's name, style, visibility and data are set
|
|
4406
|
+
on the node, which replace attributes of the same names.</li>
|
|
3850
4407
|
</ul>
|
|
3851
4408
|
|
|
3852
4409
|
<ul class="member-list">
|
|
@@ -3889,6 +4446,7 @@ function onMouseDown(event) {
|
|
|
3889
4446
|
<div class="member-text">
|
|
3890
4447
|
<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>
|
|
3891
4448
|
<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>
|
|
4449
|
+
<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>
|
|
3892
4450
|
<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>
|
|
3893
4451
|
<ul class="member-list">
|
|
3894
4452
|
<h4>Options:</h4>
|
|
@@ -3900,6 +4458,13 @@ function onMouseDown(event) {
|
|
|
3900
4458
|
<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>
|
|
3901
4459
|
<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>
|
|
3902
4460
|
<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>
|
|
4461
|
+
<li>[options.processItem] {Function} the function to process the
|
|
4462
|
+
item made for each imported SVG element, receiving an object with
|
|
4463
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
4464
|
+
doesn't import, or return an item to replace it with. It is called
|
|
4465
|
+
after the element's attributes and data are applied to the item, so
|
|
4466
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
4467
|
+
copy them over from `item` as needed.</li>
|
|
3903
4468
|
</ul>
|
|
3904
4469
|
|
|
3905
4470
|
<ul class="member-list">
|
|
@@ -5179,7 +5744,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
5179
5744
|
<div class="button run">Run</div>
|
|
5180
5745
|
</div>
|
|
5181
5746
|
|
|
5182
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5747
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
5183
5748
|
// Create a rectangle shaped path with its top left
|
|
5184
5749
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
5185
5750
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -5188,7 +5753,7 @@ path.fillColor = 'black';
|
|
|
5188
5753
|
// Rotate the path by 30 degrees:
|
|
5189
5754
|
path.rotate(30);
|
|
5190
5755
|
</script>
|
|
5191
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5756
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
5192
5757
|
</div>
|
|
5193
5758
|
|
|
5194
5759
|
|
|
@@ -5200,7 +5765,7 @@ path.rotate(30);
|
|
|
5200
5765
|
<div class="button run">Run</div>
|
|
5201
5766
|
</div>
|
|
5202
5767
|
|
|
5203
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5768
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
5204
5769
|
// Create a rectangle shaped path with its top left
|
|
5205
5770
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
5206
5771
|
var topLeft = new Point(175, 50);
|
|
@@ -5222,7 +5787,7 @@ function onFrame(event) {
|
|
|
5222
5787
|
path.rotate(3, view.center);
|
|
5223
5788
|
}
|
|
5224
5789
|
</script>
|
|
5225
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5790
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-43"></canvas></div>
|
|
5226
5791
|
</div>
|
|
5227
5792
|
|
|
5228
5793
|
|
|
@@ -5271,7 +5836,7 @@ function onFrame(event) {
|
|
|
5271
5836
|
<div class="button run">Run</div>
|
|
5272
5837
|
</div>
|
|
5273
5838
|
|
|
5274
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5839
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
5275
5840
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5276
5841
|
// with a radius of 20:
|
|
5277
5842
|
var circle = new Path.Circle({
|
|
@@ -5283,7 +5848,7 @@ var circle = new Path.Circle({
|
|
|
5283
5848
|
// Scale the path by 150% from its center point
|
|
5284
5849
|
circle.scale(1.5);
|
|
5285
5850
|
</script>
|
|
5286
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5851
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
5287
5852
|
</div>
|
|
5288
5853
|
|
|
5289
5854
|
|
|
@@ -5295,7 +5860,7 @@ circle.scale(1.5);
|
|
|
5295
5860
|
<div class="button run">Run</div>
|
|
5296
5861
|
</div>
|
|
5297
5862
|
|
|
5298
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5863
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
5299
5864
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5300
5865
|
// with a radius of 20:
|
|
5301
5866
|
var circle = new Path.Circle({
|
|
@@ -5307,7 +5872,7 @@ var circle = new Path.Circle({
|
|
|
5307
5872
|
// Scale the path 150% from its bottom left corner
|
|
5308
5873
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
5309
5874
|
</script>
|
|
5310
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5875
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
5311
5876
|
</div>
|
|
5312
5877
|
|
|
5313
5878
|
|
|
@@ -5363,7 +5928,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
5363
5928
|
<div class="button run">Run</div>
|
|
5364
5929
|
</div>
|
|
5365
5930
|
|
|
5366
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5931
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
5367
5932
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
5368
5933
|
// with a radius of 20:
|
|
5369
5934
|
var circle = new Path.Circle({
|
|
@@ -5375,7 +5940,7 @@ var circle = new Path.Circle({
|
|
|
5375
5940
|
// Scale the path horizontally by 300%
|
|
5376
5941
|
circle.scale(3, 1);
|
|
5377
5942
|
</script>
|
|
5378
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5943
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
5379
5944
|
</div>
|
|
5380
5945
|
|
|
5381
5946
|
|
|
@@ -5813,7 +6378,7 @@ circle.scale(3, 1);
|
|
|
5813
6378
|
<div class="button run">Run</div>
|
|
5814
6379
|
</div>
|
|
5815
6380
|
|
|
5816
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6381
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
5817
6382
|
// Create a rectangle shaped path with its top left corner
|
|
5818
6383
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5819
6384
|
var path = new Path.Rectangle({
|
|
@@ -5834,7 +6399,7 @@ var circlePath = new Path.Circle({
|
|
|
5834
6399
|
// the rectangular path:
|
|
5835
6400
|
circlePath.fitBounds(path.bounds);
|
|
5836
6401
|
</script>
|
|
5837
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6402
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
5838
6403
|
</div>
|
|
5839
6404
|
|
|
5840
6405
|
|
|
@@ -5846,7 +6411,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
5846
6411
|
<div class="button run">Run</div>
|
|
5847
6412
|
</div>
|
|
5848
6413
|
|
|
5849
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6414
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
5850
6415
|
// Create a rectangle shaped path with its top left corner
|
|
5851
6416
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
5852
6417
|
var path = new Path.Rectangle({
|
|
@@ -5867,7 +6432,7 @@ var circlePath = new Path.Circle({
|
|
|
5867
6432
|
// the rectangular path:
|
|
5868
6433
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
5869
6434
|
</script>
|
|
5870
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6435
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
5871
6436
|
</div>
|
|
5872
6437
|
|
|
5873
6438
|
|
|
@@ -5879,7 +6444,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
5879
6444
|
<div class="button run">Run</div>
|
|
5880
6445
|
</div>
|
|
5881
6446
|
|
|
5882
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6447
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
5883
6448
|
var path = new Path.Circle({
|
|
5884
6449
|
center: [80, 50],
|
|
5885
6450
|
radius: 30,
|
|
@@ -5889,7 +6454,7 @@ var path = new Path.Circle({
|
|
|
5889
6454
|
// Fit the path to the bounding rectangle of the view:
|
|
5890
6455
|
path.fitBounds(view.bounds);
|
|
5891
6456
|
</script>
|
|
5892
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6457
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
|
|
5893
6458
|
</div>
|
|
5894
6459
|
|
|
5895
6460
|
|
|
@@ -5915,7 +6480,7 @@ path.fitBounds(view.bounds);
|
|
|
5915
6480
|
<li>
|
|
5916
6481
|
<tt>type:</tt>
|
|
5917
6482
|
<tt>String</tt>
|
|
5918
|
-
— 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>
|
|
6483
|
+
— 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>
|
|
5919
6484
|
|
|
5920
6485
|
</li>
|
|
5921
6486
|
|
|
@@ -5950,7 +6515,7 @@ path.fitBounds(view.bounds);
|
|
|
5950
6515
|
<div class="button run">Run</div>
|
|
5951
6516
|
</div>
|
|
5952
6517
|
|
|
5953
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6518
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
5954
6519
|
// Create a circle shaped path at the center of the view:
|
|
5955
6520
|
var path = new Path.Circle({
|
|
5956
6521
|
center: view.center,
|
|
@@ -5968,7 +6533,7 @@ path.on('mouseleave', function() {
|
|
|
5968
6533
|
this.fillColor = 'black';
|
|
5969
6534
|
});
|
|
5970
6535
|
</script>
|
|
5971
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6536
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
5972
6537
|
</div>
|
|
5973
6538
|
|
|
5974
6539
|
|
|
@@ -5992,7 +6557,7 @@ path.on('mouseleave', function() {
|
|
|
5992
6557
|
<li>
|
|
5993
6558
|
<tt>object:</tt>
|
|
5994
6559
|
<tt>Object</tt>
|
|
5995
|
-
— 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>
|
|
6560
|
+
— 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>
|
|
5996
6561
|
|
|
5997
6562
|
</li>
|
|
5998
6563
|
|
|
@@ -6020,7 +6585,7 @@ path.on('mouseleave', function() {
|
|
|
6020
6585
|
<div class="button run">Run</div>
|
|
6021
6586
|
</div>
|
|
6022
6587
|
|
|
6023
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6588
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
6024
6589
|
// Create a circle shaped path at the center of the view:
|
|
6025
6590
|
var path = new Path.Circle({
|
|
6026
6591
|
center: view.center,
|
|
@@ -6038,7 +6603,7 @@ path.on({
|
|
|
6038
6603
|
}
|
|
6039
6604
|
});
|
|
6040
6605
|
</script>
|
|
6041
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6606
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6042
6607
|
</div>
|
|
6043
6608
|
|
|
6044
6609
|
|
|
@@ -6050,7 +6615,7 @@ path.on({
|
|
|
6050
6615
|
<div class="button run">Run</div>
|
|
6051
6616
|
</div>
|
|
6052
6617
|
|
|
6053
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6618
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6054
6619
|
var pathHandlers = {
|
|
6055
6620
|
mouseenter: function(event) {
|
|
6056
6621
|
this.fillColor = 'red';
|
|
@@ -6073,7 +6638,7 @@ function onMouseDown(event) {
|
|
|
6073
6638
|
path.on(pathHandlers);
|
|
6074
6639
|
}
|
|
6075
6640
|
</script>
|
|
6076
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6641
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6077
6642
|
</div>
|
|
6078
6643
|
|
|
6079
6644
|
|
|
@@ -6097,7 +6662,7 @@ function onMouseDown(event) {
|
|
|
6097
6662
|
<li>
|
|
6098
6663
|
<tt>type:</tt>
|
|
6099
6664
|
<tt>String</tt>
|
|
6100
|
-
— 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>
|
|
6665
|
+
— 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>
|
|
6101
6666
|
|
|
6102
6667
|
</li>
|
|
6103
6668
|
|
|
@@ -6145,7 +6710,7 @@ function onMouseDown(event) {
|
|
|
6145
6710
|
<li>
|
|
6146
6711
|
<tt>object:</tt>
|
|
6147
6712
|
<tt>Object</tt>
|
|
6148
|
-
— 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>
|
|
6713
|
+
— 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>
|
|
6149
6714
|
|
|
6150
6715
|
</li>
|
|
6151
6716
|
|
|
@@ -6186,7 +6751,7 @@ function onMouseDown(event) {
|
|
|
6186
6751
|
<li>
|
|
6187
6752
|
<tt>type:</tt>
|
|
6188
6753
|
<tt>String</tt>
|
|
6189
|
-
— 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>
|
|
6754
|
+
— 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>
|
|
6190
6755
|
|
|
6191
6756
|
</li>
|
|
6192
6757
|
|
|
@@ -6234,7 +6799,7 @@ function onMouseDown(event) {
|
|
|
6234
6799
|
<li>
|
|
6235
6800
|
<tt>type:</tt>
|
|
6236
6801
|
<tt>String</tt>
|
|
6237
|
-
— 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>
|
|
6802
|
+
— 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>
|
|
6238
6803
|
|
|
6239
6804
|
</li>
|
|
6240
6805
|
|
|
@@ -6301,7 +6866,7 @@ function onMouseDown(event) {
|
|
|
6301
6866
|
<div class="button run">Run</div>
|
|
6302
6867
|
</div>
|
|
6303
6868
|
|
|
6304
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6869
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6305
6870
|
function onMouseDrag(event) {
|
|
6306
6871
|
// Create a circle shaped path at the mouse position,
|
|
6307
6872
|
// with a radius of 10:
|
|
@@ -6318,7 +6883,7 @@ function onMouseDrag(event) {
|
|
|
6318
6883
|
});
|
|
6319
6884
|
}
|
|
6320
6885
|
</script>
|
|
6321
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6886
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-53"></canvas></div>
|
|
6322
6887
|
</div>
|
|
6323
6888
|
|
|
6324
6889
|
|
|
@@ -6348,7 +6913,7 @@ function onMouseDrag(event) {
|
|
|
6348
6913
|
<div class="button run">Run</div>
|
|
6349
6914
|
</div>
|
|
6350
6915
|
|
|
6351
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6916
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6352
6917
|
function onMouseMove(event) {
|
|
6353
6918
|
// Create a circle shaped path at the mouse position,
|
|
6354
6919
|
// with a radius of 10:
|
|
@@ -6362,7 +6927,7 @@ function onMouseMove(event) {
|
|
|
6362
6927
|
path.removeOnMove();
|
|
6363
6928
|
}
|
|
6364
6929
|
</script>
|
|
6365
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6930
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-54"></canvas></div>
|
|
6366
6931
|
</div>
|
|
6367
6932
|
|
|
6368
6933
|
|
|
@@ -6392,7 +6957,7 @@ function onMouseMove(event) {
|
|
|
6392
6957
|
<div class="button run">Run</div>
|
|
6393
6958
|
</div>
|
|
6394
6959
|
|
|
6395
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6960
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6396
6961
|
function onMouseDown(event) {
|
|
6397
6962
|
// Create a circle shaped path at the mouse position,
|
|
6398
6963
|
// with a radius of 10:
|
|
@@ -6406,7 +6971,7 @@ function onMouseDown(event) {
|
|
|
6406
6971
|
path.removeOnDown();
|
|
6407
6972
|
}
|
|
6408
6973
|
</script>
|
|
6409
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6974
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
6410
6975
|
</div>
|
|
6411
6976
|
|
|
6412
6977
|
|
|
@@ -6436,7 +7001,7 @@ function onMouseDown(event) {
|
|
|
6436
7001
|
<div class="button run">Run</div>
|
|
6437
7002
|
</div>
|
|
6438
7003
|
|
|
6439
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7004
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
6440
7005
|
function onMouseDrag(event) {
|
|
6441
7006
|
// Create a circle shaped path at the mouse position,
|
|
6442
7007
|
// with a radius of 10:
|
|
@@ -6450,7 +7015,7 @@ function onMouseDrag(event) {
|
|
|
6450
7015
|
path.removeOnDrag();
|
|
6451
7016
|
}
|
|
6452
7017
|
</script>
|
|
6453
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7018
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-56"></canvas></div>
|
|
6454
7019
|
</div>
|
|
6455
7020
|
|
|
6456
7021
|
|
|
@@ -6480,7 +7045,7 @@ function onMouseDrag(event) {
|
|
|
6480
7045
|
<div class="button run">Run</div>
|
|
6481
7046
|
</div>
|
|
6482
7047
|
|
|
6483
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7048
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
6484
7049
|
function onMouseDown(event) {
|
|
6485
7050
|
// Create a circle shaped path at the mouse position,
|
|
6486
7051
|
// with a radius of 10:
|
|
@@ -6494,7 +7059,7 @@ function onMouseDown(event) {
|
|
|
6494
7059
|
path.removeOnUp();
|
|
6495
7060
|
}
|
|
6496
7061
|
</script>
|
|
6497
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7062
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-57"></canvas></div>
|
|
6498
7063
|
</div>
|
|
6499
7064
|
|
|
6500
7065
|
|
|
@@ -6567,7 +7132,7 @@ function onMouseDown(event) {
|
|
|
6567
7132
|
<div class="button run">Run</div>
|
|
6568
7133
|
</div>
|
|
6569
7134
|
|
|
6570
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7135
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
6571
7136
|
var path = new Path.Circle({
|
|
6572
7137
|
radius: view.bounds.height * 0.4,
|
|
6573
7138
|
center: view.center
|
|
@@ -6578,7 +7143,7 @@ path.tween(
|
|
|
6578
7143
|
3000
|
|
6579
7144
|
);
|
|
6580
7145
|
</script>
|
|
6581
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7146
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
6582
7147
|
</div>
|
|
6583
7148
|
|
|
6584
7149
|
|
|
@@ -6590,7 +7155,7 @@ path.tween(
|
|
|
6590
7155
|
<div class="button run">Run</div>
|
|
6591
7156
|
</div>
|
|
6592
7157
|
|
|
6593
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7158
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
6594
7159
|
var path = new Shape.Rectangle({
|
|
6595
7160
|
fillColor: 'red',
|
|
6596
7161
|
center: [50, view.center.y],
|
|
@@ -6605,7 +7170,7 @@ path.tween({
|
|
|
6605
7170
|
duration: 2000
|
|
6606
7171
|
});
|
|
6607
7172
|
</script>
|
|
6608
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7173
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
6609
7174
|
</div>
|
|
6610
7175
|
|
|
6611
7176
|
|
|
@@ -6671,7 +7236,7 @@ path.tween({
|
|
|
6671
7236
|
<div class="button run">Run</div>
|
|
6672
7237
|
</div>
|
|
6673
7238
|
|
|
6674
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7239
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
6675
7240
|
var path = new Path.Rectangle({
|
|
6676
7241
|
size: [100, 100],
|
|
6677
7242
|
position: view.center,
|
|
@@ -6685,7 +7250,7 @@ path.tween({
|
|
|
6685
7250
|
'segments[2].point.x': '-= 50'
|
|
6686
7251
|
}, 3000);
|
|
6687
7252
|
</script>
|
|
6688
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7253
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
|
|
6689
7254
|
</div>
|
|
6690
7255
|
|
|
6691
7256
|
|
|
@@ -6744,7 +7309,7 @@ path.tween({
|
|
|
6744
7309
|
<div class="button run">Run</div>
|
|
6745
7310
|
</div>
|
|
6746
7311
|
|
|
6747
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7312
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
6748
7313
|
var path = new Path.Circle({
|
|
6749
7314
|
fillColor: 'blue',
|
|
6750
7315
|
radius: view.bounds.height * 0.4,
|
|
@@ -6760,7 +7325,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6760
7325
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
6761
7326
|
};
|
|
6762
7327
|
</script>
|
|
6763
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7328
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
6764
7329
|
</div>
|
|
6765
7330
|
|
|
6766
7331
|
|
|
@@ -6881,7 +7446,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
6881
7446
|
<div class="button run">Run</div>
|
|
6882
7447
|
</div>
|
|
6883
7448
|
|
|
6884
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7449
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
6885
7450
|
var path = new Path.Circle({
|
|
6886
7451
|
fillColor: 'blue',
|
|
6887
7452
|
radius: view.bounds.height * 0.4,
|
|
@@ -6889,7 +7454,7 @@ var path = new Path.Circle({
|
|
|
6889
7454
|
});
|
|
6890
7455
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
6891
7456
|
</script>
|
|
6892
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7457
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
6893
7458
|
</div>
|
|
6894
7459
|
|
|
6895
7460
|
|
|
@@ -6903,7 +7468,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
6903
7468
|
|
|
6904
7469
|
<!-- =========================== copyright notice ========================== -->
|
|
6905
7470
|
<p class="footer">
|
|
6906
|
-
Paper.js v0.
|
|
7471
|
+
Paper.js v0.17.0<br>
|
|
6907
7472
|
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>
|
|
6908
7473
|
<div class="content-end"></div>
|
|
6909
7474
|
|