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
|
@@ -1270,6 +1270,91 @@ raster.on('load', function() {
|
|
|
1270
1270
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
1271
1271
|
|
|
1272
1272
|
|
|
1273
|
+
<div id="effects" class="member">
|
|
1274
|
+
<div class="member-link">
|
|
1275
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
1276
|
+
</div>
|
|
1277
|
+
<div class="member-description hidden">
|
|
1278
|
+
|
|
1279
|
+
<div class="member-text">
|
|
1280
|
+
<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,
|
|
1281
|
+
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>
|
|
1282
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
1283
|
+
<ul>
|
|
1284
|
+
<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>
|
|
1285
|
+
<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>
|
|
1286
|
+
</ul>
|
|
1287
|
+
|
|
1288
|
+
|
|
1289
|
+
|
|
1290
|
+
<ul class="member-list">
|
|
1291
|
+
<h4>Type:</h4>
|
|
1292
|
+
<li>
|
|
1293
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
1294
|
+
</li>
|
|
1295
|
+
</ul>
|
|
1296
|
+
|
|
1297
|
+
|
|
1298
|
+
<h4>Example:</h4>
|
|
1299
|
+
|
|
1300
|
+
<div class="paperscript split">
|
|
1301
|
+
|
|
1302
|
+
<div class="buttons">
|
|
1303
|
+
<div class="button run">Run</div>
|
|
1304
|
+
</div>
|
|
1305
|
+
|
|
1306
|
+
<script type="text/paperscript" canvas="canvas-7">
|
|
1307
|
+
var path = new Path.Star({
|
|
1308
|
+
center: view.center,
|
|
1309
|
+
points: 5,
|
|
1310
|
+
radius1: 20,
|
|
1311
|
+
radius2: 40,
|
|
1312
|
+
strokeColor: 'black',
|
|
1313
|
+
strokeWidth: 8
|
|
1314
|
+
});
|
|
1315
|
+
path.effects = [
|
|
1316
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
1317
|
+
{ type: 'outline' }
|
|
1318
|
+
];
|
|
1319
|
+
</script>
|
|
1320
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-7"></canvas></div>
|
|
1321
|
+
</div>
|
|
1322
|
+
|
|
1323
|
+
|
|
1324
|
+
</div>
|
|
1325
|
+
|
|
1326
|
+
</div>
|
|
1327
|
+
</div>
|
|
1328
|
+
|
|
1329
|
+
|
|
1330
|
+
<div id="previewbounds-matrix" class="member">
|
|
1331
|
+
<div class="member-link">
|
|
1332
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
1333
|
+
</div>
|
|
1334
|
+
<div class="member-description hidden">
|
|
1335
|
+
|
|
1336
|
+
<div class="member-text">
|
|
1337
|
+
<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>
|
|
1338
|
+
|
|
1339
|
+
<p>Read only.</p>
|
|
1340
|
+
|
|
1341
|
+
|
|
1342
|
+
|
|
1343
|
+
<ul class="member-list">
|
|
1344
|
+
<h4>Type:</h4>
|
|
1345
|
+
<li>
|
|
1346
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
1347
|
+
</li>
|
|
1348
|
+
</ul>
|
|
1349
|
+
|
|
1350
|
+
|
|
1351
|
+
|
|
1352
|
+
</div>
|
|
1353
|
+
|
|
1354
|
+
</div>
|
|
1355
|
+
</div>
|
|
1356
|
+
|
|
1357
|
+
|
|
1273
1358
|
<div id="key" class="member">
|
|
1274
1359
|
<div class="member-link">
|
|
1275
1360
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -1382,7 +1467,7 @@ raster.on('load', function() {
|
|
|
1382
1467
|
<div class="button run">Run</div>
|
|
1383
1468
|
</div>
|
|
1384
1469
|
|
|
1385
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1470
|
+
<script type="text/paperscript" canvas="canvas-8">
|
|
1386
1471
|
var path = new Path.Circle({
|
|
1387
1472
|
center: [80, 50],
|
|
1388
1473
|
radius: 35
|
|
@@ -1397,7 +1482,7 @@ group.addChild(path);
|
|
|
1397
1482
|
// The path can be accessed by name:
|
|
1398
1483
|
group.children['example'].fillColor = 'red';
|
|
1399
1484
|
</script>
|
|
1400
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1485
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-8"></canvas></div>
|
|
1401
1486
|
</div>
|
|
1402
1487
|
|
|
1403
1488
|
|
|
@@ -1435,7 +1520,7 @@ group.children['example'].fillColor = 'red';
|
|
|
1435
1520
|
<div class="button run">Run</div>
|
|
1436
1521
|
</div>
|
|
1437
1522
|
|
|
1438
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1523
|
+
<script type="text/paperscript" canvas="canvas-9">
|
|
1439
1524
|
var circle = new Path.Circle({
|
|
1440
1525
|
center: [80, 50],
|
|
1441
1526
|
radius: 30
|
|
@@ -1446,7 +1531,7 @@ circle.style = {
|
|
|
1446
1531
|
strokeWidth: 5
|
|
1447
1532
|
};
|
|
1448
1533
|
</script>
|
|
1449
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1534
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-9"></canvas></div>
|
|
1450
1535
|
</div>
|
|
1451
1536
|
|
|
1452
1537
|
|
|
@@ -1458,7 +1543,7 @@ circle.style = {
|
|
|
1458
1543
|
<div class="button run">Run</div>
|
|
1459
1544
|
</div>
|
|
1460
1545
|
|
|
1461
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1546
|
+
<script type="text/paperscript" canvas="canvas-10">
|
|
1462
1547
|
var path = new Path.Circle({
|
|
1463
1548
|
center: [50, 50],
|
|
1464
1549
|
radius: 30,
|
|
@@ -1473,7 +1558,7 @@ var path2 = new Path.Circle({
|
|
|
1473
1558
|
// Copy the path style of path:
|
|
1474
1559
|
path2.style = path.style;
|
|
1475
1560
|
</script>
|
|
1476
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1561
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-10"></canvas></div>
|
|
1477
1562
|
</div>
|
|
1478
1563
|
|
|
1479
1564
|
|
|
@@ -1485,7 +1570,7 @@ path2.style = path.style;
|
|
|
1485
1570
|
<div class="button run">Run</div>
|
|
1486
1571
|
</div>
|
|
1487
1572
|
|
|
1488
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1573
|
+
<script type="text/paperscript" canvas="canvas-11">
|
|
1489
1574
|
var myStyle = {
|
|
1490
1575
|
fillColor: 'red',
|
|
1491
1576
|
strokeColor: 'blue',
|
|
@@ -1504,7 +1589,7 @@ var path2 = new Path.Circle({
|
|
|
1504
1589
|
});
|
|
1505
1590
|
path2.style = myStyle;
|
|
1506
1591
|
</script>
|
|
1507
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1592
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-11"></canvas></div>
|
|
1508
1593
|
</div>
|
|
1509
1594
|
|
|
1510
1595
|
|
|
@@ -1546,7 +1631,7 @@ path2.style = myStyle;
|
|
|
1546
1631
|
<div class="button run">Run</div>
|
|
1547
1632
|
</div>
|
|
1548
1633
|
|
|
1549
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1634
|
+
<script type="text/paperscript" canvas="canvas-12">
|
|
1550
1635
|
var unlockedItem = new Path.Circle({
|
|
1551
1636
|
center: view.center - [35, 0],
|
|
1552
1637
|
radius: 30,
|
|
@@ -1573,7 +1658,7 @@ new PointText({
|
|
|
1573
1658
|
justification: 'center'
|
|
1574
1659
|
});
|
|
1575
1660
|
</script>
|
|
1576
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1661
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-12"></canvas></div>
|
|
1577
1662
|
</div>
|
|
1578
1663
|
|
|
1579
1664
|
|
|
@@ -1615,7 +1700,7 @@ new PointText({
|
|
|
1615
1700
|
<div class="button run">Run</div>
|
|
1616
1701
|
</div>
|
|
1617
1702
|
|
|
1618
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1703
|
+
<script type="text/paperscript" canvas="canvas-13">
|
|
1619
1704
|
var path = new Path.Circle({
|
|
1620
1705
|
center: [50, 50],
|
|
1621
1706
|
radius: 20,
|
|
@@ -1625,7 +1710,7 @@ var path = new Path.Circle({
|
|
|
1625
1710
|
// Hide the path:
|
|
1626
1711
|
path.visible = false;
|
|
1627
1712
|
</script>
|
|
1628
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1713
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-13"></canvas></div>
|
|
1629
1714
|
</div>
|
|
1630
1715
|
|
|
1631
1716
|
|
|
@@ -1673,7 +1758,7 @@ path.visible = false;
|
|
|
1673
1758
|
<div class="button run">Run</div>
|
|
1674
1759
|
</div>
|
|
1675
1760
|
|
|
1676
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1761
|
+
<script type="text/paperscript" canvas="canvas-14">
|
|
1677
1762
|
// Create a white rectangle in the background
|
|
1678
1763
|
// with the same dimensions as the view:
|
|
1679
1764
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -1694,7 +1779,7 @@ var circle2 = new Path.Circle({
|
|
|
1694
1779
|
// Set the blend mode of circle2:
|
|
1695
1780
|
circle2.blendMode = 'multiply';
|
|
1696
1781
|
</script>
|
|
1697
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1782
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-14"></canvas></div>
|
|
1698
1783
|
</div>
|
|
1699
1784
|
|
|
1700
1785
|
|
|
@@ -1736,7 +1821,7 @@ circle2.blendMode = 'multiply';
|
|
|
1736
1821
|
<div class="button run">Run</div>
|
|
1737
1822
|
</div>
|
|
1738
1823
|
|
|
1739
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1824
|
+
<script type="text/paperscript" canvas="canvas-15">
|
|
1740
1825
|
var circle = new Path.Circle({
|
|
1741
1826
|
center: [80, 50],
|
|
1742
1827
|
radius: 35,
|
|
@@ -1754,7 +1839,7 @@ var circle2 = new Path.Circle({
|
|
|
1754
1839
|
// Make circle2 50% transparent:
|
|
1755
1840
|
circle2.opacity = 0.5;
|
|
1756
1841
|
</script>
|
|
1757
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1842
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-15"></canvas></div>
|
|
1758
1843
|
</div>
|
|
1759
1844
|
|
|
1760
1845
|
|
|
@@ -1877,14 +1962,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
1877
1962
|
<div class="button run">Run</div>
|
|
1878
1963
|
</div>
|
|
1879
1964
|
|
|
1880
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1965
|
+
<script type="text/paperscript" canvas="canvas-16">
|
|
1881
1966
|
var path = new Path.Circle({
|
|
1882
1967
|
center: [80, 50],
|
|
1883
1968
|
radius: 35
|
|
1884
1969
|
});
|
|
1885
1970
|
path.selected = true; // Select the path
|
|
1886
1971
|
</script>
|
|
1887
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1972
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-16"></canvas></div>
|
|
1888
1973
|
</div>
|
|
1889
1974
|
|
|
1890
1975
|
|
|
@@ -2041,7 +2126,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
2041
2126
|
<div class="button run">Run</div>
|
|
2042
2127
|
</div>
|
|
2043
2128
|
|
|
2044
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2129
|
+
<script type="text/paperscript" canvas="canvas-17">
|
|
2045
2130
|
// Create a circle at position { x: 10, y: 10 }
|
|
2046
2131
|
var circle = new Path.Circle({
|
|
2047
2132
|
center: new Point(10, 10),
|
|
@@ -2055,7 +2140,7 @@ circle.position = new Point(20, 20);
|
|
|
2055
2140
|
// Move the circle 100 points to the right and 50 points down
|
|
2056
2141
|
circle.position += new Point(100, 50);
|
|
2057
2142
|
</script>
|
|
2058
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2143
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-17"></canvas></div>
|
|
2059
2144
|
</div>
|
|
2060
2145
|
|
|
2061
2146
|
|
|
@@ -2067,7 +2152,7 @@ circle.position += new Point(100, 50);
|
|
|
2067
2152
|
<div class="button run">Run</div>
|
|
2068
2153
|
</div>
|
|
2069
2154
|
|
|
2070
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2155
|
+
<script type="text/paperscript" canvas="canvas-18">
|
|
2071
2156
|
// Create a circle at position { x: 20, y: 20 }
|
|
2072
2157
|
var circle = new Path.Circle({
|
|
2073
2158
|
center: new Point(20, 20),
|
|
@@ -2078,7 +2163,7 @@ var circle = new Path.Circle({
|
|
|
2078
2163
|
// Move the circle 100 points to the right
|
|
2079
2164
|
circle.position.x += 100;
|
|
2080
2165
|
</script>
|
|
2081
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2166
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-18"></canvas></div>
|
|
2082
2167
|
</div>
|
|
2083
2168
|
|
|
2084
2169
|
|
|
@@ -2604,7 +2689,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
2604
2689
|
<div class="button run">Run</div>
|
|
2605
2690
|
</div>
|
|
2606
2691
|
|
|
2607
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2692
|
+
<script type="text/paperscript" canvas="canvas-19">
|
|
2608
2693
|
var path = new Path.Circle({
|
|
2609
2694
|
center: [80, 50],
|
|
2610
2695
|
radius: 35
|
|
@@ -2617,7 +2702,7 @@ group.addChild(path);
|
|
|
2617
2702
|
// Access the path through the group's children array:
|
|
2618
2703
|
group.children[0].fillColor = 'red';
|
|
2619
2704
|
</script>
|
|
2620
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2705
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-19"></canvas></div>
|
|
2621
2706
|
</div>
|
|
2622
2707
|
|
|
2623
2708
|
|
|
@@ -2629,7 +2714,7 @@ group.children[0].fillColor = 'red';
|
|
|
2629
2714
|
<div class="button run">Run</div>
|
|
2630
2715
|
</div>
|
|
2631
2716
|
|
|
2632
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2717
|
+
<script type="text/paperscript" canvas="canvas-20">
|
|
2633
2718
|
var path = new Path.Circle({
|
|
2634
2719
|
center: [80, 50],
|
|
2635
2720
|
radius: 35
|
|
@@ -2644,7 +2729,7 @@ group.addChild(path);
|
|
|
2644
2729
|
// The path can be accessed by name:
|
|
2645
2730
|
group.children['example'].fillColor = 'orange';
|
|
2646
2731
|
</script>
|
|
2647
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2732
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-20"></canvas></div>
|
|
2648
2733
|
</div>
|
|
2649
2734
|
|
|
2650
2735
|
|
|
@@ -2656,7 +2741,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
2656
2741
|
<div class="button run">Run</div>
|
|
2657
2742
|
</div>
|
|
2658
2743
|
|
|
2659
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2744
|
+
<script type="text/paperscript" canvas="canvas-21">
|
|
2660
2745
|
var path = new Path.Circle({
|
|
2661
2746
|
center: [80, 50],
|
|
2662
2747
|
radius: 35
|
|
@@ -2668,7 +2753,7 @@ group.children = [path];
|
|
|
2668
2753
|
// The path is the first child of the group:
|
|
2669
2754
|
group.firstChild.fillColor = 'green';
|
|
2670
2755
|
</script>
|
|
2671
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2756
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-21"></canvas></div>
|
|
2672
2757
|
</div>
|
|
2673
2758
|
|
|
2674
2759
|
|
|
@@ -2845,7 +2930,7 @@ group.firstChild.fillColor = 'green';
|
|
|
2845
2930
|
<div class="button run">Run</div>
|
|
2846
2931
|
</div>
|
|
2847
2932
|
|
|
2848
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2933
|
+
<script type="text/paperscript" canvas="canvas-22">
|
|
2849
2934
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2850
2935
|
// with a radius of 35:
|
|
2851
2936
|
var circle = new Path.Circle({
|
|
@@ -2856,7 +2941,7 @@ var circle = new Path.Circle({
|
|
|
2856
2941
|
// Set its stroke color to RGB red:
|
|
2857
2942
|
circle.strokeColor = new Color(1, 0, 0);
|
|
2858
2943
|
</script>
|
|
2859
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2944
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-22"></canvas></div>
|
|
2860
2945
|
</div>
|
|
2861
2946
|
|
|
2862
2947
|
|
|
@@ -2893,7 +2978,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
2893
2978
|
<div class="button run">Run</div>
|
|
2894
2979
|
</div>
|
|
2895
2980
|
|
|
2896
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2981
|
+
<script type="text/paperscript" canvas="canvas-23">
|
|
2897
2982
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2898
2983
|
// with a radius of 35:
|
|
2899
2984
|
var circle = new Path.Circle({
|
|
@@ -2905,7 +2990,7 @@ var circle = new Path.Circle({
|
|
|
2905
2990
|
// Set its stroke width to 10:
|
|
2906
2991
|
circle.strokeWidth = 10;
|
|
2907
2992
|
</script>
|
|
2908
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2993
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-23"></canvas></div>
|
|
2909
2994
|
</div>
|
|
2910
2995
|
|
|
2911
2996
|
|
|
@@ -2952,7 +3037,7 @@ circle.strokeWidth = 10;
|
|
|
2952
3037
|
<div class="button run">Run</div>
|
|
2953
3038
|
</div>
|
|
2954
3039
|
|
|
2955
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3040
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
2956
3041
|
var line = new Path({
|
|
2957
3042
|
segments: [[80, 50], [420, 50]],
|
|
2958
3043
|
strokeColor: 'black',
|
|
@@ -2973,7 +3058,7 @@ var line2 = line.clone();
|
|
|
2973
3058
|
line2.position.y += 100;
|
|
2974
3059
|
line2.strokeCap = 'butt';
|
|
2975
3060
|
</script>
|
|
2976
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
3061
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-24"></canvas></div>
|
|
2977
3062
|
</div>
|
|
2978
3063
|
|
|
2979
3064
|
|
|
@@ -3020,7 +3105,7 @@ line2.strokeCap = 'butt';
|
|
|
3020
3105
|
<div class="button run">Run</div>
|
|
3021
3106
|
</div>
|
|
3022
3107
|
|
|
3023
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3108
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
3024
3109
|
var path = new Path({
|
|
3025
3110
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
3026
3111
|
strokeColor: 'black',
|
|
@@ -3037,7 +3122,7 @@ var path3 = path2.clone();
|
|
|
3037
3122
|
path3.position.x += path3.bounds.width * 1.5;
|
|
3038
3123
|
path3.strokeJoin = 'bevel';
|
|
3039
3124
|
</script>
|
|
3040
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
3125
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-25"></canvas></div>
|
|
3041
3126
|
</div>
|
|
3042
3127
|
|
|
3043
3128
|
|
|
@@ -3141,7 +3226,7 @@ path3.strokeJoin = 'bevel';
|
|
|
3141
3226
|
<div class="button run">Run</div>
|
|
3142
3227
|
</div>
|
|
3143
3228
|
|
|
3144
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3229
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
3145
3230
|
var path = new Path.Circle({
|
|
3146
3231
|
center: [80, 50],
|
|
3147
3232
|
radius: 40,
|
|
@@ -3152,7 +3237,7 @@ var path = new Path.Circle({
|
|
|
3152
3237
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
3153
3238
|
path.dashArray = [10, 4];
|
|
3154
3239
|
</script>
|
|
3155
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3240
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
3156
3241
|
</div>
|
|
3157
3242
|
|
|
3158
3243
|
|
|
@@ -3187,6 +3272,42 @@ path.dashArray = [10, 4];
|
|
|
3187
3272
|
|
|
3188
3273
|
|
|
3189
3274
|
|
|
3275
|
+
</div>
|
|
3276
|
+
|
|
3277
|
+
</div>
|
|
3278
|
+
</div>
|
|
3279
|
+
|
|
3280
|
+
|
|
3281
|
+
<div id="paintorder" class="member">
|
|
3282
|
+
<div class="member-link">
|
|
3283
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
3284
|
+
</div>
|
|
3285
|
+
<div class="member-description hidden">
|
|
3286
|
+
|
|
3287
|
+
<div class="member-text">
|
|
3288
|
+
<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>
|
|
3289
|
+
|
|
3290
|
+
|
|
3291
|
+
<ul class="member-list">
|
|
3292
|
+
<h4>Values:</h4>
|
|
3293
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
3294
|
+
</ul>
|
|
3295
|
+
|
|
3296
|
+
|
|
3297
|
+
<ul class="member-list">
|
|
3298
|
+
<h4>Default:</h4>
|
|
3299
|
+
<li><tt>'fill'</tt></li>
|
|
3300
|
+
</ul>
|
|
3301
|
+
|
|
3302
|
+
<ul class="member-list">
|
|
3303
|
+
<h4>Type:</h4>
|
|
3304
|
+
<li>
|
|
3305
|
+
<tt>String</tt>
|
|
3306
|
+
</li>
|
|
3307
|
+
</ul>
|
|
3308
|
+
|
|
3309
|
+
|
|
3310
|
+
|
|
3190
3311
|
</div>
|
|
3191
3312
|
|
|
3192
3313
|
</div>
|
|
@@ -3222,7 +3343,7 @@ path.dashArray = [10, 4];
|
|
|
3222
3343
|
<div class="button run">Run</div>
|
|
3223
3344
|
</div>
|
|
3224
3345
|
|
|
3225
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3346
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
3226
3347
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
3227
3348
|
// with a radius of 35:
|
|
3228
3349
|
var circle = new Path.Circle({
|
|
@@ -3233,7 +3354,7 @@ var circle = new Path.Circle({
|
|
|
3233
3354
|
// Set the fill color of the circle to RGB red:
|
|
3234
3355
|
circle.fillColor = new Color(1, 0, 0);
|
|
3235
3356
|
</script>
|
|
3236
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3357
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
3237
3358
|
</div>
|
|
3238
3359
|
|
|
3239
3360
|
|
|
@@ -3308,7 +3429,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
3308
3429
|
<div class="button run">Run</div>
|
|
3309
3430
|
</div>
|
|
3310
3431
|
|
|
3311
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3432
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
3312
3433
|
var circle = new Path.Circle({
|
|
3313
3434
|
center: [80, 50],
|
|
3314
3435
|
radius: 35,
|
|
@@ -3321,7 +3442,7 @@ var circle = new Path.Circle({
|
|
|
3321
3442
|
shadowOffset: new Point(5, 5)
|
|
3322
3443
|
});
|
|
3323
3444
|
</script>
|
|
3324
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3445
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
3325
3446
|
</div>
|
|
3326
3447
|
|
|
3327
3448
|
|
|
@@ -3462,7 +3583,7 @@ var circle = new Path.Circle({
|
|
|
3462
3583
|
<div class="button run">Run</div>
|
|
3463
3584
|
</div>
|
|
3464
3585
|
|
|
3465
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3586
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
3466
3587
|
// Create a rectangle shaped path with its top left point at:
|
|
3467
3588
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
3468
3589
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -3473,7 +3594,7 @@ path.onFrame = function(event) {
|
|
|
3473
3594
|
this.rotate(3);
|
|
3474
3595
|
}
|
|
3475
3596
|
</script>
|
|
3476
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3597
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
3477
3598
|
</div>
|
|
3478
3599
|
|
|
3479
3600
|
|
|
@@ -3517,7 +3638,7 @@ path.onFrame = function(event) {
|
|
|
3517
3638
|
<div class="button run">Run</div>
|
|
3518
3639
|
</div>
|
|
3519
3640
|
|
|
3520
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3641
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
3521
3642
|
// Create a circle shaped path at the center of the view:
|
|
3522
3643
|
var path = new Path.Circle({
|
|
3523
3644
|
center: view.center,
|
|
@@ -3531,7 +3652,7 @@ path.onMouseDown = function(event) {
|
|
|
3531
3652
|
this.fillColor = 'red';
|
|
3532
3653
|
}
|
|
3533
3654
|
</script>
|
|
3534
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3655
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
3535
3656
|
</div>
|
|
3536
3657
|
|
|
3537
3658
|
|
|
@@ -3543,7 +3664,7 @@ path.onMouseDown = function(event) {
|
|
|
3543
3664
|
<div class="button run">Run</div>
|
|
3544
3665
|
</div>
|
|
3545
3666
|
|
|
3546
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3667
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
3547
3668
|
// Loop 30 times:
|
|
3548
3669
|
for (var i = 0; i < 30; i++) {
|
|
3549
3670
|
// Create a circle shaped path at a random position
|
|
@@ -3561,7 +3682,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3561
3682
|
}
|
|
3562
3683
|
}
|
|
3563
3684
|
</script>
|
|
3564
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3685
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
3565
3686
|
</div>
|
|
3566
3687
|
|
|
3567
3688
|
|
|
@@ -3605,7 +3726,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3605
3726
|
<div class="button run">Run</div>
|
|
3606
3727
|
</div>
|
|
3607
3728
|
|
|
3608
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3729
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
3609
3730
|
// Create a circle shaped path at the center of the view:
|
|
3610
3731
|
var path = new Path.Circle({
|
|
3611
3732
|
center: view.center,
|
|
@@ -3618,7 +3739,7 @@ path.onMouseDrag = function(event) {
|
|
|
3618
3739
|
path.position += event.delta;
|
|
3619
3740
|
}
|
|
3620
3741
|
</script>
|
|
3621
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
3742
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-32"></canvas></div>
|
|
3622
3743
|
</div>
|
|
3623
3744
|
|
|
3624
3745
|
|
|
@@ -3662,7 +3783,7 @@ path.onMouseDrag = function(event) {
|
|
|
3662
3783
|
<div class="button run">Run</div>
|
|
3663
3784
|
</div>
|
|
3664
3785
|
|
|
3665
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3786
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
3666
3787
|
// Create a circle shaped path at the center of the view:
|
|
3667
3788
|
var path = new Path.Circle({
|
|
3668
3789
|
center: view.center,
|
|
@@ -3676,7 +3797,7 @@ path.onMouseUp = function(event) {
|
|
|
3676
3797
|
this.fillColor = 'red';
|
|
3677
3798
|
}
|
|
3678
3799
|
</script>
|
|
3679
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3800
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
3680
3801
|
</div>
|
|
3681
3802
|
|
|
3682
3803
|
|
|
@@ -3720,7 +3841,7 @@ path.onMouseUp = function(event) {
|
|
|
3720
3841
|
<div class="button run">Run</div>
|
|
3721
3842
|
</div>
|
|
3722
3843
|
|
|
3723
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3844
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
3724
3845
|
// Create a circle shaped path at the center of the view:
|
|
3725
3846
|
var path = new Path.Circle({
|
|
3726
3847
|
center: view.center,
|
|
@@ -3734,7 +3855,7 @@ path.onClick = function(event) {
|
|
|
3734
3855
|
this.fillColor = 'red';
|
|
3735
3856
|
}
|
|
3736
3857
|
</script>
|
|
3737
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3858
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
3738
3859
|
</div>
|
|
3739
3860
|
|
|
3740
3861
|
|
|
@@ -3746,7 +3867,7 @@ path.onClick = function(event) {
|
|
|
3746
3867
|
<div class="button run">Run</div>
|
|
3747
3868
|
</div>
|
|
3748
3869
|
|
|
3749
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3870
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
3750
3871
|
// Loop 30 times:
|
|
3751
3872
|
for (var i = 0; i < 30; i++) {
|
|
3752
3873
|
// Create a circle shaped path at a random position
|
|
@@ -3764,7 +3885,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3764
3885
|
}
|
|
3765
3886
|
}
|
|
3766
3887
|
</script>
|
|
3767
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3888
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
3768
3889
|
</div>
|
|
3769
3890
|
|
|
3770
3891
|
|
|
@@ -3808,7 +3929,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3808
3929
|
<div class="button run">Run</div>
|
|
3809
3930
|
</div>
|
|
3810
3931
|
|
|
3811
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3932
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
3812
3933
|
// Create a circle shaped path at the center of the view:
|
|
3813
3934
|
var path = new Path.Circle({
|
|
3814
3935
|
center: view.center,
|
|
@@ -3822,7 +3943,7 @@ path.onDoubleClick = function(event) {
|
|
|
3822
3943
|
this.fillColor = 'red';
|
|
3823
3944
|
}
|
|
3824
3945
|
</script>
|
|
3825
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3946
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
3826
3947
|
</div>
|
|
3827
3948
|
|
|
3828
3949
|
|
|
@@ -3834,7 +3955,7 @@ path.onDoubleClick = function(event) {
|
|
|
3834
3955
|
<div class="button run">Run</div>
|
|
3835
3956
|
</div>
|
|
3836
3957
|
|
|
3837
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3958
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
3838
3959
|
// Loop 30 times:
|
|
3839
3960
|
for (var i = 0; i < 30; i++) {
|
|
3840
3961
|
// Create a circle shaped path at a random position
|
|
@@ -3852,7 +3973,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3852
3973
|
}
|
|
3853
3974
|
}
|
|
3854
3975
|
</script>
|
|
3855
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3976
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
3856
3977
|
</div>
|
|
3857
3978
|
|
|
3858
3979
|
|
|
@@ -3896,7 +4017,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
3896
4017
|
<div class="button run">Run</div>
|
|
3897
4018
|
</div>
|
|
3898
4019
|
|
|
3899
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4020
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
3900
4021
|
// Create a circle shaped path at the center of the view:
|
|
3901
4022
|
var path = new Path.Circle({
|
|
3902
4023
|
center: view.center,
|
|
@@ -3904,180 +4025,567 @@ for (var i = 0; i < 30; i++) {
|
|
|
3904
4025
|
fillColor: 'black'
|
|
3905
4026
|
});
|
|
3906
4027
|
|
|
3907
|
-
// When the mouse moves on top of the item, set its opacity
|
|
3908
|
-
// to a random value between 0 and 1:
|
|
3909
|
-
path.onMouseMove = function(event) {
|
|
3910
|
-
this.opacity = Math.random();
|
|
3911
|
-
}
|
|
3912
|
-
</script>
|
|
3913
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3914
|
-
</div>
|
|
4028
|
+
// When the mouse moves on top of the item, set its opacity
|
|
4029
|
+
// to a random value between 0 and 1:
|
|
4030
|
+
path.onMouseMove = function(event) {
|
|
4031
|
+
this.opacity = Math.random();
|
|
4032
|
+
}
|
|
4033
|
+
</script>
|
|
4034
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
4035
|
+
</div>
|
|
4036
|
+
|
|
4037
|
+
|
|
4038
|
+
</div>
|
|
4039
|
+
|
|
4040
|
+
</div>
|
|
4041
|
+
</div>
|
|
4042
|
+
|
|
4043
|
+
|
|
4044
|
+
<div id="onmouseenter" class="member">
|
|
4045
|
+
<div class="member-link">
|
|
4046
|
+
<a name="onmouseenter" href="#onmouseenter"><tt><b>onMouseEnter</b></tt></a>
|
|
4047
|
+
</div>
|
|
4048
|
+
<div class="member-description hidden">
|
|
4049
|
+
|
|
4050
|
+
<div class="member-text">
|
|
4051
|
+
<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>
|
|
4052
|
+
|
|
4053
|
+
|
|
4054
|
+
|
|
4055
|
+
<ul class="member-list">
|
|
4056
|
+
<h4>Type:</h4>
|
|
4057
|
+
<li>
|
|
4058
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
4059
|
+
</li>
|
|
4060
|
+
</ul>
|
|
4061
|
+
|
|
4062
|
+
|
|
4063
|
+
<ul class="member-list">
|
|
4064
|
+
<h4>See also:</h4>
|
|
4065
|
+
|
|
4066
|
+
<li><tt><a href="../classes/View.html#onmouseenter"><tt>view.onMouseEnter</tt></a></tt></li>
|
|
4067
|
+
|
|
4068
|
+
</ul>
|
|
4069
|
+
|
|
4070
|
+
<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>
|
|
4071
|
+
|
|
4072
|
+
<div class="paperscript split">
|
|
4073
|
+
|
|
4074
|
+
<div class="buttons">
|
|
4075
|
+
<div class="button run">Run</div>
|
|
4076
|
+
</div>
|
|
4077
|
+
|
|
4078
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
4079
|
+
// Create a circle shaped path at the center of the view:
|
|
4080
|
+
var path = new Path.Circle({
|
|
4081
|
+
center: view.center,
|
|
4082
|
+
radius: 25,
|
|
4083
|
+
fillColor: 'black'
|
|
4084
|
+
});
|
|
4085
|
+
|
|
4086
|
+
// When the mouse enters the item, set its fill color to red:
|
|
4087
|
+
path.onMouseEnter = function(event) {
|
|
4088
|
+
this.fillColor = 'red';
|
|
4089
|
+
}
|
|
4090
|
+
|
|
4091
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
4092
|
+
path.onMouseLeave = function(event) {
|
|
4093
|
+
this.fillColor = 'black';
|
|
4094
|
+
}
|
|
4095
|
+
</script>
|
|
4096
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
4097
|
+
</div>
|
|
4098
|
+
|
|
4099
|
+
|
|
4100
|
+
<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>
|
|
4101
|
+
|
|
4102
|
+
<div class="paperscript split">
|
|
4103
|
+
|
|
4104
|
+
<div class="buttons">
|
|
4105
|
+
<div class="button run">Run</div>
|
|
4106
|
+
</div>
|
|
4107
|
+
|
|
4108
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
4109
|
+
function enter(event) {
|
|
4110
|
+
this.fillColor = 'red';
|
|
4111
|
+
}
|
|
4112
|
+
|
|
4113
|
+
function leave(event) {
|
|
4114
|
+
this.fillColor = 'black';
|
|
4115
|
+
}
|
|
4116
|
+
|
|
4117
|
+
// When the mouse is pressed:
|
|
4118
|
+
function onMouseDown(event) {
|
|
4119
|
+
// Create a circle shaped path at the position of the mouse:
|
|
4120
|
+
var path = new Path.Circle(event.point, 25);
|
|
4121
|
+
path.fillColor = 'black';
|
|
4122
|
+
|
|
4123
|
+
// When the mouse enters the item, set its fill color to red:
|
|
4124
|
+
path.onMouseEnter = enter;
|
|
4125
|
+
|
|
4126
|
+
// When the mouse leaves the item, set its fill color to black:
|
|
4127
|
+
path.onMouseLeave = leave;
|
|
4128
|
+
}
|
|
4129
|
+
</script>
|
|
4130
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
4131
|
+
</div>
|
|
4132
|
+
|
|
4133
|
+
|
|
4134
|
+
</div>
|
|
4135
|
+
|
|
4136
|
+
</div>
|
|
4137
|
+
</div>
|
|
4138
|
+
|
|
4139
|
+
|
|
4140
|
+
<div id="onmouseleave" class="member">
|
|
4141
|
+
<div class="member-link">
|
|
4142
|
+
<a name="onmouseleave" href="#onmouseleave"><tt><b>onMouseLeave</b></tt></a>
|
|
4143
|
+
</div>
|
|
4144
|
+
<div class="member-description hidden">
|
|
4145
|
+
|
|
4146
|
+
<div class="member-text">
|
|
4147
|
+
<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>
|
|
4148
|
+
|
|
4149
|
+
|
|
4150
|
+
|
|
4151
|
+
<ul class="member-list">
|
|
4152
|
+
<h4>Type:</h4>
|
|
4153
|
+
<li>
|
|
4154
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
4155
|
+
</li>
|
|
4156
|
+
</ul>
|
|
4157
|
+
|
|
4158
|
+
|
|
4159
|
+
<ul class="member-list">
|
|
4160
|
+
<h4>See also:</h4>
|
|
4161
|
+
|
|
4162
|
+
<li><tt><a href="../classes/View.html#onmouseleave"><tt>view.onMouseLeave</tt></a></tt></li>
|
|
4163
|
+
|
|
4164
|
+
</ul>
|
|
4165
|
+
|
|
4166
|
+
<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>
|
|
4167
|
+
|
|
4168
|
+
<div class="paperscript split">
|
|
4169
|
+
|
|
4170
|
+
<div class="buttons">
|
|
4171
|
+
<div class="button run">Run</div>
|
|
4172
|
+
</div>
|
|
4173
|
+
|
|
4174
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
4175
|
+
// Create a circle shaped path at the center of the view:
|
|
4176
|
+
var path = new Path.Circle({
|
|
4177
|
+
center: view.center,
|
|
4178
|
+
radius: 25,
|
|
4179
|
+
fillColor: 'black'
|
|
4180
|
+
});
|
|
4181
|
+
|
|
4182
|
+
// When the mouse leaves the item, set its fill color to red:
|
|
4183
|
+
path.onMouseLeave = function(event) {
|
|
4184
|
+
this.fillColor = 'red';
|
|
4185
|
+
}
|
|
4186
|
+
</script>
|
|
4187
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
4188
|
+
</div>
|
|
4189
|
+
|
|
4190
|
+
|
|
4191
|
+
</div>
|
|
4192
|
+
|
|
4193
|
+
</div>
|
|
4194
|
+
</div>
|
|
4195
|
+
|
|
4196
|
+
|
|
4197
|
+
<div id="ondraw" class="member">
|
|
4198
|
+
<div class="member-link">
|
|
4199
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
4200
|
+
</div>
|
|
4201
|
+
<div class="member-description hidden">
|
|
4202
|
+
|
|
4203
|
+
<div class="member-text">
|
|
4204
|
+
<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>
|
|
4205
|
+
|
|
4206
|
+
|
|
4207
|
+
|
|
4208
|
+
<ul class="member-list">
|
|
4209
|
+
<h4>Type:</h4>
|
|
4210
|
+
<li>
|
|
4211
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
4212
|
+
</li>
|
|
4213
|
+
</ul>
|
|
4214
|
+
<ul class="member-list">
|
|
4215
|
+
<h4>Options:</h4>
|
|
4216
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
4217
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
4218
|
+
<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>
|
|
4219
|
+
<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>
|
|
4220
|
+
<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>()
|
|
4221
|
+
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>
|
|
4222
|
+
</ul>
|
|
4223
|
+
|
|
4224
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
4225
|
+
|
|
4226
|
+
<div class="paperscript split">
|
|
4227
|
+
|
|
4228
|
+
<div class="buttons">
|
|
4229
|
+
<div class="button run">Run</div>
|
|
4230
|
+
</div>
|
|
4231
|
+
|
|
4232
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
4233
|
+
var path = new Path.Circle({
|
|
4234
|
+
center: view.center,
|
|
4235
|
+
radius: 25,
|
|
4236
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
4237
|
+
});
|
|
4238
|
+
|
|
4239
|
+
path.onDraw = function(event) {
|
|
4240
|
+
var ctx = event.context,
|
|
4241
|
+
center = this.position,
|
|
4242
|
+
scale = event.matrix.scaling.x;
|
|
4243
|
+
ctx.beginPath();
|
|
4244
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
4245
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
4246
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
4247
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
4248
|
+
ctx.lineWidth = 1 / scale;
|
|
4249
|
+
ctx.stroke();
|
|
4250
|
+
}
|
|
4251
|
+
</script>
|
|
4252
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
4253
|
+
</div>
|
|
4254
|
+
|
|
4255
|
+
|
|
4256
|
+
</div>
|
|
4257
|
+
|
|
4258
|
+
</div>
|
|
4259
|
+
</div>
|
|
4260
|
+
|
|
4261
|
+
|
|
4262
|
+
<div id="ondrawselection" class="member">
|
|
4263
|
+
<div class="member-link">
|
|
4264
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
4265
|
+
</div>
|
|
4266
|
+
<div class="member-description hidden">
|
|
4267
|
+
|
|
4268
|
+
<div class="member-text">
|
|
4269
|
+
<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>
|
|
4270
|
+
|
|
4271
|
+
|
|
4272
|
+
|
|
4273
|
+
<ul class="member-list">
|
|
4274
|
+
<h4>Type:</h4>
|
|
4275
|
+
<li>
|
|
4276
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
4277
|
+
</li>
|
|
4278
|
+
</ul>
|
|
4279
|
+
<ul class="member-list">
|
|
4280
|
+
<h4>Options:</h4>
|
|
4281
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
4282
|
+
<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>
|
|
4283
|
+
<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>
|
|
4284
|
+
<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>
|
|
4285
|
+
<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>
|
|
4286
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
4287
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
4288
|
+
</ul>
|
|
4289
|
+
|
|
4290
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
4291
|
+
|
|
4292
|
+
<div class="paperscript split">
|
|
4293
|
+
|
|
4294
|
+
<div class="buttons">
|
|
4295
|
+
<div class="button run">Run</div>
|
|
4296
|
+
</div>
|
|
4297
|
+
|
|
4298
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
4299
|
+
var path = new Path.Star({
|
|
4300
|
+
center: view.center,
|
|
4301
|
+
points: 5,
|
|
4302
|
+
radius1: 20,
|
|
4303
|
+
radius2: 40,
|
|
4304
|
+
strokeColor: 'black',
|
|
4305
|
+
selected: true
|
|
4306
|
+
});
|
|
4307
|
+
|
|
4308
|
+
path.onDrawSelection = function(event) {
|
|
4309
|
+
var ctx = event.context;
|
|
4310
|
+
this.segments.forEach(function(segment) {
|
|
4311
|
+
var point = event.matrix.transform(segment.point);
|
|
4312
|
+
ctx.beginPath();
|
|
4313
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
4314
|
+
ctx.fill();
|
|
4315
|
+
});
|
|
4316
|
+
return false;
|
|
4317
|
+
}
|
|
4318
|
+
</script>
|
|
4319
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
4320
|
+
</div>
|
|
4321
|
+
|
|
4322
|
+
|
|
4323
|
+
</div>
|
|
4324
|
+
|
|
4325
|
+
</div>
|
|
4326
|
+
</div>
|
|
4327
|
+
|
|
4328
|
+
</div>
|
|
4329
|
+
|
|
4330
|
+
|
|
4331
|
+
<!-- =========================== inherited methods ========================= -->
|
|
4332
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
4333
|
+
|
|
4334
|
+
|
|
4335
|
+
<div id="addeffect-effect" class="member">
|
|
4336
|
+
<div class="member-link">
|
|
4337
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
4338
|
+
</div>
|
|
4339
|
+
<div class="member-description hidden">
|
|
4340
|
+
<div class="member-text">
|
|
4341
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
4342
|
+
|
|
4343
|
+
|
|
4344
|
+
<ul class="member-list">
|
|
4345
|
+
<h4>Parameters:</h4>
|
|
4346
|
+
|
|
4347
|
+
<li>
|
|
4348
|
+
<tt>effect:</tt>
|
|
4349
|
+
<tt>Object</tt>
|
|
4350
|
+
— the plain object describing the effect
|
|
4351
|
+
|
|
4352
|
+
</li>
|
|
4353
|
+
|
|
4354
|
+
</ul>
|
|
4355
|
+
|
|
4356
|
+
|
|
4357
|
+
<ul class="member-list">
|
|
4358
|
+
<h4>Returns:</h4>
|
|
4359
|
+
|
|
4360
|
+
<li>
|
|
4361
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
4362
|
+
</li>
|
|
4363
|
+
|
|
4364
|
+
|
|
4365
|
+
</ul>
|
|
4366
|
+
|
|
4367
|
+
|
|
4368
|
+
|
|
4369
|
+
|
|
4370
|
+
|
|
4371
|
+
</div>
|
|
4372
|
+
</div>
|
|
4373
|
+
</div>
|
|
4374
|
+
|
|
4375
|
+
|
|
4376
|
+
<div id="inserteffect-index-effect" class="member">
|
|
4377
|
+
<div class="member-link">
|
|
4378
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
4379
|
+
</div>
|
|
4380
|
+
<div class="member-description hidden">
|
|
4381
|
+
<div class="member-text">
|
|
4382
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
4383
|
+
|
|
4384
|
+
|
|
4385
|
+
<ul class="member-list">
|
|
4386
|
+
<h4>Parameters:</h4>
|
|
4387
|
+
|
|
4388
|
+
<li>
|
|
4389
|
+
<tt>index:</tt>
|
|
4390
|
+
<tt>Number</tt>
|
|
4391
|
+
— the index at which to insert the effect
|
|
4392
|
+
|
|
4393
|
+
</li>
|
|
4394
|
+
|
|
4395
|
+
<li>
|
|
4396
|
+
<tt>effect:</tt>
|
|
4397
|
+
<tt>Object</tt>
|
|
4398
|
+
— the plain object describing the effect
|
|
4399
|
+
|
|
4400
|
+
</li>
|
|
4401
|
+
|
|
4402
|
+
</ul>
|
|
4403
|
+
|
|
4404
|
+
|
|
4405
|
+
<ul class="member-list">
|
|
4406
|
+
<h4>Returns:</h4>
|
|
4407
|
+
|
|
4408
|
+
<li>
|
|
4409
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
4410
|
+
</li>
|
|
4411
|
+
|
|
4412
|
+
|
|
4413
|
+
</ul>
|
|
4414
|
+
|
|
4415
|
+
|
|
4416
|
+
|
|
4417
|
+
|
|
4418
|
+
|
|
4419
|
+
</div>
|
|
4420
|
+
</div>
|
|
4421
|
+
</div>
|
|
4422
|
+
|
|
4423
|
+
|
|
4424
|
+
<div id="inserteffects-index-effects" class="member">
|
|
4425
|
+
<div class="member-link">
|
|
4426
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
4427
|
+
</div>
|
|
4428
|
+
<div class="member-description hidden">
|
|
4429
|
+
<div class="member-text">
|
|
4430
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
4431
|
+
|
|
4432
|
+
|
|
4433
|
+
<ul class="member-list">
|
|
4434
|
+
<h4>Parameters:</h4>
|
|
4435
|
+
|
|
4436
|
+
<li>
|
|
4437
|
+
<tt>index:</tt>
|
|
4438
|
+
<tt>Number</tt>
|
|
4439
|
+
— the index at which to insert the effects
|
|
4440
|
+
|
|
4441
|
+
</li>
|
|
4442
|
+
|
|
4443
|
+
<li>
|
|
4444
|
+
<tt>effects:</tt>
|
|
4445
|
+
Array of <tt>Object</tt> objects
|
|
4446
|
+
— the plain objects describing the effects
|
|
4447
|
+
|
|
4448
|
+
</li>
|
|
4449
|
+
|
|
4450
|
+
</ul>
|
|
4451
|
+
|
|
4452
|
+
|
|
4453
|
+
<ul class="member-list">
|
|
4454
|
+
<h4>Returns:</h4>
|
|
4455
|
+
|
|
4456
|
+
<li>
|
|
4457
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
4458
|
+
</li>
|
|
4459
|
+
|
|
4460
|
+
|
|
4461
|
+
</ul>
|
|
3915
4462
|
|
|
3916
4463
|
|
|
3917
|
-
</div>
|
|
3918
4464
|
|
|
4465
|
+
|
|
4466
|
+
|
|
4467
|
+
</div>
|
|
3919
4468
|
</div>
|
|
3920
4469
|
</div>
|
|
3921
4470
|
|
|
3922
4471
|
|
|
3923
|
-
<div id="
|
|
4472
|
+
<div id="removeeffect-index" class="member">
|
|
3924
4473
|
<div class="member-link">
|
|
3925
|
-
<a name="
|
|
4474
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
3926
4475
|
</div>
|
|
3927
4476
|
<div class="member-description hidden">
|
|
3928
|
-
|
|
3929
4477
|
<div class="member-text">
|
|
3930
|
-
<p>
|
|
4478
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
4479
|
+
|
|
3931
4480
|
|
|
4481
|
+
<ul class="member-list">
|
|
4482
|
+
<h4>Parameters:</h4>
|
|
3932
4483
|
|
|
4484
|
+
<li>
|
|
4485
|
+
<tt>index:</tt>
|
|
4486
|
+
<tt>Number</tt>
|
|
4487
|
+
— the index of the effect to remove
|
|
4488
|
+
|
|
4489
|
+
</li>
|
|
3933
4490
|
|
|
3934
|
-
|
|
3935
|
-
|
|
3936
|
-
<li>
|
|
3937
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
3938
|
-
</li>
|
|
3939
|
-
</ul>
|
|
3940
|
-
|
|
4491
|
+
</ul>
|
|
4492
|
+
|
|
3941
4493
|
|
|
3942
4494
|
<ul class="member-list">
|
|
3943
|
-
<h4>
|
|
4495
|
+
<h4>Returns:</h4>
|
|
3944
4496
|
|
|
3945
|
-
<li
|
|
4497
|
+
<li>
|
|
4498
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
4499
|
+
</li>
|
|
4500
|
+
|
|
3946
4501
|
|
|
3947
4502
|
</ul>
|
|
3948
4503
|
|
|
3949
|
-
<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>
|
|
3950
4504
|
|
|
3951
|
-
<div class="paperscript split">
|
|
3952
4505
|
|
|
3953
|
-
|
|
3954
|
-
|
|
4506
|
+
|
|
4507
|
+
|
|
3955
4508
|
</div>
|
|
3956
|
-
|
|
3957
|
-
<script type="text/paperscript" canvas="canvas-38">
|
|
3958
|
-
// Create a circle shaped path at the center of the view:
|
|
3959
|
-
var path = new Path.Circle({
|
|
3960
|
-
center: view.center,
|
|
3961
|
-
radius: 25,
|
|
3962
|
-
fillColor: 'black'
|
|
3963
|
-
});
|
|
3964
|
-
|
|
3965
|
-
// When the mouse enters the item, set its fill color to red:
|
|
3966
|
-
path.onMouseEnter = function(event) {
|
|
3967
|
-
this.fillColor = 'red';
|
|
3968
|
-
}
|
|
3969
|
-
|
|
3970
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
3971
|
-
path.onMouseLeave = function(event) {
|
|
3972
|
-
this.fillColor = 'black';
|
|
3973
|
-
}
|
|
3974
|
-
</script>
|
|
3975
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
3976
4509
|
</div>
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
<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>
|
|
3980
|
-
|
|
3981
|
-
<div class="paperscript split">
|
|
3982
|
-
|
|
3983
|
-
<div class="buttons">
|
|
3984
|
-
<div class="button run">Run</div>
|
|
3985
4510
|
</div>
|
|
3986
4511
|
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
4512
|
+
|
|
4513
|
+
<div id="removeeffects" class="member">
|
|
4514
|
+
<div class="member-link">
|
|
4515
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
4516
|
+
</div>
|
|
4517
|
+
<div class="member-description hidden">
|
|
4518
|
+
<div class="member-text">
|
|
4519
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
4520
|
+
|
|
4521
|
+
|
|
4522
|
+
<ul class="member-list">
|
|
4523
|
+
<h4>Parameters:</h4>
|
|
4524
|
+
|
|
4525
|
+
<li>
|
|
4526
|
+
<tt>start:</tt>
|
|
4527
|
+
<tt>Number</tt>
|
|
4528
|
+
— the index of the first effect to remove
|
|
4529
|
+
— optional, default: <tt>0</tt>
|
|
4530
|
+
</li>
|
|
4531
|
+
|
|
4532
|
+
<li>
|
|
4533
|
+
<tt>end:</tt>
|
|
4534
|
+
<tt>Number</tt>
|
|
4535
|
+
— the index after the last one
|
|
4536
|
+
— optional, default: <tt>effects.length</tt>
|
|
4537
|
+
</li>
|
|
4538
|
+
|
|
4539
|
+
</ul>
|
|
3995
4540
|
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
|
|
3999
|
-
|
|
4000
|
-
|
|
4541
|
+
|
|
4542
|
+
<ul class="member-list">
|
|
4543
|
+
<h4>Returns:</h4>
|
|
4544
|
+
|
|
4545
|
+
<li>
|
|
4546
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
4547
|
+
</li>
|
|
4001
4548
|
|
|
4002
|
-
|
|
4003
|
-
|
|
4549
|
+
|
|
4550
|
+
</ul>
|
|
4004
4551
|
|
|
4005
|
-
// When the mouse leaves the item, set its fill color to black:
|
|
4006
|
-
path.onMouseLeave = leave;
|
|
4007
|
-
}
|
|
4008
|
-
</script>
|
|
4009
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
4010
|
-
</div>
|
|
4011
4552
|
|
|
4012
4553
|
|
|
4554
|
+
|
|
4555
|
+
|
|
4013
4556
|
</div>
|
|
4014
|
-
|
|
4015
4557
|
</div>
|
|
4016
4558
|
</div>
|
|
4017
4559
|
|
|
4018
4560
|
|
|
4019
|
-
<div id="
|
|
4561
|
+
<div id="geteffectoutput" class="member">
|
|
4020
4562
|
<div class="member-link">
|
|
4021
|
-
<a name="
|
|
4563
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
4022
4564
|
</div>
|
|
4023
4565
|
<div class="member-description hidden">
|
|
4024
|
-
|
|
4025
4566
|
<div class="member-text">
|
|
4026
|
-
<p>
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
<ul class="member-list">
|
|
4031
|
-
<h4>Type:</h4>
|
|
4032
|
-
<li>
|
|
4033
|
-
<tt>Function</tt>⟋<tt>null</tt>
|
|
4034
|
-
</li>
|
|
4035
|
-
</ul>
|
|
4567
|
+
<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>
|
|
4036
4568
|
|
|
4037
4569
|
|
|
4570
|
+
|
|
4038
4571
|
<ul class="member-list">
|
|
4039
|
-
<h4>
|
|
4572
|
+
<h4>Returns:</h4>
|
|
4040
4573
|
|
|
4041
|
-
<li
|
|
4574
|
+
<li>
|
|
4575
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
4576
|
+
</li>
|
|
4577
|
+
|
|
4042
4578
|
|
|
4043
4579
|
</ul>
|
|
4044
4580
|
|
|
4045
|
-
<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>
|
|
4046
|
-
|
|
4047
|
-
<div class="paperscript split">
|
|
4048
|
-
|
|
4049
|
-
<div class="buttons">
|
|
4050
|
-
<div class="button run">Run</div>
|
|
4051
|
-
</div>
|
|
4052
|
-
|
|
4053
|
-
<script type="text/paperscript" canvas="canvas-40">
|
|
4054
|
-
// Create a circle shaped path at the center of the view:
|
|
4055
|
-
var path = new Path.Circle({
|
|
4056
|
-
center: view.center,
|
|
4057
|
-
radius: 25,
|
|
4058
|
-
fillColor: 'black'
|
|
4059
|
-
});
|
|
4060
|
-
|
|
4061
|
-
// When the mouse leaves the item, set its fill color to red:
|
|
4062
|
-
path.onMouseLeave = function(event) {
|
|
4063
|
-
this.fillColor = 'red';
|
|
4064
|
-
}
|
|
4065
|
-
</script>
|
|
4066
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
4067
|
-
</div>
|
|
4068
|
-
|
|
4069
4581
|
|
|
4070
|
-
</div>
|
|
4071
4582
|
|
|
4583
|
+
|
|
4584
|
+
|
|
4072
4585
|
</div>
|
|
4073
4586
|
</div>
|
|
4074
|
-
|
|
4075
4587
|
</div>
|
|
4076
4588
|
|
|
4077
|
-
|
|
4078
|
-
<!-- =========================== inherited methods ========================= -->
|
|
4079
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
4080
|
-
|
|
4081
4589
|
|
|
4082
4590
|
<div id="set-props" class="member">
|
|
4083
4591
|
<div class="member-link">
|
|
@@ -4122,7 +4630,7 @@ path.onMouseLeave = function(event) {
|
|
|
4122
4630
|
<div class="button run">Run</div>
|
|
4123
4631
|
</div>
|
|
4124
4632
|
|
|
4125
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4633
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
4126
4634
|
var circle = new Path.Circle({
|
|
4127
4635
|
center: [80, 50],
|
|
4128
4636
|
radius: 35
|
|
@@ -4135,7 +4643,7 @@ circle.set({
|
|
|
4135
4643
|
selected: true
|
|
4136
4644
|
});
|
|
4137
4645
|
</script>
|
|
4138
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4646
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-44"></canvas></div>
|
|
4139
4647
|
</div>
|
|
4140
4648
|
|
|
4141
4649
|
|
|
@@ -4191,7 +4699,7 @@ circle.set({
|
|
|
4191
4699
|
<div class="button run">Run</div>
|
|
4192
4700
|
</div>
|
|
4193
4701
|
|
|
4194
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4702
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
4195
4703
|
var circle = new Path.Circle({
|
|
4196
4704
|
center: [50, 50],
|
|
4197
4705
|
radius: 10,
|
|
@@ -4206,7 +4714,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
4206
4714
|
copy.position.x += i * copy.bounds.width;
|
|
4207
4715
|
}
|
|
4208
4716
|
</script>
|
|
4209
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4717
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-45"></canvas></div>
|
|
4210
4718
|
</div>
|
|
4211
4719
|
|
|
4212
4720
|
|
|
@@ -4332,7 +4840,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
4332
4840
|
<div class="button run">Run</div>
|
|
4333
4841
|
</div>
|
|
4334
4842
|
|
|
4335
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4843
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
4336
4844
|
var circle = new Path.Circle({
|
|
4337
4845
|
center: [50, 50],
|
|
4338
4846
|
radius: 5,
|
|
@@ -4349,7 +4857,7 @@ raster.position.x += 100;
|
|
|
4349
4857
|
circle.scale(5);
|
|
4350
4858
|
raster.scale(5);
|
|
4351
4859
|
</script>
|
|
4352
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4860
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-46"></canvas></div>
|
|
4353
4861
|
</div>
|
|
4354
4862
|
|
|
4355
4863
|
|
|
@@ -4403,7 +4911,7 @@ raster.scale(5);
|
|
|
4403
4911
|
<div class="button run">Run</div>
|
|
4404
4912
|
</div>
|
|
4405
4913
|
|
|
4406
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4914
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
4407
4915
|
var path = new Path.Star({
|
|
4408
4916
|
center: [50, 50],
|
|
4409
4917
|
points: 12,
|
|
@@ -4424,7 +4932,7 @@ function onMouseDown(event) {
|
|
|
4424
4932
|
}
|
|
4425
4933
|
}
|
|
4426
4934
|
</script>
|
|
4427
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4935
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-47"></canvas></div>
|
|
4428
4936
|
</div>
|
|
4429
4937
|
|
|
4430
4938
|
|
|
@@ -4942,11 +5450,17 @@ function onMouseDown(event) {
|
|
|
4942
5450
|
</div>
|
|
4943
5451
|
<div class="member-description hidden">
|
|
4944
5452
|
<div class="member-text">
|
|
4945
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
5453
|
+
<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>
|
|
4946
5454
|
<ul class="member-list">
|
|
4947
5455
|
<h4>Options:</h4>
|
|
4948
|
-
<li
|
|
4949
|
-
|
|
5456
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
5457
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
5458
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
5459
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
5460
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
5461
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
5462
|
+
`paper.view.matrix` is used, for all other settings of
|
|
5463
|
+
`options.bounds` the identity matrix is used.</li>
|
|
4950
5464
|
<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>
|
|
4951
5465
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
4952
5466
|
<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>
|
|
@@ -4954,6 +5468,12 @@ function onMouseDown(event) {
|
|
|
4954
5468
|
<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>
|
|
4955
5469
|
<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>
|
|
4956
5470
|
<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>
|
|
5471
|
+
<li>[options.processNode] {Function} the function to process the
|
|
5472
|
+
SVG node made for each exported item, receiving an object with the
|
|
5473
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
5474
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
5475
|
+
is called before the item's name, style, visibility and data are set
|
|
5476
|
+
on the node, which replace attributes of the same names.</li>
|
|
4957
5477
|
</ul>
|
|
4958
5478
|
|
|
4959
5479
|
<ul class="member-list">
|
|
@@ -4996,6 +5516,7 @@ function onMouseDown(event) {
|
|
|
4996
5516
|
<div class="member-text">
|
|
4997
5517
|
<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>
|
|
4998
5518
|
<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>
|
|
5519
|
+
<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>
|
|
4999
5520
|
<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>
|
|
5000
5521
|
<ul class="member-list">
|
|
5001
5522
|
<h4>Options:</h4>
|
|
@@ -5007,6 +5528,13 @@ function onMouseDown(event) {
|
|
|
5007
5528
|
<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>
|
|
5008
5529
|
<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>
|
|
5009
5530
|
<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>
|
|
5531
|
+
<li>[options.processItem] {Function} the function to process the
|
|
5532
|
+
item made for each imported SVG element, receiving an object with
|
|
5533
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
5534
|
+
doesn't import, or return an item to replace it with. It is called
|
|
5535
|
+
after the element's attributes and data are applied to the item, so
|
|
5536
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
5537
|
+
copy them over from `item` as needed.</li>
|
|
5010
5538
|
</ul>
|
|
5011
5539
|
|
|
5012
5540
|
<ul class="member-list">
|
|
@@ -6286,7 +6814,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
6286
6814
|
<div class="button run">Run</div>
|
|
6287
6815
|
</div>
|
|
6288
6816
|
|
|
6289
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6817
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
6290
6818
|
// Create a rectangle shaped path with its top left
|
|
6291
6819
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
6292
6820
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -6295,7 +6823,7 @@ path.fillColor = 'black';
|
|
|
6295
6823
|
// Rotate the path by 30 degrees:
|
|
6296
6824
|
path.rotate(30);
|
|
6297
6825
|
</script>
|
|
6298
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6826
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-48"></canvas></div>
|
|
6299
6827
|
</div>
|
|
6300
6828
|
|
|
6301
6829
|
|
|
@@ -6307,7 +6835,7 @@ path.rotate(30);
|
|
|
6307
6835
|
<div class="button run">Run</div>
|
|
6308
6836
|
</div>
|
|
6309
6837
|
|
|
6310
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6838
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
6311
6839
|
// Create a rectangle shaped path with its top left
|
|
6312
6840
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
6313
6841
|
var topLeft = new Point(175, 50);
|
|
@@ -6329,7 +6857,7 @@ function onFrame(event) {
|
|
|
6329
6857
|
path.rotate(3, view.center);
|
|
6330
6858
|
}
|
|
6331
6859
|
</script>
|
|
6332
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
6860
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
|
|
6333
6861
|
</div>
|
|
6334
6862
|
|
|
6335
6863
|
|
|
@@ -6378,7 +6906,7 @@ function onFrame(event) {
|
|
|
6378
6906
|
<div class="button run">Run</div>
|
|
6379
6907
|
</div>
|
|
6380
6908
|
|
|
6381
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6909
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
6382
6910
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
6383
6911
|
// with a radius of 20:
|
|
6384
6912
|
var circle = new Path.Circle({
|
|
@@ -6390,7 +6918,7 @@ var circle = new Path.Circle({
|
|
|
6390
6918
|
// Scale the path by 150% from its center point
|
|
6391
6919
|
circle.scale(1.5);
|
|
6392
6920
|
</script>
|
|
6393
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6921
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
6394
6922
|
</div>
|
|
6395
6923
|
|
|
6396
6924
|
|
|
@@ -6402,7 +6930,7 @@ circle.scale(1.5);
|
|
|
6402
6930
|
<div class="button run">Run</div>
|
|
6403
6931
|
</div>
|
|
6404
6932
|
|
|
6405
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6933
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
6406
6934
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
6407
6935
|
// with a radius of 20:
|
|
6408
6936
|
var circle = new Path.Circle({
|
|
@@ -6414,7 +6942,7 @@ var circle = new Path.Circle({
|
|
|
6414
6942
|
// Scale the path 150% from its bottom left corner
|
|
6415
6943
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
6416
6944
|
</script>
|
|
6417
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6945
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
6418
6946
|
</div>
|
|
6419
6947
|
|
|
6420
6948
|
|
|
@@ -6470,7 +6998,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
6470
6998
|
<div class="button run">Run</div>
|
|
6471
6999
|
</div>
|
|
6472
7000
|
|
|
6473
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7001
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
6474
7002
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
6475
7003
|
// with a radius of 20:
|
|
6476
7004
|
var circle = new Path.Circle({
|
|
@@ -6482,7 +7010,7 @@ var circle = new Path.Circle({
|
|
|
6482
7010
|
// Scale the path horizontally by 300%
|
|
6483
7011
|
circle.scale(3, 1);
|
|
6484
7012
|
</script>
|
|
6485
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7013
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
6486
7014
|
</div>
|
|
6487
7015
|
|
|
6488
7016
|
|
|
@@ -6920,7 +7448,7 @@ circle.scale(3, 1);
|
|
|
6920
7448
|
<div class="button run">Run</div>
|
|
6921
7449
|
</div>
|
|
6922
7450
|
|
|
6923
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7451
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
6924
7452
|
// Create a rectangle shaped path with its top left corner
|
|
6925
7453
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6926
7454
|
var path = new Path.Rectangle({
|
|
@@ -6941,7 +7469,7 @@ var circlePath = new Path.Circle({
|
|
|
6941
7469
|
// the rectangular path:
|
|
6942
7470
|
circlePath.fitBounds(path.bounds);
|
|
6943
7471
|
</script>
|
|
6944
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7472
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
|
|
6945
7473
|
</div>
|
|
6946
7474
|
|
|
6947
7475
|
|
|
@@ -6953,7 +7481,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
6953
7481
|
<div class="button run">Run</div>
|
|
6954
7482
|
</div>
|
|
6955
7483
|
|
|
6956
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7484
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
6957
7485
|
// Create a rectangle shaped path with its top left corner
|
|
6958
7486
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
6959
7487
|
var path = new Path.Rectangle({
|
|
@@ -6974,7 +7502,7 @@ var circlePath = new Path.Circle({
|
|
|
6974
7502
|
// the rectangular path:
|
|
6975
7503
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
6976
7504
|
</script>
|
|
6977
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7505
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
|
|
6978
7506
|
</div>
|
|
6979
7507
|
|
|
6980
7508
|
|
|
@@ -6986,7 +7514,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
6986
7514
|
<div class="button run">Run</div>
|
|
6987
7515
|
</div>
|
|
6988
7516
|
|
|
6989
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7517
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
6990
7518
|
var path = new Path.Circle({
|
|
6991
7519
|
center: [80, 50],
|
|
6992
7520
|
radius: 30,
|
|
@@ -6996,7 +7524,7 @@ var path = new Path.Circle({
|
|
|
6996
7524
|
// Fit the path to the bounding rectangle of the view:
|
|
6997
7525
|
path.fitBounds(view.bounds);
|
|
6998
7526
|
</script>
|
|
6999
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7527
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-55"></canvas></div>
|
|
7000
7528
|
</div>
|
|
7001
7529
|
|
|
7002
7530
|
|
|
@@ -7022,7 +7550,7 @@ path.fitBounds(view.bounds);
|
|
|
7022
7550
|
<li>
|
|
7023
7551
|
<tt>type:</tt>
|
|
7024
7552
|
<tt>String</tt>
|
|
7025
|
-
— 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>
|
|
7553
|
+
— 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>
|
|
7026
7554
|
|
|
7027
7555
|
</li>
|
|
7028
7556
|
|
|
@@ -7057,7 +7585,7 @@ path.fitBounds(view.bounds);
|
|
|
7057
7585
|
<div class="button run">Run</div>
|
|
7058
7586
|
</div>
|
|
7059
7587
|
|
|
7060
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7588
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
7061
7589
|
// Create a circle shaped path at the center of the view:
|
|
7062
7590
|
var path = new Path.Circle({
|
|
7063
7591
|
center: view.center,
|
|
@@ -7075,7 +7603,7 @@ path.on('mouseleave', function() {
|
|
|
7075
7603
|
this.fillColor = 'black';
|
|
7076
7604
|
});
|
|
7077
7605
|
</script>
|
|
7078
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7606
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
|
|
7079
7607
|
</div>
|
|
7080
7608
|
|
|
7081
7609
|
|
|
@@ -7099,7 +7627,7 @@ path.on('mouseleave', function() {
|
|
|
7099
7627
|
<li>
|
|
7100
7628
|
<tt>object:</tt>
|
|
7101
7629
|
<tt>Object</tt>
|
|
7102
|
-
— 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>
|
|
7630
|
+
— 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>
|
|
7103
7631
|
|
|
7104
7632
|
</li>
|
|
7105
7633
|
|
|
@@ -7127,7 +7655,7 @@ path.on('mouseleave', function() {
|
|
|
7127
7655
|
<div class="button run">Run</div>
|
|
7128
7656
|
</div>
|
|
7129
7657
|
|
|
7130
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7658
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
7131
7659
|
// Create a circle shaped path at the center of the view:
|
|
7132
7660
|
var path = new Path.Circle({
|
|
7133
7661
|
center: view.center,
|
|
@@ -7145,7 +7673,7 @@ path.on({
|
|
|
7145
7673
|
}
|
|
7146
7674
|
});
|
|
7147
7675
|
</script>
|
|
7148
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7676
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
|
|
7149
7677
|
</div>
|
|
7150
7678
|
|
|
7151
7679
|
|
|
@@ -7157,7 +7685,7 @@ path.on({
|
|
|
7157
7685
|
<div class="button run">Run</div>
|
|
7158
7686
|
</div>
|
|
7159
7687
|
|
|
7160
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7688
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
7161
7689
|
var pathHandlers = {
|
|
7162
7690
|
mouseenter: function(event) {
|
|
7163
7691
|
this.fillColor = 'red';
|
|
@@ -7180,7 +7708,7 @@ function onMouseDown(event) {
|
|
|
7180
7708
|
path.on(pathHandlers);
|
|
7181
7709
|
}
|
|
7182
7710
|
</script>
|
|
7183
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7711
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
7184
7712
|
</div>
|
|
7185
7713
|
|
|
7186
7714
|
|
|
@@ -7204,7 +7732,7 @@ function onMouseDown(event) {
|
|
|
7204
7732
|
<li>
|
|
7205
7733
|
<tt>type:</tt>
|
|
7206
7734
|
<tt>String</tt>
|
|
7207
|
-
— 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>
|
|
7735
|
+
— 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>
|
|
7208
7736
|
|
|
7209
7737
|
</li>
|
|
7210
7738
|
|
|
@@ -7252,7 +7780,7 @@ function onMouseDown(event) {
|
|
|
7252
7780
|
<li>
|
|
7253
7781
|
<tt>object:</tt>
|
|
7254
7782
|
<tt>Object</tt>
|
|
7255
|
-
— 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>
|
|
7783
|
+
— 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>
|
|
7256
7784
|
|
|
7257
7785
|
</li>
|
|
7258
7786
|
|
|
@@ -7293,7 +7821,7 @@ function onMouseDown(event) {
|
|
|
7293
7821
|
<li>
|
|
7294
7822
|
<tt>type:</tt>
|
|
7295
7823
|
<tt>String</tt>
|
|
7296
|
-
— 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>
|
|
7824
|
+
— 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>
|
|
7297
7825
|
|
|
7298
7826
|
</li>
|
|
7299
7827
|
|
|
@@ -7341,7 +7869,7 @@ function onMouseDown(event) {
|
|
|
7341
7869
|
<li>
|
|
7342
7870
|
<tt>type:</tt>
|
|
7343
7871
|
<tt>String</tt>
|
|
7344
|
-
— 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>
|
|
7872
|
+
— 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>
|
|
7345
7873
|
|
|
7346
7874
|
</li>
|
|
7347
7875
|
|
|
@@ -7408,7 +7936,7 @@ function onMouseDown(event) {
|
|
|
7408
7936
|
<div class="button run">Run</div>
|
|
7409
7937
|
</div>
|
|
7410
7938
|
|
|
7411
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7939
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
7412
7940
|
function onMouseDrag(event) {
|
|
7413
7941
|
// Create a circle shaped path at the mouse position,
|
|
7414
7942
|
// with a radius of 10:
|
|
@@ -7425,7 +7953,7 @@ function onMouseDrag(event) {
|
|
|
7425
7953
|
});
|
|
7426
7954
|
}
|
|
7427
7955
|
</script>
|
|
7428
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
7956
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-59"></canvas></div>
|
|
7429
7957
|
</div>
|
|
7430
7958
|
|
|
7431
7959
|
|
|
@@ -7455,7 +7983,7 @@ function onMouseDrag(event) {
|
|
|
7455
7983
|
<div class="button run">Run</div>
|
|
7456
7984
|
</div>
|
|
7457
7985
|
|
|
7458
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7986
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
7459
7987
|
function onMouseMove(event) {
|
|
7460
7988
|
// Create a circle shaped path at the mouse position,
|
|
7461
7989
|
// with a radius of 10:
|
|
@@ -7469,7 +7997,7 @@ function onMouseMove(event) {
|
|
|
7469
7997
|
path.removeOnMove();
|
|
7470
7998
|
}
|
|
7471
7999
|
</script>
|
|
7472
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8000
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-60"></canvas></div>
|
|
7473
8001
|
</div>
|
|
7474
8002
|
|
|
7475
8003
|
|
|
@@ -7499,7 +8027,7 @@ function onMouseMove(event) {
|
|
|
7499
8027
|
<div class="button run">Run</div>
|
|
7500
8028
|
</div>
|
|
7501
8029
|
|
|
7502
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8030
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
7503
8031
|
function onMouseDown(event) {
|
|
7504
8032
|
// Create a circle shaped path at the mouse position,
|
|
7505
8033
|
// with a radius of 10:
|
|
@@ -7513,7 +8041,7 @@ function onMouseDown(event) {
|
|
|
7513
8041
|
path.removeOnDown();
|
|
7514
8042
|
}
|
|
7515
8043
|
</script>
|
|
7516
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8044
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-61"></canvas></div>
|
|
7517
8045
|
</div>
|
|
7518
8046
|
|
|
7519
8047
|
|
|
@@ -7543,7 +8071,7 @@ function onMouseDown(event) {
|
|
|
7543
8071
|
<div class="button run">Run</div>
|
|
7544
8072
|
</div>
|
|
7545
8073
|
|
|
7546
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8074
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
7547
8075
|
function onMouseDrag(event) {
|
|
7548
8076
|
// Create a circle shaped path at the mouse position,
|
|
7549
8077
|
// with a radius of 10:
|
|
@@ -7557,7 +8085,7 @@ function onMouseDrag(event) {
|
|
|
7557
8085
|
path.removeOnDrag();
|
|
7558
8086
|
}
|
|
7559
8087
|
</script>
|
|
7560
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8088
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-62"></canvas></div>
|
|
7561
8089
|
</div>
|
|
7562
8090
|
|
|
7563
8091
|
|
|
@@ -7587,7 +8115,7 @@ function onMouseDrag(event) {
|
|
|
7587
8115
|
<div class="button run">Run</div>
|
|
7588
8116
|
</div>
|
|
7589
8117
|
|
|
7590
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8118
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
7591
8119
|
function onMouseDown(event) {
|
|
7592
8120
|
// Create a circle shaped path at the mouse position,
|
|
7593
8121
|
// with a radius of 10:
|
|
@@ -7601,7 +8129,7 @@ function onMouseDown(event) {
|
|
|
7601
8129
|
path.removeOnUp();
|
|
7602
8130
|
}
|
|
7603
8131
|
</script>
|
|
7604
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8132
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-63"></canvas></div>
|
|
7605
8133
|
</div>
|
|
7606
8134
|
|
|
7607
8135
|
|
|
@@ -7674,7 +8202,7 @@ function onMouseDown(event) {
|
|
|
7674
8202
|
<div class="button run">Run</div>
|
|
7675
8203
|
</div>
|
|
7676
8204
|
|
|
7677
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8205
|
+
<script type="text/paperscript" canvas="canvas-64">
|
|
7678
8206
|
var path = new Path.Circle({
|
|
7679
8207
|
radius: view.bounds.height * 0.4,
|
|
7680
8208
|
center: view.center
|
|
@@ -7685,7 +8213,7 @@ path.tween(
|
|
|
7685
8213
|
3000
|
|
7686
8214
|
);
|
|
7687
8215
|
</script>
|
|
7688
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8216
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
|
|
7689
8217
|
</div>
|
|
7690
8218
|
|
|
7691
8219
|
|
|
@@ -7697,7 +8225,7 @@ path.tween(
|
|
|
7697
8225
|
<div class="button run">Run</div>
|
|
7698
8226
|
</div>
|
|
7699
8227
|
|
|
7700
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8228
|
+
<script type="text/paperscript" canvas="canvas-65">
|
|
7701
8229
|
var path = new Shape.Rectangle({
|
|
7702
8230
|
fillColor: 'red',
|
|
7703
8231
|
center: [50, view.center.y],
|
|
@@ -7712,7 +8240,7 @@ path.tween({
|
|
|
7712
8240
|
duration: 2000
|
|
7713
8241
|
});
|
|
7714
8242
|
</script>
|
|
7715
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8243
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
|
|
7716
8244
|
</div>
|
|
7717
8245
|
|
|
7718
8246
|
|
|
@@ -7778,7 +8306,7 @@ path.tween({
|
|
|
7778
8306
|
<div class="button run">Run</div>
|
|
7779
8307
|
</div>
|
|
7780
8308
|
|
|
7781
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8309
|
+
<script type="text/paperscript" canvas="canvas-66">
|
|
7782
8310
|
var path = new Path.Rectangle({
|
|
7783
8311
|
size: [100, 100],
|
|
7784
8312
|
position: view.center,
|
|
@@ -7792,7 +8320,7 @@ path.tween({
|
|
|
7792
8320
|
'segments[2].point.x': '-= 50'
|
|
7793
8321
|
}, 3000);
|
|
7794
8322
|
</script>
|
|
7795
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8323
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-66"></canvas></div>
|
|
7796
8324
|
</div>
|
|
7797
8325
|
|
|
7798
8326
|
|
|
@@ -7851,7 +8379,7 @@ path.tween({
|
|
|
7851
8379
|
<div class="button run">Run</div>
|
|
7852
8380
|
</div>
|
|
7853
8381
|
|
|
7854
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8382
|
+
<script type="text/paperscript" canvas="canvas-67">
|
|
7855
8383
|
var path = new Path.Circle({
|
|
7856
8384
|
fillColor: 'blue',
|
|
7857
8385
|
radius: view.bounds.height * 0.4,
|
|
@@ -7867,7 +8395,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7867
8395
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
7868
8396
|
};
|
|
7869
8397
|
</script>
|
|
7870
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8398
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-67"></canvas></div>
|
|
7871
8399
|
</div>
|
|
7872
8400
|
|
|
7873
8401
|
|
|
@@ -7988,7 +8516,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
7988
8516
|
<div class="button run">Run</div>
|
|
7989
8517
|
</div>
|
|
7990
8518
|
|
|
7991
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8519
|
+
<script type="text/paperscript" canvas="canvas-68">
|
|
7992
8520
|
var path = new Path.Circle({
|
|
7993
8521
|
fillColor: 'blue',
|
|
7994
8522
|
radius: view.bounds.height * 0.4,
|
|
@@ -7996,7 +8524,7 @@ var path = new Path.Circle({
|
|
|
7996
8524
|
});
|
|
7997
8525
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
7998
8526
|
</script>
|
|
7999
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8527
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-68"></canvas></div>
|
|
8000
8528
|
</div>
|
|
8001
8529
|
|
|
8002
8530
|
|
|
@@ -8010,7 +8538,7 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
8010
8538
|
|
|
8011
8539
|
<!-- =========================== copyright notice ========================== -->
|
|
8012
8540
|
<p class="footer">
|
|
8013
|
-
Paper.js v0.
|
|
8541
|
+
Paper.js v0.17.0<br>
|
|
8014
8542
|
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>
|
|
8015
8543
|
<div class="content-end"></div>
|
|
8016
8544
|
|