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
|
@@ -1350,6 +1350,46 @@ var path = new Path.Star({
|
|
|
1350
1350
|
<h2>Properties</h2>
|
|
1351
1351
|
|
|
1352
1352
|
|
|
1353
|
+
<div id="strokeprofile" class="member">
|
|
1354
|
+
<div class="member-link">
|
|
1355
|
+
<a name="strokeprofile" href="#strokeprofile"><tt><b>strokeProfile</b></tt></a>
|
|
1356
|
+
</div>
|
|
1357
|
+
<div class="member-description hidden">
|
|
1358
|
+
|
|
1359
|
+
<div class="member-text">
|
|
1360
|
+
<p>The stroke profile of the path: the stops along it that set the pen that draws its stroke, an ellipse with a width, as a factor of its <a href="../classes/Style.html#strokewidth"><tt>style.strokeWidth</tt></a>, an aspect and an angle, see <a href="../classes/StrokeProfileStop.html"><tt>StrokeProfileStop</tt></a>. The stops are sorted by their offsets. Between the stops that set a value, it changes along the path, easing into and out of smooth stops and in straight lines from the others, see <a href="../classes/StrokeProfileStop.html#smooth"><tt>strokeProfileStop.smooth</tt></a>, and beyond the ends of open paths, it stays as at the first and last of them. Two stops at the same offset make a step. The stops stay between the same segments when they move. Without a stroke profile, the stroke is drawn with a round pen of the stroke width all along.</p>
|
|
1361
|
+
<p>It is a property of the path, not of its style, as it is tied to its segments. It can be set to stops or plain objects describing them, <code>{ offset, width, aspect, angle, smooth }</code>, and JSON stores them with the indices that tie them to the segments instead of their offsets, <code>{ index, width, aspect, angle, smooth }</code>. Changing the returned array directly isn’t tracked, as with <a href="../classes/Path.html#segments"><tt>segments</tt></a>.</p>
|
|
1362
|
+
<p>The path draws its stroke as the area that the pens sweep, filled with the stroke color, as <a href="../classes/PathItem.html#outline"><tt>pathItem.outline</tt></a>() returns it, and <a href="../classes/Item.html#strokebounds"><tt>item.strokeBounds</tt></a> and hit-testing measure that area. The children of compound paths are drawn with the stroke of their parent, without their profiles. With <a href="../classes/Style.html#strokescaling"><tt>style.strokeScaling</tt></a> off, the profile scales with the view. <a href="../classes/PathItem.html#offset"><tt>pathItem.offset</tt></a>(), the boolean operations, <a href="../classes/PathItem.html#interpolate"><tt>pathItem.interpolate</tt></a>() and SVG export return paths without the profile.</p>
|
|
1363
|
+
|
|
1364
|
+
|
|
1365
|
+
|
|
1366
|
+
<ul class="member-list">
|
|
1367
|
+
<h4>Type:</h4>
|
|
1368
|
+
<li>
|
|
1369
|
+
Array of <a href="../classes/StrokeProfileStop.html"><tt>StrokeProfileStop</tt></a> objects⟋<tt>null</tt>
|
|
1370
|
+
</li>
|
|
1371
|
+
</ul>
|
|
1372
|
+
|
|
1373
|
+
|
|
1374
|
+
<h4>Example:</h4>
|
|
1375
|
+
|
|
1376
|
+
|
|
1377
|
+
<pre><code>var path = new Path.Line([20, 50], [180, 50]);
|
|
1378
|
+
path.strokeColor = 'black';
|
|
1379
|
+
path.strokeWidth = 10;
|
|
1380
|
+
// Taper the stroke from half its width to twice its width:
|
|
1381
|
+
path.strokeProfile = [
|
|
1382
|
+
{ offset: 0, width: 0.5 },
|
|
1383
|
+
{ offset: path.length, width: 2 }
|
|
1384
|
+
];
|
|
1385
|
+
console.log(path.getStrokeProfileAt(80).width); // 1.25</code></pre>
|
|
1386
|
+
|
|
1387
|
+
</div>
|
|
1388
|
+
|
|
1389
|
+
</div>
|
|
1390
|
+
</div>
|
|
1391
|
+
|
|
1392
|
+
|
|
1353
1393
|
<div id="segments" class="member">
|
|
1354
1394
|
<div class="member-link">
|
|
1355
1395
|
<a name="segments" href="#segments"><tt><b>segments</b></tt></a>
|
|
@@ -1357,7 +1397,7 @@ var path = new Path.Star({
|
|
|
1357
1397
|
<div class="member-description hidden">
|
|
1358
1398
|
|
|
1359
1399
|
<div class="member-text">
|
|
1360
|
-
<p>The segments contained within the path.</p>
|
|
1400
|
+
<p>The segments contained within the path. Segments that define a <a href="../classes/Segment.html#name"><tt>segment.name</tt></a> can also be accessed by name.</p>
|
|
1361
1401
|
|
|
1362
1402
|
|
|
1363
1403
|
|
|
@@ -1369,7 +1409,28 @@ var path = new Path.Star({
|
|
|
1369
1409
|
</ul>
|
|
1370
1410
|
|
|
1371
1411
|
|
|
1372
|
-
|
|
1412
|
+
<h4>Example:<span class="description">Accessing segments by name:</span></h4>
|
|
1413
|
+
|
|
1414
|
+
<div class="paperscript split">
|
|
1415
|
+
|
|
1416
|
+
<div class="buttons">
|
|
1417
|
+
<div class="button run">Run</div>
|
|
1418
|
+
</div>
|
|
1419
|
+
|
|
1420
|
+
<script type="text/paperscript" canvas="canvas-24">
|
|
1421
|
+
var path = new Path([20, 80], [50, 20], [80, 80]);
|
|
1422
|
+
path.strokeColor = 'black';
|
|
1423
|
+
|
|
1424
|
+
// Set the name of the top segment:
|
|
1425
|
+
path.segments[1].name = 'top';
|
|
1426
|
+
|
|
1427
|
+
// The segment can be accessed by name:
|
|
1428
|
+
path.segments['top'].point.y += 20;
|
|
1429
|
+
</script>
|
|
1430
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-24"></canvas></div>
|
|
1431
|
+
</div>
|
|
1432
|
+
|
|
1433
|
+
|
|
1373
1434
|
</div>
|
|
1374
1435
|
|
|
1375
1436
|
</div>
|
|
@@ -1543,7 +1604,7 @@ var path = new Path.Star({
|
|
|
1543
1604
|
<div class="button run">Run</div>
|
|
1544
1605
|
</div>
|
|
1545
1606
|
|
|
1546
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1607
|
+
<script type="text/paperscript" canvas="canvas-25">
|
|
1547
1608
|
var myPath = new Path();
|
|
1548
1609
|
myPath.strokeColor = 'black';
|
|
1549
1610
|
myPath.add(new Point(50, 75));
|
|
@@ -1553,7 +1614,7 @@ myPath.add(new Point(150, 75));
|
|
|
1553
1614
|
// Close the path:
|
|
1554
1615
|
myPath.closed = true;
|
|
1555
1616
|
</script>
|
|
1556
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1617
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-25"></canvas></div>
|
|
1557
1618
|
</div>
|
|
1558
1619
|
|
|
1559
1620
|
|
|
@@ -1646,7 +1707,7 @@ myPath.closed = true;
|
|
|
1646
1707
|
<div class="button run">Run</div>
|
|
1647
1708
|
</div>
|
|
1648
1709
|
|
|
1649
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1710
|
+
<script type="text/paperscript" canvas="canvas-26">
|
|
1650
1711
|
var path = new Path.Circle({
|
|
1651
1712
|
center: [80, 50],
|
|
1652
1713
|
radius: 35
|
|
@@ -1674,7 +1735,7 @@ if (path2.fullySelected) {
|
|
|
1674
1735
|
path2.fillColor = 'red';
|
|
1675
1736
|
}
|
|
1676
1737
|
</script>
|
|
1677
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1738
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-26"></canvas></div>
|
|
1678
1739
|
</div>
|
|
1679
1740
|
|
|
1680
1741
|
|
|
@@ -1694,6 +1755,59 @@ if (path2.fullySelected) {
|
|
|
1694
1755
|
<h2>Methods</h2>
|
|
1695
1756
|
|
|
1696
1757
|
|
|
1758
|
+
<div id="getstrokeprofileat-offset" class="member">
|
|
1759
|
+
<div class="member-link">
|
|
1760
|
+
<a name="getstrokeprofileat-offset" href="#getstrokeprofileat-offset"><tt><b>getStrokeProfileAt</b>(offset)</tt></a>
|
|
1761
|
+
</div>
|
|
1762
|
+
<div class="member-description hidden">
|
|
1763
|
+
<div class="member-text">
|
|
1764
|
+
<p>Returns the pen of the <a href="../classes/Path.html#strokeprofile"><tt>strokeProfile</tt></a> at the given offset along the path, as a stop that isn’t on the path, with all its values: its width as a factor of the <a href="../classes/Style.html#strokewidth"><tt>style.strokeWidth</tt></a>, its aspect and its angle, <code>1</code>, <code>1</code> and <code>0</code> where no stop sets them. Where the profile has a step, it returns the values after it. Adding the stop to the profile keeps the values at the offset, and where they change in straight lines, also around it if the stop isn’t smooth. As a smooth stop, the values ease into it and out of it.</p>
|
|
1765
|
+
|
|
1766
|
+
|
|
1767
|
+
<ul class="member-list">
|
|
1768
|
+
<h4>Parameters:</h4>
|
|
1769
|
+
|
|
1770
|
+
<li>
|
|
1771
|
+
<tt>offset:</tt>
|
|
1772
|
+
<tt>Number</tt>
|
|
1773
|
+
— the offset on the path, where <code>0</code> is at the beginning of the path and <a href="../classes/Path.html#length"><tt>path.length</tt></a> at the end
|
|
1774
|
+
|
|
1775
|
+
</li>
|
|
1776
|
+
|
|
1777
|
+
</ul>
|
|
1778
|
+
|
|
1779
|
+
|
|
1780
|
+
<ul class="member-list">
|
|
1781
|
+
<h4>Returns:</h4>
|
|
1782
|
+
|
|
1783
|
+
<li>
|
|
1784
|
+
<tt><a href="../classes/StrokeProfileStop.html"><tt>StrokeProfileStop</tt></a></tt> — the pen at the offset
|
|
1785
|
+
</li>
|
|
1786
|
+
|
|
1787
|
+
|
|
1788
|
+
</ul>
|
|
1789
|
+
|
|
1790
|
+
|
|
1791
|
+
|
|
1792
|
+
|
|
1793
|
+
<h4>Example:</h4>
|
|
1794
|
+
|
|
1795
|
+
|
|
1796
|
+
<pre><code>var path = new Path.Line([20, 50], [180, 50]);
|
|
1797
|
+
path.strokeProfile = [
|
|
1798
|
+
{ offset: 0, width: 0.5 },
|
|
1799
|
+
{ offset: path.length, width: 2, angle: 90 }
|
|
1800
|
+
];
|
|
1801
|
+
// Add a stop halfway, with the values there:
|
|
1802
|
+
var stop = path.getStrokeProfileAt(path.length / 2);
|
|
1803
|
+
console.log(stop.width, stop.aspect, stop.angle); // 1.25 1 90
|
|
1804
|
+
path.strokeProfile = path.strokeProfile.concat(stop);</code></pre>
|
|
1805
|
+
|
|
1806
|
+
</div>
|
|
1807
|
+
</div>
|
|
1808
|
+
</div>
|
|
1809
|
+
|
|
1810
|
+
|
|
1697
1811
|
<div id="add-segment" class="member">
|
|
1698
1812
|
<div class="member-link">
|
|
1699
1813
|
<a name="add-segment" href="#add-segment"><tt><b>add</b>(...segment)</tt></a>
|
|
@@ -1737,7 +1851,7 @@ if (path2.fullySelected) {
|
|
|
1737
1851
|
<div class="button run">Run</div>
|
|
1738
1852
|
</div>
|
|
1739
1853
|
|
|
1740
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1854
|
+
<script type="text/paperscript" canvas="canvas-27">
|
|
1741
1855
|
var path = new Path({
|
|
1742
1856
|
strokeColor: 'black'
|
|
1743
1857
|
});
|
|
@@ -1749,7 +1863,7 @@ path.add(new Point(30, 75));
|
|
|
1749
1863
|
// and {x: 170, y: 75}:
|
|
1750
1864
|
path.add(new Point(100, 20), new Point(170, 75));
|
|
1751
1865
|
</script>
|
|
1752
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1866
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-27"></canvas></div>
|
|
1753
1867
|
</div>
|
|
1754
1868
|
|
|
1755
1869
|
|
|
@@ -1761,7 +1875,7 @@ path.add(new Point(100, 20), new Point(170, 75));
|
|
|
1761
1875
|
<div class="button run">Run</div>
|
|
1762
1876
|
</div>
|
|
1763
1877
|
|
|
1764
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1878
|
+
<script type="text/paperscript" canvas="canvas-28">
|
|
1765
1879
|
var path = new Path({
|
|
1766
1880
|
strokeColor: 'black'
|
|
1767
1881
|
});
|
|
@@ -1773,7 +1887,7 @@ path.add([30, 75]);
|
|
|
1773
1887
|
// and {x: 170, y: 75}:
|
|
1774
1888
|
path.add([100, 20], [170, 75]);
|
|
1775
1889
|
</script>
|
|
1776
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1890
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-28"></canvas></div>
|
|
1777
1891
|
</div>
|
|
1778
1892
|
|
|
1779
1893
|
|
|
@@ -1785,7 +1899,7 @@ path.add([100, 20], [170, 75]);
|
|
|
1785
1899
|
<div class="button run">Run</div>
|
|
1786
1900
|
</div>
|
|
1787
1901
|
|
|
1788
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1902
|
+
<script type="text/paperscript" canvas="canvas-29">
|
|
1789
1903
|
var path = new Path({
|
|
1790
1904
|
strokeColor: 'black'
|
|
1791
1905
|
});
|
|
@@ -1797,7 +1911,7 @@ path.add({x: 30, y: 75});
|
|
|
1797
1911
|
// and {x: 170, y: 75}:
|
|
1798
1912
|
path.add({x: 100, y: 20}, {x: 170, y: 75});
|
|
1799
1913
|
</script>
|
|
1800
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1914
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-29"></canvas></div>
|
|
1801
1915
|
</div>
|
|
1802
1916
|
|
|
1803
1917
|
|
|
@@ -1809,7 +1923,7 @@ path.add({x: 100, y: 20}, {x: 170, y: 75});
|
|
|
1809
1923
|
<div class="button run">Run</div>
|
|
1810
1924
|
</div>
|
|
1811
1925
|
|
|
1812
|
-
<script type="text/paperscript" canvas="canvas-
|
|
1926
|
+
<script type="text/paperscript" canvas="canvas-30">
|
|
1813
1927
|
var path = new Path({
|
|
1814
1928
|
strokeColor: 'black'
|
|
1815
1929
|
});
|
|
@@ -1827,7 +1941,7 @@ added.selected = true;
|
|
|
1827
1941
|
|
|
1828
1942
|
path.add(new Point(170, 75));
|
|
1829
1943
|
</script>
|
|
1830
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
1944
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-30"></canvas></div>
|
|
1831
1945
|
</div>
|
|
1832
1946
|
|
|
1833
1947
|
|
|
@@ -1886,7 +2000,7 @@ path.add(new Point(170, 75));
|
|
|
1886
2000
|
<div class="button run">Run</div>
|
|
1887
2001
|
</div>
|
|
1888
2002
|
|
|
1889
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2003
|
+
<script type="text/paperscript" canvas="canvas-31">
|
|
1890
2004
|
var myPath = new Path();
|
|
1891
2005
|
myPath.strokeColor = 'black';
|
|
1892
2006
|
myPath.add(new Point(50, 75));
|
|
@@ -1898,7 +2012,7 @@ myPath.insert(1, new Point(100, 25));
|
|
|
1898
2012
|
// Select the segment which we just inserted:
|
|
1899
2013
|
myPath.segments[1].selected = true;
|
|
1900
2014
|
</script>
|
|
1901
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2015
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-31"></canvas></div>
|
|
1902
2016
|
</div>
|
|
1903
2017
|
|
|
1904
2018
|
|
|
@@ -1910,7 +2024,7 @@ myPath.segments[1].selected = true;
|
|
|
1910
2024
|
<div class="button run">Run</div>
|
|
1911
2025
|
</div>
|
|
1912
2026
|
|
|
1913
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2027
|
+
<script type="text/paperscript" canvas="canvas-32">
|
|
1914
2028
|
var myPath = new Path();
|
|
1915
2029
|
myPath.strokeColor = 'black';
|
|
1916
2030
|
myPath.add(new Point(50, 75));
|
|
@@ -1923,7 +2037,7 @@ myPath.insert(1, [80, 25], [120, 25]);
|
|
|
1923
2037
|
myPath.segments[1].selected = true;
|
|
1924
2038
|
myPath.segments[2].selected = true;
|
|
1925
2039
|
</script>
|
|
1926
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2040
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-32"></canvas></div>
|
|
1927
2041
|
</div>
|
|
1928
2042
|
|
|
1929
2043
|
|
|
@@ -1975,14 +2089,14 @@ Array of <a href="../classes/Segment.html"><tt>Segment</tt></a> objects
|
|
|
1975
2089
|
<div class="button run">Run</div>
|
|
1976
2090
|
</div>
|
|
1977
2091
|
|
|
1978
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2092
|
+
<script type="text/paperscript" canvas="canvas-33">
|
|
1979
2093
|
var path = new Path({
|
|
1980
2094
|
strokeColor: 'black'
|
|
1981
2095
|
});
|
|
1982
2096
|
var points = [new Point(30, 50), new Point(170, 50)];
|
|
1983
2097
|
path.addSegments(points);
|
|
1984
2098
|
</script>
|
|
1985
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2099
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-33"></canvas></div>
|
|
1986
2100
|
</div>
|
|
1987
2101
|
|
|
1988
2102
|
|
|
@@ -1994,14 +2108,14 @@ path.addSegments(points);
|
|
|
1994
2108
|
<div class="button run">Run</div>
|
|
1995
2109
|
</div>
|
|
1996
2110
|
|
|
1997
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2111
|
+
<script type="text/paperscript" canvas="canvas-34">
|
|
1998
2112
|
var path = new Path({
|
|
1999
2113
|
strokeColor: 'black'
|
|
2000
2114
|
});
|
|
2001
2115
|
var array = [[30, 75], [100, 20], [170, 75]];
|
|
2002
2116
|
path.addSegments(array);
|
|
2003
2117
|
</script>
|
|
2004
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2118
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-34"></canvas></div>
|
|
2005
2119
|
</div>
|
|
2006
2120
|
|
|
2007
2121
|
|
|
@@ -2013,7 +2127,7 @@ path.addSegments(array);
|
|
|
2013
2127
|
<div class="button run">Run</div>
|
|
2014
2128
|
</div>
|
|
2015
2129
|
|
|
2016
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2130
|
+
<script type="text/paperscript" canvas="canvas-35">
|
|
2017
2131
|
var path = new Path({
|
|
2018
2132
|
strokeColor: 'black'
|
|
2019
2133
|
});
|
|
@@ -2028,7 +2142,7 @@ path2.add(path.segments[1], path.segments[2]);
|
|
|
2028
2142
|
// Move path2 30pt to the right:
|
|
2029
2143
|
path2.position.x += 30;
|
|
2030
2144
|
</script>
|
|
2031
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2145
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-35"></canvas></div>
|
|
2032
2146
|
</div>
|
|
2033
2147
|
|
|
2034
2148
|
|
|
@@ -2128,7 +2242,7 @@ Array of <a href="../classes/Segment.html"><tt>Segment</tt></a> objects
|
|
|
2128
2242
|
<div class="button run">Run</div>
|
|
2129
2243
|
</div>
|
|
2130
2244
|
|
|
2131
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2245
|
+
<script type="text/paperscript" canvas="canvas-36">
|
|
2132
2246
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2133
2247
|
// with a radius of 35:
|
|
2134
2248
|
var path = new Path.Circle({
|
|
@@ -2143,7 +2257,7 @@ path.removeSegment(1);
|
|
|
2143
2257
|
// Select the path, so we can see its segments:
|
|
2144
2258
|
path.selected = true;
|
|
2145
2259
|
</script>
|
|
2146
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2260
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-36"></canvas></div>
|
|
2147
2261
|
</div>
|
|
2148
2262
|
|
|
2149
2263
|
|
|
@@ -2231,7 +2345,7 @@ path.selected = true;
|
|
|
2231
2345
|
<div class="button run">Run</div>
|
|
2232
2346
|
</div>
|
|
2233
2347
|
|
|
2234
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2348
|
+
<script type="text/paperscript" canvas="canvas-37">
|
|
2235
2349
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
2236
2350
|
// with a radius of 35:
|
|
2237
2351
|
var path = new Path.Circle({
|
|
@@ -2246,7 +2360,7 @@ path.removeSegments(1, 2);
|
|
|
2246
2360
|
// Select the path, so we can see its segments:
|
|
2247
2361
|
path.selected = true;
|
|
2248
2362
|
</script>
|
|
2249
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2363
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-37"></canvas></div>
|
|
2250
2364
|
</div>
|
|
2251
2365
|
|
|
2252
2366
|
|
|
@@ -2261,7 +2375,7 @@ path.selected = true;
|
|
|
2261
2375
|
</div>
|
|
2262
2376
|
<div class="member-description hidden">
|
|
2263
2377
|
<div class="member-text">
|
|
2264
|
-
<p>Checks if any of the curves in the path have curve handles set.</p>
|
|
2378
|
+
<p>Checks if any of the curves in the path have curve handles set. Handles of which both coordinates are 0 within a tolerance of 1e-12 count as not set, see <a href="../classes/Point.html#iszero"><tt>point.isZero</tt></a>().</p>
|
|
2265
2379
|
|
|
2266
2380
|
|
|
2267
2381
|
|
|
@@ -2403,7 +2517,7 @@ path.selected = true;
|
|
|
2403
2517
|
<div class="button run">Run</div>
|
|
2404
2518
|
</div>
|
|
2405
2519
|
|
|
2406
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2520
|
+
<script type="text/paperscript" canvas="canvas-38">
|
|
2407
2521
|
var path = new Path.Circle({
|
|
2408
2522
|
center: view.center,
|
|
2409
2523
|
radius: 40,
|
|
@@ -2420,7 +2534,7 @@ var location = path.getNearestLocation(pointOnCircle);
|
|
|
2420
2534
|
path.splitAt(location);
|
|
2421
2535
|
path.lastSegment.selected = true;
|
|
2422
2536
|
</script>
|
|
2423
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2537
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-38"></canvas></div>
|
|
2424
2538
|
</div>
|
|
2425
2539
|
|
|
2426
2540
|
|
|
@@ -2432,7 +2546,7 @@ path.lastSegment.selected = true;
|
|
|
2432
2546
|
<div class="button run">Run</div>
|
|
2433
2547
|
</div>
|
|
2434
2548
|
|
|
2435
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2549
|
+
<script type="text/paperscript" canvas="canvas-39">
|
|
2436
2550
|
var path = new Path([20, 20], [50, 80], [80, 20]);
|
|
2437
2551
|
path.strokeColor = 'black';
|
|
2438
2552
|
|
|
@@ -2444,7 +2558,7 @@ var path2 = path.splitAt(path.length / 2);
|
|
|
2444
2558
|
path2.strokeColor = 'red';
|
|
2445
2559
|
path2.position.x += 20;
|
|
2446
2560
|
</script>
|
|
2447
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2561
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-39"></canvas></div>
|
|
2448
2562
|
</div>
|
|
2449
2563
|
|
|
2450
2564
|
|
|
@@ -2456,7 +2570,7 @@ path2.position.x += 20;
|
|
|
2456
2570
|
<div class="button run">Run</div>
|
|
2457
2571
|
</div>
|
|
2458
2572
|
|
|
2459
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2573
|
+
<script type="text/paperscript" canvas="canvas-40">
|
|
2460
2574
|
var path = new Path.Rectangle({
|
|
2461
2575
|
from: [20, 20],
|
|
2462
2576
|
to: [80, 80],
|
|
@@ -2473,7 +2587,7 @@ path.firstSegment.point.x += 20;
|
|
|
2473
2587
|
// Select the first segment:
|
|
2474
2588
|
path.firstSegment.selected = true;
|
|
2475
2589
|
</script>
|
|
2476
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2590
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-40"></canvas></div>
|
|
2477
2591
|
</div>
|
|
2478
2592
|
|
|
2479
2593
|
|
|
@@ -2523,7 +2637,7 @@ path.firstSegment.selected = true;
|
|
|
2523
2637
|
<div class="button run">Run</div>
|
|
2524
2638
|
</div>
|
|
2525
2639
|
|
|
2526
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2640
|
+
<script type="text/paperscript" canvas="canvas-41">
|
|
2527
2641
|
var path = new Path({
|
|
2528
2642
|
segments: [[30, 25], [30, 75]],
|
|
2529
2643
|
strokeColor: 'black'
|
|
@@ -2537,7 +2651,7 @@ var path2 = new Path({
|
|
|
2537
2651
|
// Join the paths:
|
|
2538
2652
|
path.join(path2);
|
|
2539
2653
|
</script>
|
|
2540
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2654
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-41"></canvas></div>
|
|
2541
2655
|
</div>
|
|
2542
2656
|
|
|
2543
2657
|
|
|
@@ -2549,7 +2663,7 @@ path.join(path2);
|
|
|
2549
2663
|
<div class="button run">Run</div>
|
|
2550
2664
|
</div>
|
|
2551
2665
|
|
|
2552
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2666
|
+
<script type="text/paperscript" canvas="canvas-42">
|
|
2553
2667
|
var path = new Path({
|
|
2554
2668
|
segments: [[30, 25], [30, 75]],
|
|
2555
2669
|
strokeColor: 'black'
|
|
@@ -2570,7 +2684,7 @@ path.join(path2);
|
|
|
2570
2684
|
// Select the path to show that they have joined:
|
|
2571
2685
|
path.selected = true;
|
|
2572
2686
|
</script>
|
|
2573
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2687
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-42"></canvas></div>
|
|
2574
2688
|
</div>
|
|
2575
2689
|
|
|
2576
2690
|
|
|
@@ -2582,7 +2696,7 @@ path.selected = true;
|
|
|
2582
2696
|
<div class="button run">Run</div>
|
|
2583
2697
|
</div>
|
|
2584
2698
|
|
|
2585
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2699
|
+
<script type="text/paperscript" canvas="canvas-43">
|
|
2586
2700
|
var path = new Path({
|
|
2587
2701
|
segments: [[30, 25], [80, 25], [80, 75]],
|
|
2588
2702
|
strokeColor: 'black'
|
|
@@ -2602,7 +2716,7 @@ path.join(path2);
|
|
|
2602
2716
|
// Select the path to show that they have joined:
|
|
2603
2717
|
path.selected = true;
|
|
2604
2718
|
</script>
|
|
2605
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
2719
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-43"></canvas></div>
|
|
2606
2720
|
</div>
|
|
2607
2721
|
|
|
2608
2722
|
|
|
@@ -2871,7 +2985,7 @@ path.selected = true;
|
|
|
2871
2985
|
<div class="button run">Run</div>
|
|
2872
2986
|
</div>
|
|
2873
2987
|
|
|
2874
|
-
<script type="text/paperscript" canvas="canvas-
|
|
2988
|
+
<script type="text/paperscript" canvas="canvas-44">
|
|
2875
2989
|
// Create an arc shaped path:
|
|
2876
2990
|
var path = new Path({
|
|
2877
2991
|
strokeColor: 'black'
|
|
@@ -2894,7 +3008,7 @@ var circle = new Path.Circle({
|
|
|
2894
3008
|
fillColor: 'red'
|
|
2895
3009
|
});
|
|
2896
3010
|
</script>
|
|
2897
|
-
<div class="canvas"><canvas width="516" height="150" id="canvas-
|
|
3011
|
+
<div class="canvas"><canvas width="516" height="150" id="canvas-44"></canvas></div>
|
|
2898
3012
|
</div>
|
|
2899
3013
|
|
|
2900
3014
|
|
|
@@ -2906,7 +3020,7 @@ var circle = new Path.Circle({
|
|
|
2906
3020
|
<div class="button run">Run</div>
|
|
2907
3021
|
</div>
|
|
2908
3022
|
|
|
2909
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3023
|
+
<script type="text/paperscript" canvas="canvas-45">
|
|
2910
3024
|
// Create an arc shaped path:
|
|
2911
3025
|
var path = new Path({
|
|
2912
3026
|
strokeColor: 'black'
|
|
@@ -2931,7 +3045,7 @@ for (var i = 0; i < amount + 1; i++) {
|
|
|
2931
3045
|
});
|
|
2932
3046
|
}
|
|
2933
3047
|
</script>
|
|
2934
|
-
<div class="canvas"><canvas width="516" height="150" id="canvas-
|
|
3048
|
+
<div class="canvas"><canvas width="516" height="150" id="canvas-45"></canvas></div>
|
|
2935
3049
|
</div>
|
|
2936
3050
|
|
|
2937
3051
|
|
|
@@ -2983,7 +3097,7 @@ for (var i = 0; i < amount + 1; i++) {
|
|
|
2983
3097
|
<div class="button run">Run</div>
|
|
2984
3098
|
</div>
|
|
2985
3099
|
|
|
2986
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3100
|
+
<script type="text/paperscript" canvas="canvas-46">
|
|
2987
3101
|
// Create an arc shaped path:
|
|
2988
3102
|
var path = new Path({
|
|
2989
3103
|
strokeColor: 'black'
|
|
@@ -3008,7 +3122,7 @@ var line = new Path({
|
|
|
3008
3122
|
strokeColor: 'red'
|
|
3009
3123
|
})
|
|
3010
3124
|
</script>
|
|
3011
|
-
<div class="canvas"><canvas width="516" height="150" id="canvas-
|
|
3125
|
+
<div class="canvas"><canvas width="516" height="150" id="canvas-46"></canvas></div>
|
|
3012
3126
|
</div>
|
|
3013
3127
|
|
|
3014
3128
|
|
|
@@ -3020,7 +3134,7 @@ var line = new Path({
|
|
|
3020
3134
|
<div class="button run">Run</div>
|
|
3021
3135
|
</div>
|
|
3022
3136
|
|
|
3023
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3137
|
+
<script type="text/paperscript" canvas="canvas-47">
|
|
3024
3138
|
// Create an arc shaped path:
|
|
3025
3139
|
var path = new Path({
|
|
3026
3140
|
strokeColor: 'black'
|
|
@@ -3047,7 +3161,7 @@ for (var i = 0; i < amount + 1; i++) {
|
|
|
3047
3161
|
})
|
|
3048
3162
|
}
|
|
3049
3163
|
</script>
|
|
3050
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
3164
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-47"></canvas></div>
|
|
3051
3165
|
</div>
|
|
3052
3166
|
|
|
3053
3167
|
|
|
@@ -3099,7 +3213,7 @@ for (var i = 0; i < amount + 1; i++) {
|
|
|
3099
3213
|
<div class="button run">Run</div>
|
|
3100
3214
|
</div>
|
|
3101
3215
|
|
|
3102
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3216
|
+
<script type="text/paperscript" canvas="canvas-48">
|
|
3103
3217
|
// Create an arc shaped path:
|
|
3104
3218
|
var path = new Path({
|
|
3105
3219
|
strokeColor: 'black'
|
|
@@ -3124,7 +3238,7 @@ var line = new Path({
|
|
|
3124
3238
|
strokeColor: 'red'
|
|
3125
3239
|
});
|
|
3126
3240
|
</script>
|
|
3127
|
-
<div class="canvas"><canvas width="516" height="150" id="canvas-
|
|
3241
|
+
<div class="canvas"><canvas width="516" height="150" id="canvas-48"></canvas></div>
|
|
3128
3242
|
</div>
|
|
3129
3243
|
|
|
3130
3244
|
|
|
@@ -3136,7 +3250,7 @@ var line = new Path({
|
|
|
3136
3250
|
<div class="button run">Run</div>
|
|
3137
3251
|
</div>
|
|
3138
3252
|
|
|
3139
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3253
|
+
<script type="text/paperscript" canvas="canvas-49">
|
|
3140
3254
|
// Create an arc shaped path:
|
|
3141
3255
|
var path = new Path({
|
|
3142
3256
|
strokeColor: 'black'
|
|
@@ -3163,7 +3277,7 @@ for (var i = 0; i < amount + 1; i++) {
|
|
|
3163
3277
|
});
|
|
3164
3278
|
}
|
|
3165
3279
|
</script>
|
|
3166
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
3280
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-49"></canvas></div>
|
|
3167
3281
|
</div>
|
|
3168
3282
|
|
|
3169
3283
|
|
|
@@ -3346,6 +3460,91 @@ for (var i = 0; i < amount + 1; i++) {
|
|
|
3346
3460
|
<div class="reference-members"><h2>Properties inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
3347
3461
|
|
|
3348
3462
|
|
|
3463
|
+
<div id="effects" class="member">
|
|
3464
|
+
<div class="member-link">
|
|
3465
|
+
<a name="effects" href="#effects"><tt><b>effects</b></tt></a>
|
|
3466
|
+
</div>
|
|
3467
|
+
<div class="member-description hidden">
|
|
3468
|
+
|
|
3469
|
+
<div class="member-text">
|
|
3470
|
+
<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,
|
|
3471
|
+
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>
|
|
3472
|
+
<p>Paper.js has these effects, and <a href="../classes/Effect.html"><tt>Effect</tt></a> creates more:</p>
|
|
3473
|
+
<ul>
|
|
3474
|
+
<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>
|
|
3475
|
+
<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>
|
|
3476
|
+
</ul>
|
|
3477
|
+
|
|
3478
|
+
|
|
3479
|
+
|
|
3480
|
+
<ul class="member-list">
|
|
3481
|
+
<h4>Type:</h4>
|
|
3482
|
+
<li>
|
|
3483
|
+
Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects
|
|
3484
|
+
</li>
|
|
3485
|
+
</ul>
|
|
3486
|
+
|
|
3487
|
+
|
|
3488
|
+
<h4>Example:</h4>
|
|
3489
|
+
|
|
3490
|
+
<div class="paperscript split">
|
|
3491
|
+
|
|
3492
|
+
<div class="buttons">
|
|
3493
|
+
<div class="button run">Run</div>
|
|
3494
|
+
</div>
|
|
3495
|
+
|
|
3496
|
+
<script type="text/paperscript" canvas="canvas-50">
|
|
3497
|
+
var path = new Path.Star({
|
|
3498
|
+
center: view.center,
|
|
3499
|
+
points: 5,
|
|
3500
|
+
radius1: 20,
|
|
3501
|
+
radius2: 40,
|
|
3502
|
+
strokeColor: 'black',
|
|
3503
|
+
strokeWidth: 8
|
|
3504
|
+
});
|
|
3505
|
+
path.effects = [
|
|
3506
|
+
{ type: 'offset', parameters: { distance: 10, join: 'round' } },
|
|
3507
|
+
{ type: 'outline' }
|
|
3508
|
+
];
|
|
3509
|
+
</script>
|
|
3510
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-50"></canvas></div>
|
|
3511
|
+
</div>
|
|
3512
|
+
|
|
3513
|
+
|
|
3514
|
+
</div>
|
|
3515
|
+
|
|
3516
|
+
</div>
|
|
3517
|
+
</div>
|
|
3518
|
+
|
|
3519
|
+
|
|
3520
|
+
<div id="previewbounds-matrix" class="member">
|
|
3521
|
+
<div class="member-link">
|
|
3522
|
+
<a name="previewbounds-matrix" href="#previewbounds-matrix"><tt><b>previewBounds</b></tt></a>
|
|
3523
|
+
</div>
|
|
3524
|
+
<div class="member-description hidden">
|
|
3525
|
+
|
|
3526
|
+
<div class="member-text">
|
|
3527
|
+
<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>
|
|
3528
|
+
|
|
3529
|
+
<p>Read only.</p>
|
|
3530
|
+
|
|
3531
|
+
|
|
3532
|
+
|
|
3533
|
+
<ul class="member-list">
|
|
3534
|
+
<h4>Type:</h4>
|
|
3535
|
+
<li>
|
|
3536
|
+
<a href="../classes/Rectangle.html"><tt>Rectangle</tt></a>
|
|
3537
|
+
</li>
|
|
3538
|
+
</ul>
|
|
3539
|
+
|
|
3540
|
+
|
|
3541
|
+
|
|
3542
|
+
</div>
|
|
3543
|
+
|
|
3544
|
+
</div>
|
|
3545
|
+
</div>
|
|
3546
|
+
|
|
3547
|
+
|
|
3349
3548
|
<div id="key" class="member">
|
|
3350
3549
|
<div class="member-link">
|
|
3351
3550
|
<a name="key" href="#key"><tt><b>key</b></tt></a>
|
|
@@ -3458,7 +3657,7 @@ for (var i = 0; i < amount + 1; i++) {
|
|
|
3458
3657
|
<div class="button run">Run</div>
|
|
3459
3658
|
</div>
|
|
3460
3659
|
|
|
3461
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3660
|
+
<script type="text/paperscript" canvas="canvas-51">
|
|
3462
3661
|
var path = new Path.Circle({
|
|
3463
3662
|
center: [80, 50],
|
|
3464
3663
|
radius: 35
|
|
@@ -3473,7 +3672,7 @@ group.addChild(path);
|
|
|
3473
3672
|
// The path can be accessed by name:
|
|
3474
3673
|
group.children['example'].fillColor = 'red';
|
|
3475
3674
|
</script>
|
|
3476
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3675
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-51"></canvas></div>
|
|
3477
3676
|
</div>
|
|
3478
3677
|
|
|
3479
3678
|
|
|
@@ -3511,7 +3710,7 @@ group.children['example'].fillColor = 'red';
|
|
|
3511
3710
|
<div class="button run">Run</div>
|
|
3512
3711
|
</div>
|
|
3513
3712
|
|
|
3514
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3713
|
+
<script type="text/paperscript" canvas="canvas-52">
|
|
3515
3714
|
var circle = new Path.Circle({
|
|
3516
3715
|
center: [80, 50],
|
|
3517
3716
|
radius: 30
|
|
@@ -3522,7 +3721,7 @@ circle.style = {
|
|
|
3522
3721
|
strokeWidth: 5
|
|
3523
3722
|
};
|
|
3524
3723
|
</script>
|
|
3525
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3724
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-52"></canvas></div>
|
|
3526
3725
|
</div>
|
|
3527
3726
|
|
|
3528
3727
|
|
|
@@ -3534,7 +3733,7 @@ circle.style = {
|
|
|
3534
3733
|
<div class="button run">Run</div>
|
|
3535
3734
|
</div>
|
|
3536
3735
|
|
|
3537
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3736
|
+
<script type="text/paperscript" canvas="canvas-53">
|
|
3538
3737
|
var path = new Path.Circle({
|
|
3539
3738
|
center: [50, 50],
|
|
3540
3739
|
radius: 30,
|
|
@@ -3549,7 +3748,7 @@ var path2 = new Path.Circle({
|
|
|
3549
3748
|
// Copy the path style of path:
|
|
3550
3749
|
path2.style = path.style;
|
|
3551
3750
|
</script>
|
|
3552
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3751
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-53"></canvas></div>
|
|
3553
3752
|
</div>
|
|
3554
3753
|
|
|
3555
3754
|
|
|
@@ -3561,7 +3760,7 @@ path2.style = path.style;
|
|
|
3561
3760
|
<div class="button run">Run</div>
|
|
3562
3761
|
</div>
|
|
3563
3762
|
|
|
3564
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3763
|
+
<script type="text/paperscript" canvas="canvas-54">
|
|
3565
3764
|
var myStyle = {
|
|
3566
3765
|
fillColor: 'red',
|
|
3567
3766
|
strokeColor: 'blue',
|
|
@@ -3580,7 +3779,7 @@ var path2 = new Path.Circle({
|
|
|
3580
3779
|
});
|
|
3581
3780
|
path2.style = myStyle;
|
|
3582
3781
|
</script>
|
|
3583
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3782
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-54"></canvas></div>
|
|
3584
3783
|
</div>
|
|
3585
3784
|
|
|
3586
3785
|
|
|
@@ -3622,7 +3821,7 @@ path2.style = myStyle;
|
|
|
3622
3821
|
<div class="button run">Run</div>
|
|
3623
3822
|
</div>
|
|
3624
3823
|
|
|
3625
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3824
|
+
<script type="text/paperscript" canvas="canvas-55">
|
|
3626
3825
|
var unlockedItem = new Path.Circle({
|
|
3627
3826
|
center: view.center - [35, 0],
|
|
3628
3827
|
radius: 30,
|
|
@@ -3649,7 +3848,7 @@ new PointText({
|
|
|
3649
3848
|
justification: 'center'
|
|
3650
3849
|
});
|
|
3651
3850
|
</script>
|
|
3652
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3851
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-55"></canvas></div>
|
|
3653
3852
|
</div>
|
|
3654
3853
|
|
|
3655
3854
|
|
|
@@ -3691,7 +3890,7 @@ new PointText({
|
|
|
3691
3890
|
<div class="button run">Run</div>
|
|
3692
3891
|
</div>
|
|
3693
3892
|
|
|
3694
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3893
|
+
<script type="text/paperscript" canvas="canvas-56">
|
|
3695
3894
|
var path = new Path.Circle({
|
|
3696
3895
|
center: [50, 50],
|
|
3697
3896
|
radius: 20,
|
|
@@ -3701,7 +3900,7 @@ var path = new Path.Circle({
|
|
|
3701
3900
|
// Hide the path:
|
|
3702
3901
|
path.visible = false;
|
|
3703
3902
|
</script>
|
|
3704
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3903
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-56"></canvas></div>
|
|
3705
3904
|
</div>
|
|
3706
3905
|
|
|
3707
3906
|
|
|
@@ -3749,7 +3948,7 @@ path.visible = false;
|
|
|
3749
3948
|
<div class="button run">Run</div>
|
|
3750
3949
|
</div>
|
|
3751
3950
|
|
|
3752
|
-
<script type="text/paperscript" canvas="canvas-
|
|
3951
|
+
<script type="text/paperscript" canvas="canvas-57">
|
|
3753
3952
|
// Create a white rectangle in the background
|
|
3754
3953
|
// with the same dimensions as the view:
|
|
3755
3954
|
var background = new Path.Rectangle(view.bounds);
|
|
@@ -3770,7 +3969,7 @@ var circle2 = new Path.Circle({
|
|
|
3770
3969
|
// Set the blend mode of circle2:
|
|
3771
3970
|
circle2.blendMode = 'multiply';
|
|
3772
3971
|
</script>
|
|
3773
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
3972
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-57"></canvas></div>
|
|
3774
3973
|
</div>
|
|
3775
3974
|
|
|
3776
3975
|
|
|
@@ -3812,7 +4011,7 @@ circle2.blendMode = 'multiply';
|
|
|
3812
4011
|
<div class="button run">Run</div>
|
|
3813
4012
|
</div>
|
|
3814
4013
|
|
|
3815
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4014
|
+
<script type="text/paperscript" canvas="canvas-58">
|
|
3816
4015
|
var circle = new Path.Circle({
|
|
3817
4016
|
center: [80, 50],
|
|
3818
4017
|
radius: 35,
|
|
@@ -3830,7 +4029,7 @@ var circle2 = new Path.Circle({
|
|
|
3830
4029
|
// Make circle2 50% transparent:
|
|
3831
4030
|
circle2.opacity = 0.5;
|
|
3832
4031
|
</script>
|
|
3833
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4032
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-58"></canvas></div>
|
|
3834
4033
|
</div>
|
|
3835
4034
|
|
|
3836
4035
|
|
|
@@ -3953,14 +4152,14 @@ circle.textWrap = { offset: 10 };</code></pre>
|
|
|
3953
4152
|
<div class="button run">Run</div>
|
|
3954
4153
|
</div>
|
|
3955
4154
|
|
|
3956
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4155
|
+
<script type="text/paperscript" canvas="canvas-59">
|
|
3957
4156
|
var path = new Path.Circle({
|
|
3958
4157
|
center: [80, 50],
|
|
3959
4158
|
radius: 35
|
|
3960
4159
|
});
|
|
3961
4160
|
path.selected = true; // Select the path
|
|
3962
4161
|
</script>
|
|
3963
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4162
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-59"></canvas></div>
|
|
3964
4163
|
</div>
|
|
3965
4164
|
|
|
3966
4165
|
|
|
@@ -4091,7 +4290,7 @@ console.log(path.data.pets.length); // 1</code></pre>
|
|
|
4091
4290
|
<div class="button run">Run</div>
|
|
4092
4291
|
</div>
|
|
4093
4292
|
|
|
4094
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4293
|
+
<script type="text/paperscript" canvas="canvas-60">
|
|
4095
4294
|
// Create a circle at position { x: 10, y: 10 }
|
|
4096
4295
|
var circle = new Path.Circle({
|
|
4097
4296
|
center: new Point(10, 10),
|
|
@@ -4105,7 +4304,7 @@ circle.position = new Point(20, 20);
|
|
|
4105
4304
|
// Move the circle 100 points to the right and 50 points down
|
|
4106
4305
|
circle.position += new Point(100, 50);
|
|
4107
4306
|
</script>
|
|
4108
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4307
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-60"></canvas></div>
|
|
4109
4308
|
</div>
|
|
4110
4309
|
|
|
4111
4310
|
|
|
@@ -4117,7 +4316,7 @@ circle.position += new Point(100, 50);
|
|
|
4117
4316
|
<div class="button run">Run</div>
|
|
4118
4317
|
</div>
|
|
4119
4318
|
|
|
4120
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4319
|
+
<script type="text/paperscript" canvas="canvas-61">
|
|
4121
4320
|
// Create a circle at position { x: 20, y: 20 }
|
|
4122
4321
|
var circle = new Path.Circle({
|
|
4123
4322
|
center: new Point(20, 20),
|
|
@@ -4128,7 +4327,7 @@ var circle = new Path.Circle({
|
|
|
4128
4327
|
// Move the circle 100 points to the right
|
|
4129
4328
|
circle.position.x += 100;
|
|
4130
4329
|
</script>
|
|
4131
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4330
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-61"></canvas></div>
|
|
4132
4331
|
</div>
|
|
4133
4332
|
|
|
4134
4333
|
|
|
@@ -4654,7 +4853,7 @@ console.log(group.children[0] == path); // true</code></pre>
|
|
|
4654
4853
|
<div class="button run">Run</div>
|
|
4655
4854
|
</div>
|
|
4656
4855
|
|
|
4657
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4856
|
+
<script type="text/paperscript" canvas="canvas-62">
|
|
4658
4857
|
var path = new Path.Circle({
|
|
4659
4858
|
center: [80, 50],
|
|
4660
4859
|
radius: 35
|
|
@@ -4667,7 +4866,7 @@ group.addChild(path);
|
|
|
4667
4866
|
// Access the path through the group's children array:
|
|
4668
4867
|
group.children[0].fillColor = 'red';
|
|
4669
4868
|
</script>
|
|
4670
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4869
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-62"></canvas></div>
|
|
4671
4870
|
</div>
|
|
4672
4871
|
|
|
4673
4872
|
|
|
@@ -4679,7 +4878,7 @@ group.children[0].fillColor = 'red';
|
|
|
4679
4878
|
<div class="button run">Run</div>
|
|
4680
4879
|
</div>
|
|
4681
4880
|
|
|
4682
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4881
|
+
<script type="text/paperscript" canvas="canvas-63">
|
|
4683
4882
|
var path = new Path.Circle({
|
|
4684
4883
|
center: [80, 50],
|
|
4685
4884
|
radius: 35
|
|
@@ -4694,7 +4893,7 @@ group.addChild(path);
|
|
|
4694
4893
|
// The path can be accessed by name:
|
|
4695
4894
|
group.children['example'].fillColor = 'orange';
|
|
4696
4895
|
</script>
|
|
4697
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4896
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-63"></canvas></div>
|
|
4698
4897
|
</div>
|
|
4699
4898
|
|
|
4700
4899
|
|
|
@@ -4706,7 +4905,7 @@ group.children['example'].fillColor = 'orange';
|
|
|
4706
4905
|
<div class="button run">Run</div>
|
|
4707
4906
|
</div>
|
|
4708
4907
|
|
|
4709
|
-
<script type="text/paperscript" canvas="canvas-
|
|
4908
|
+
<script type="text/paperscript" canvas="canvas-64">
|
|
4710
4909
|
var path = new Path.Circle({
|
|
4711
4910
|
center: [80, 50],
|
|
4712
4911
|
radius: 35
|
|
@@ -4718,7 +4917,7 @@ group.children = [path];
|
|
|
4718
4917
|
// The path is the first child of the group:
|
|
4719
4918
|
group.firstChild.fillColor = 'green';
|
|
4720
4919
|
</script>
|
|
4721
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
4920
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-64"></canvas></div>
|
|
4722
4921
|
</div>
|
|
4723
4922
|
|
|
4724
4923
|
|
|
@@ -4895,7 +5094,7 @@ group.firstChild.fillColor = 'green';
|
|
|
4895
5094
|
<div class="button run">Run</div>
|
|
4896
5095
|
</div>
|
|
4897
5096
|
|
|
4898
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5097
|
+
<script type="text/paperscript" canvas="canvas-65">
|
|
4899
5098
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
4900
5099
|
// with a radius of 35:
|
|
4901
5100
|
var circle = new Path.Circle({
|
|
@@ -4906,7 +5105,7 @@ var circle = new Path.Circle({
|
|
|
4906
5105
|
// Set its stroke color to RGB red:
|
|
4907
5106
|
circle.strokeColor = new Color(1, 0, 0);
|
|
4908
5107
|
</script>
|
|
4909
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5108
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-65"></canvas></div>
|
|
4910
5109
|
</div>
|
|
4911
5110
|
|
|
4912
5111
|
|
|
@@ -4943,7 +5142,7 @@ circle.strokeColor = new Color(1, 0, 0);
|
|
|
4943
5142
|
<div class="button run">Run</div>
|
|
4944
5143
|
</div>
|
|
4945
5144
|
|
|
4946
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5145
|
+
<script type="text/paperscript" canvas="canvas-66">
|
|
4947
5146
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
4948
5147
|
// with a radius of 35:
|
|
4949
5148
|
var circle = new Path.Circle({
|
|
@@ -4955,7 +5154,7 @@ var circle = new Path.Circle({
|
|
|
4955
5154
|
// Set its stroke width to 10:
|
|
4956
5155
|
circle.strokeWidth = 10;
|
|
4957
5156
|
</script>
|
|
4958
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5157
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-66"></canvas></div>
|
|
4959
5158
|
</div>
|
|
4960
5159
|
|
|
4961
5160
|
|
|
@@ -5002,7 +5201,7 @@ circle.strokeWidth = 10;
|
|
|
5002
5201
|
<div class="button run">Run</div>
|
|
5003
5202
|
</div>
|
|
5004
5203
|
|
|
5005
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5204
|
+
<script type="text/paperscript" canvas="canvas-67">
|
|
5006
5205
|
var line = new Path({
|
|
5007
5206
|
segments: [[80, 50], [420, 50]],
|
|
5008
5207
|
strokeColor: 'black',
|
|
@@ -5023,7 +5222,7 @@ var line2 = line.clone();
|
|
|
5023
5222
|
line2.position.y += 100;
|
|
5024
5223
|
line2.strokeCap = 'butt';
|
|
5025
5224
|
</script>
|
|
5026
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
5225
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-67"></canvas></div>
|
|
5027
5226
|
</div>
|
|
5028
5227
|
|
|
5029
5228
|
|
|
@@ -5070,7 +5269,7 @@ line2.strokeCap = 'butt';
|
|
|
5070
5269
|
<div class="button run">Run</div>
|
|
5071
5270
|
</div>
|
|
5072
5271
|
|
|
5073
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5272
|
+
<script type="text/paperscript" canvas="canvas-68">
|
|
5074
5273
|
var path = new Path({
|
|
5075
5274
|
segments: [[80, 100], [120, 40], [160, 100]],
|
|
5076
5275
|
strokeColor: 'black',
|
|
@@ -5087,7 +5286,7 @@ var path3 = path2.clone();
|
|
|
5087
5286
|
path3.position.x += path3.bounds.width * 1.5;
|
|
5088
5287
|
path3.strokeJoin = 'bevel';
|
|
5089
5288
|
</script>
|
|
5090
|
-
<div class="canvas"><canvas width="516" height="120" id="canvas-
|
|
5289
|
+
<div class="canvas"><canvas width="516" height="120" id="canvas-68"></canvas></div>
|
|
5091
5290
|
</div>
|
|
5092
5291
|
|
|
5093
5292
|
|
|
@@ -5191,7 +5390,7 @@ path3.strokeJoin = 'bevel';
|
|
|
5191
5390
|
<div class="button run">Run</div>
|
|
5192
5391
|
</div>
|
|
5193
5392
|
|
|
5194
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5393
|
+
<script type="text/paperscript" canvas="canvas-69">
|
|
5195
5394
|
var path = new Path.Circle({
|
|
5196
5395
|
center: [80, 50],
|
|
5197
5396
|
radius: 40,
|
|
@@ -5202,7 +5401,7 @@ var path = new Path.Circle({
|
|
|
5202
5401
|
// Set the dashed stroke to [10pt dash, 4pt gap]:
|
|
5203
5402
|
path.dashArray = [10, 4];
|
|
5204
5403
|
</script>
|
|
5205
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5404
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-69"></canvas></div>
|
|
5206
5405
|
</div>
|
|
5207
5406
|
|
|
5208
5407
|
|
|
@@ -5237,6 +5436,42 @@ path.dashArray = [10, 4];
|
|
|
5237
5436
|
|
|
5238
5437
|
|
|
5239
5438
|
|
|
5439
|
+
</div>
|
|
5440
|
+
|
|
5441
|
+
</div>
|
|
5442
|
+
</div>
|
|
5443
|
+
|
|
5444
|
+
|
|
5445
|
+
<div id="paintorder" class="member">
|
|
5446
|
+
<div class="member-link">
|
|
5447
|
+
<a name="paintorder" href="#paintorder"><tt><b>paintOrder</b></tt></a>
|
|
5448
|
+
</div>
|
|
5449
|
+
<div class="member-description hidden">
|
|
5450
|
+
|
|
5451
|
+
<div class="member-text">
|
|
5452
|
+
<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>
|
|
5453
|
+
|
|
5454
|
+
|
|
5455
|
+
<ul class="member-list">
|
|
5456
|
+
<h4>Values:</h4>
|
|
5457
|
+
<li><tt>'fill'</tt>, <tt>'stroke'</tt></li>
|
|
5458
|
+
</ul>
|
|
5459
|
+
|
|
5460
|
+
|
|
5461
|
+
<ul class="member-list">
|
|
5462
|
+
<h4>Default:</h4>
|
|
5463
|
+
<li><tt>'fill'</tt></li>
|
|
5464
|
+
</ul>
|
|
5465
|
+
|
|
5466
|
+
<ul class="member-list">
|
|
5467
|
+
<h4>Type:</h4>
|
|
5468
|
+
<li>
|
|
5469
|
+
<tt>String</tt>
|
|
5470
|
+
</li>
|
|
5471
|
+
</ul>
|
|
5472
|
+
|
|
5473
|
+
|
|
5474
|
+
|
|
5240
5475
|
</div>
|
|
5241
5476
|
|
|
5242
5477
|
</div>
|
|
@@ -5272,7 +5507,7 @@ path.dashArray = [10, 4];
|
|
|
5272
5507
|
<div class="button run">Run</div>
|
|
5273
5508
|
</div>
|
|
5274
5509
|
|
|
5275
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5510
|
+
<script type="text/paperscript" canvas="canvas-70">
|
|
5276
5511
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
5277
5512
|
// with a radius of 35:
|
|
5278
5513
|
var circle = new Path.Circle({
|
|
@@ -5283,7 +5518,7 @@ var circle = new Path.Circle({
|
|
|
5283
5518
|
// Set the fill color of the circle to RGB red:
|
|
5284
5519
|
circle.fillColor = new Color(1, 0, 0);
|
|
5285
5520
|
</script>
|
|
5286
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5521
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-70"></canvas></div>
|
|
5287
5522
|
</div>
|
|
5288
5523
|
|
|
5289
5524
|
|
|
@@ -5358,7 +5593,7 @@ circle.fillColor = new Color(1, 0, 0);
|
|
|
5358
5593
|
<div class="button run">Run</div>
|
|
5359
5594
|
</div>
|
|
5360
5595
|
|
|
5361
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5596
|
+
<script type="text/paperscript" canvas="canvas-71">
|
|
5362
5597
|
var circle = new Path.Circle({
|
|
5363
5598
|
center: [80, 50],
|
|
5364
5599
|
radius: 35,
|
|
@@ -5371,7 +5606,7 @@ var circle = new Path.Circle({
|
|
|
5371
5606
|
shadowOffset: new Point(5, 5)
|
|
5372
5607
|
});
|
|
5373
5608
|
</script>
|
|
5374
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5609
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-71"></canvas></div>
|
|
5375
5610
|
</div>
|
|
5376
5611
|
|
|
5377
5612
|
|
|
@@ -5512,7 +5747,7 @@ var circle = new Path.Circle({
|
|
|
5512
5747
|
<div class="button run">Run</div>
|
|
5513
5748
|
</div>
|
|
5514
5749
|
|
|
5515
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5750
|
+
<script type="text/paperscript" canvas="canvas-72">
|
|
5516
5751
|
// Create a rectangle shaped path with its top left point at:
|
|
5517
5752
|
// {x: 50, y: 25} and a size of {width: 50, height: 50}
|
|
5518
5753
|
var path = new Path.Rectangle(new Point(50, 25), new Size(50, 50));
|
|
@@ -5523,7 +5758,7 @@ path.onFrame = function(event) {
|
|
|
5523
5758
|
this.rotate(3);
|
|
5524
5759
|
}
|
|
5525
5760
|
</script>
|
|
5526
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5761
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-72"></canvas></div>
|
|
5527
5762
|
</div>
|
|
5528
5763
|
|
|
5529
5764
|
|
|
@@ -5567,7 +5802,7 @@ path.onFrame = function(event) {
|
|
|
5567
5802
|
<div class="button run">Run</div>
|
|
5568
5803
|
</div>
|
|
5569
5804
|
|
|
5570
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5805
|
+
<script type="text/paperscript" canvas="canvas-73">
|
|
5571
5806
|
// Create a circle shaped path at the center of the view:
|
|
5572
5807
|
var path = new Path.Circle({
|
|
5573
5808
|
center: view.center,
|
|
@@ -5581,7 +5816,7 @@ path.onMouseDown = function(event) {
|
|
|
5581
5816
|
this.fillColor = 'red';
|
|
5582
5817
|
}
|
|
5583
5818
|
</script>
|
|
5584
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5819
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-73"></canvas></div>
|
|
5585
5820
|
</div>
|
|
5586
5821
|
|
|
5587
5822
|
|
|
@@ -5593,7 +5828,7 @@ path.onMouseDown = function(event) {
|
|
|
5593
5828
|
<div class="button run">Run</div>
|
|
5594
5829
|
</div>
|
|
5595
5830
|
|
|
5596
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5831
|
+
<script type="text/paperscript" canvas="canvas-74">
|
|
5597
5832
|
// Loop 30 times:
|
|
5598
5833
|
for (var i = 0; i < 30; i++) {
|
|
5599
5834
|
// Create a circle shaped path at a random position
|
|
@@ -5611,7 +5846,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
5611
5846
|
}
|
|
5612
5847
|
}
|
|
5613
5848
|
</script>
|
|
5614
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5849
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-74"></canvas></div>
|
|
5615
5850
|
</div>
|
|
5616
5851
|
|
|
5617
5852
|
|
|
@@ -5655,7 +5890,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
5655
5890
|
<div class="button run">Run</div>
|
|
5656
5891
|
</div>
|
|
5657
5892
|
|
|
5658
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5893
|
+
<script type="text/paperscript" canvas="canvas-75">
|
|
5659
5894
|
// Create a circle shaped path at the center of the view:
|
|
5660
5895
|
var path = new Path.Circle({
|
|
5661
5896
|
center: view.center,
|
|
@@ -5668,7 +5903,7 @@ path.onMouseDrag = function(event) {
|
|
|
5668
5903
|
path.position += event.delta;
|
|
5669
5904
|
}
|
|
5670
5905
|
</script>
|
|
5671
|
-
<div class="canvas"><canvas width="516" height="240" id="canvas-
|
|
5906
|
+
<div class="canvas"><canvas width="516" height="240" id="canvas-75"></canvas></div>
|
|
5672
5907
|
</div>
|
|
5673
5908
|
|
|
5674
5909
|
|
|
@@ -5712,7 +5947,7 @@ path.onMouseDrag = function(event) {
|
|
|
5712
5947
|
<div class="button run">Run</div>
|
|
5713
5948
|
</div>
|
|
5714
5949
|
|
|
5715
|
-
<script type="text/paperscript" canvas="canvas-
|
|
5950
|
+
<script type="text/paperscript" canvas="canvas-76">
|
|
5716
5951
|
// Create a circle shaped path at the center of the view:
|
|
5717
5952
|
var path = new Path.Circle({
|
|
5718
5953
|
center: view.center,
|
|
@@ -5726,7 +5961,7 @@ path.onMouseUp = function(event) {
|
|
|
5726
5961
|
this.fillColor = 'red';
|
|
5727
5962
|
}
|
|
5728
5963
|
</script>
|
|
5729
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
5964
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-76"></canvas></div>
|
|
5730
5965
|
</div>
|
|
5731
5966
|
|
|
5732
5967
|
|
|
@@ -5770,7 +6005,7 @@ path.onMouseUp = function(event) {
|
|
|
5770
6005
|
<div class="button run">Run</div>
|
|
5771
6006
|
</div>
|
|
5772
6007
|
|
|
5773
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6008
|
+
<script type="text/paperscript" canvas="canvas-77">
|
|
5774
6009
|
// Create a circle shaped path at the center of the view:
|
|
5775
6010
|
var path = new Path.Circle({
|
|
5776
6011
|
center: view.center,
|
|
@@ -5784,7 +6019,7 @@ path.onClick = function(event) {
|
|
|
5784
6019
|
this.fillColor = 'red';
|
|
5785
6020
|
}
|
|
5786
6021
|
</script>
|
|
5787
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6022
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-77"></canvas></div>
|
|
5788
6023
|
</div>
|
|
5789
6024
|
|
|
5790
6025
|
|
|
@@ -5796,7 +6031,7 @@ path.onClick = function(event) {
|
|
|
5796
6031
|
<div class="button run">Run</div>
|
|
5797
6032
|
</div>
|
|
5798
6033
|
|
|
5799
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6034
|
+
<script type="text/paperscript" canvas="canvas-78">
|
|
5800
6035
|
// Loop 30 times:
|
|
5801
6036
|
for (var i = 0; i < 30; i++) {
|
|
5802
6037
|
// Create a circle shaped path at a random position
|
|
@@ -5814,7 +6049,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
5814
6049
|
}
|
|
5815
6050
|
}
|
|
5816
6051
|
</script>
|
|
5817
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6052
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-78"></canvas></div>
|
|
5818
6053
|
</div>
|
|
5819
6054
|
|
|
5820
6055
|
|
|
@@ -5858,7 +6093,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
5858
6093
|
<div class="button run">Run</div>
|
|
5859
6094
|
</div>
|
|
5860
6095
|
|
|
5861
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6096
|
+
<script type="text/paperscript" canvas="canvas-79">
|
|
5862
6097
|
// Create a circle shaped path at the center of the view:
|
|
5863
6098
|
var path = new Path.Circle({
|
|
5864
6099
|
center: view.center,
|
|
@@ -5872,7 +6107,7 @@ path.onDoubleClick = function(event) {
|
|
|
5872
6107
|
this.fillColor = 'red';
|
|
5873
6108
|
}
|
|
5874
6109
|
</script>
|
|
5875
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6110
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-79"></canvas></div>
|
|
5876
6111
|
</div>
|
|
5877
6112
|
|
|
5878
6113
|
|
|
@@ -5884,7 +6119,7 @@ path.onDoubleClick = function(event) {
|
|
|
5884
6119
|
<div class="button run">Run</div>
|
|
5885
6120
|
</div>
|
|
5886
6121
|
|
|
5887
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6122
|
+
<script type="text/paperscript" canvas="canvas-80">
|
|
5888
6123
|
// Loop 30 times:
|
|
5889
6124
|
for (var i = 0; i < 30; i++) {
|
|
5890
6125
|
// Create a circle shaped path at a random position
|
|
@@ -5902,7 +6137,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
5902
6137
|
}
|
|
5903
6138
|
}
|
|
5904
6139
|
</script>
|
|
5905
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6140
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-80"></canvas></div>
|
|
5906
6141
|
</div>
|
|
5907
6142
|
|
|
5908
6143
|
|
|
@@ -5946,7 +6181,7 @@ for (var i = 0; i < 30; i++) {
|
|
|
5946
6181
|
<div class="button run">Run</div>
|
|
5947
6182
|
</div>
|
|
5948
6183
|
|
|
5949
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6184
|
+
<script type="text/paperscript" canvas="canvas-81">
|
|
5950
6185
|
// Create a circle shaped path at the center of the view:
|
|
5951
6186
|
var path = new Path.Circle({
|
|
5952
6187
|
center: view.center,
|
|
@@ -5960,7 +6195,7 @@ path.onMouseMove = function(event) {
|
|
|
5960
6195
|
this.opacity = Math.random();
|
|
5961
6196
|
}
|
|
5962
6197
|
</script>
|
|
5963
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6198
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-81"></canvas></div>
|
|
5964
6199
|
</div>
|
|
5965
6200
|
|
|
5966
6201
|
|
|
@@ -6004,7 +6239,7 @@ path.onMouseMove = function(event) {
|
|
|
6004
6239
|
<div class="button run">Run</div>
|
|
6005
6240
|
</div>
|
|
6006
6241
|
|
|
6007
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6242
|
+
<script type="text/paperscript" canvas="canvas-82">
|
|
6008
6243
|
// Create a circle shaped path at the center of the view:
|
|
6009
6244
|
var path = new Path.Circle({
|
|
6010
6245
|
center: view.center,
|
|
@@ -6022,7 +6257,7 @@ path.onMouseLeave = function(event) {
|
|
|
6022
6257
|
this.fillColor = 'black';
|
|
6023
6258
|
}
|
|
6024
6259
|
</script>
|
|
6025
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6260
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-82"></canvas></div>
|
|
6026
6261
|
</div>
|
|
6027
6262
|
|
|
6028
6263
|
|
|
@@ -6034,7 +6269,7 @@ path.onMouseLeave = function(event) {
|
|
|
6034
6269
|
<div class="button run">Run</div>
|
|
6035
6270
|
</div>
|
|
6036
6271
|
|
|
6037
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6272
|
+
<script type="text/paperscript" canvas="canvas-83">
|
|
6038
6273
|
function enter(event) {
|
|
6039
6274
|
this.fillColor = 'red';
|
|
6040
6275
|
}
|
|
@@ -6056,7 +6291,7 @@ function onMouseDown(event) {
|
|
|
6056
6291
|
path.onMouseLeave = leave;
|
|
6057
6292
|
}
|
|
6058
6293
|
</script>
|
|
6059
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6294
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-83"></canvas></div>
|
|
6060
6295
|
</div>
|
|
6061
6296
|
|
|
6062
6297
|
|
|
@@ -6100,7 +6335,7 @@ function onMouseDown(event) {
|
|
|
6100
6335
|
<div class="button run">Run</div>
|
|
6101
6336
|
</div>
|
|
6102
6337
|
|
|
6103
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6338
|
+
<script type="text/paperscript" canvas="canvas-84">
|
|
6104
6339
|
// Create a circle shaped path at the center of the view:
|
|
6105
6340
|
var path = new Path.Circle({
|
|
6106
6341
|
center: view.center,
|
|
@@ -6113,7 +6348,7 @@ path.onMouseLeave = function(event) {
|
|
|
6113
6348
|
this.fillColor = 'red';
|
|
6114
6349
|
}
|
|
6115
6350
|
</script>
|
|
6116
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6351
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-84"></canvas></div>
|
|
6117
6352
|
</div>
|
|
6118
6353
|
|
|
6119
6354
|
|
|
@@ -6122,49 +6357,101 @@ path.onMouseLeave = function(event) {
|
|
|
6122
6357
|
</div>
|
|
6123
6358
|
</div>
|
|
6124
6359
|
|
|
6125
|
-
</div>
|
|
6126
|
-
|
|
6127
|
-
|
|
6128
|
-
<!-- =========================== inherited methods ========================= -->
|
|
6129
|
-
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
6130
|
-
|
|
6131
6360
|
|
|
6132
|
-
<div id="
|
|
6361
|
+
<div id="ondraw" class="member">
|
|
6133
6362
|
<div class="member-link">
|
|
6134
|
-
<a name="
|
|
6363
|
+
<a name="ondraw" href="#ondraw"><tt><b>onDraw</b></tt></a>
|
|
6135
6364
|
</div>
|
|
6136
6365
|
<div class="member-description hidden">
|
|
6366
|
+
|
|
6137
6367
|
<div class="member-text">
|
|
6138
|
-
<p>
|
|
6139
|
-
|
|
6368
|
+
<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>
|
|
6140
6369
|
|
|
6141
|
-
<ul class="member-list">
|
|
6142
|
-
<h4>Parameters:</h4>
|
|
6143
6370
|
|
|
6144
|
-
<li>
|
|
6145
|
-
<tt>props:</tt>
|
|
6146
|
-
<tt>Object</tt>
|
|
6147
|
-
|
|
6148
|
-
|
|
6149
|
-
</li>
|
|
6150
6371
|
|
|
6372
|
+
<ul class="member-list">
|
|
6373
|
+
<h4>Type:</h4>
|
|
6374
|
+
<li>
|
|
6375
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
6376
|
+
</li>
|
|
6377
|
+
</ul>
|
|
6378
|
+
<ul class="member-list">
|
|
6379
|
+
<h4>Options:</h4>
|
|
6380
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item that is drawn</li>
|
|
6381
|
+
<li><tt>event.context: <tt>CanvasRenderingContext2D</tt></tt> — the canvas context, transformed into the item’s coordinates</li>
|
|
6382
|
+
<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>
|
|
6383
|
+
<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>
|
|
6384
|
+
<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>()
|
|
6385
|
+
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>
|
|
6151
6386
|
</ul>
|
|
6152
|
-
|
|
6153
6387
|
|
|
6154
|
-
<
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
<
|
|
6159
|
-
</
|
|
6388
|
+
<h4>Example:<span class="description">Draw a hairline cross through the center of a circle, beneath it:</span></h4>
|
|
6389
|
+
|
|
6390
|
+
<div class="paperscript split">
|
|
6391
|
+
|
|
6392
|
+
<div class="buttons">
|
|
6393
|
+
<div class="button run">Run</div>
|
|
6394
|
+
</div>
|
|
6395
|
+
|
|
6396
|
+
<script type="text/paperscript" canvas="canvas-85">
|
|
6397
|
+
var path = new Path.Circle({
|
|
6398
|
+
center: view.center,
|
|
6399
|
+
radius: 25,
|
|
6400
|
+
fillColor: 'rgba(255, 0, 0, 0.5)'
|
|
6401
|
+
});
|
|
6402
|
+
|
|
6403
|
+
path.onDraw = function(event) {
|
|
6404
|
+
var ctx = event.context,
|
|
6405
|
+
center = this.position,
|
|
6406
|
+
scale = event.matrix.scaling.x;
|
|
6407
|
+
ctx.beginPath();
|
|
6408
|
+
ctx.moveTo(center.x - 40, center.y);
|
|
6409
|
+
ctx.lineTo(center.x + 40, center.y);
|
|
6410
|
+
ctx.moveTo(center.x, center.y - 40);
|
|
6411
|
+
ctx.lineTo(center.x, center.y + 40);
|
|
6412
|
+
ctx.lineWidth = 1 / scale;
|
|
6413
|
+
ctx.stroke();
|
|
6414
|
+
}
|
|
6415
|
+
</script>
|
|
6416
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-85"></canvas></div>
|
|
6417
|
+
</div>
|
|
6160
6418
|
|
|
6161
|
-
|
|
6162
|
-
</ul>
|
|
6163
6419
|
|
|
6420
|
+
</div>
|
|
6164
6421
|
|
|
6422
|
+
</div>
|
|
6423
|
+
</div>
|
|
6165
6424
|
|
|
6166
6425
|
|
|
6167
|
-
|
|
6426
|
+
<div id="ondrawselection" class="member">
|
|
6427
|
+
<div class="member-link">
|
|
6428
|
+
<a name="ondrawselection" href="#ondrawselection"><tt><b>onDrawSelection</b></tt></a>
|
|
6429
|
+
</div>
|
|
6430
|
+
<div class="member-description hidden">
|
|
6431
|
+
|
|
6432
|
+
<div class="member-text">
|
|
6433
|
+
<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>
|
|
6434
|
+
|
|
6435
|
+
|
|
6436
|
+
|
|
6437
|
+
<ul class="member-list">
|
|
6438
|
+
<h4>Type:</h4>
|
|
6439
|
+
<li>
|
|
6440
|
+
<tt>Function</tt>⟋<tt>null</tt>
|
|
6441
|
+
</li>
|
|
6442
|
+
</ul>
|
|
6443
|
+
<ul class="member-list">
|
|
6444
|
+
<h4>Options:</h4>
|
|
6445
|
+
<li><tt>event.item: <a href="../classes/Item.html"><tt>Item</tt></a></tt> — the selected item</li>
|
|
6446
|
+
<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>
|
|
6447
|
+
<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>
|
|
6448
|
+
<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>
|
|
6449
|
+
<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>
|
|
6450
|
+
<li><tt>event.view: <a href="../classes/View.html"><tt>View</tt></a></tt> — the view drawn into
|
|
6451
|
+
What the handler draws isn’t part of the item’s hit testing, its bounds or its SVG export.</li>
|
|
6452
|
+
</ul>
|
|
6453
|
+
|
|
6454
|
+
<h4>Example:<span class="description">Draw the selection of a path as a dot at each segment:</span></h4>
|
|
6168
6455
|
|
|
6169
6456
|
<div class="paperscript split">
|
|
6170
6457
|
|
|
@@ -6172,49 +6459,60 @@ path.onMouseLeave = function(event) {
|
|
|
6172
6459
|
<div class="button run">Run</div>
|
|
6173
6460
|
</div>
|
|
6174
6461
|
|
|
6175
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6176
|
-
var
|
|
6177
|
-
center:
|
|
6178
|
-
|
|
6179
|
-
|
|
6180
|
-
|
|
6181
|
-
|
|
6182
|
-
strokeColor: 'red',
|
|
6183
|
-
strokeWidth: 10,
|
|
6184
|
-
fillColor: 'black',
|
|
6462
|
+
<script type="text/paperscript" canvas="canvas-86">
|
|
6463
|
+
var path = new Path.Star({
|
|
6464
|
+
center: view.center,
|
|
6465
|
+
points: 5,
|
|
6466
|
+
radius1: 20,
|
|
6467
|
+
radius2: 40,
|
|
6468
|
+
strokeColor: 'black',
|
|
6185
6469
|
selected: true
|
|
6186
6470
|
});
|
|
6471
|
+
|
|
6472
|
+
path.onDrawSelection = function(event) {
|
|
6473
|
+
var ctx = event.context;
|
|
6474
|
+
this.segments.forEach(function(segment) {
|
|
6475
|
+
var point = event.matrix.transform(segment.point);
|
|
6476
|
+
ctx.beginPath();
|
|
6477
|
+
ctx.arc(point.x, point.y, event.size, 0, Math.PI * 2);
|
|
6478
|
+
ctx.fill();
|
|
6479
|
+
});
|
|
6480
|
+
return false;
|
|
6481
|
+
}
|
|
6187
6482
|
</script>
|
|
6188
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6483
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-86"></canvas></div>
|
|
6189
6484
|
</div>
|
|
6190
6485
|
|
|
6191
6486
|
|
|
6487
|
+
</div>
|
|
6488
|
+
|
|
6192
6489
|
</div>
|
|
6193
6490
|
</div>
|
|
6491
|
+
|
|
6194
6492
|
</div>
|
|
6195
6493
|
|
|
6494
|
+
|
|
6495
|
+
<!-- =========================== inherited methods ========================= -->
|
|
6496
|
+
<div class="reference-members"><h2>Methods inherited from <a href="../classes/Item.html"><tt>Item</tt></a></h2>
|
|
6497
|
+
|
|
6196
6498
|
|
|
6197
|
-
<div id="
|
|
6499
|
+
<div id="addeffect-effect" class="member">
|
|
6198
6500
|
<div class="member-link">
|
|
6199
|
-
<a name="
|
|
6501
|
+
<a name="addeffect-effect" href="#addeffect-effect"><tt><b>addEffect</b>(effect)</tt></a>
|
|
6200
6502
|
</div>
|
|
6201
6503
|
<div class="member-description hidden">
|
|
6202
6504
|
<div class="member-text">
|
|
6203
|
-
<p>
|
|
6204
|
-
|
|
6205
|
-
<h4>Options:</h4>
|
|
6206
|
-
<li><tt>insert: undefined</tt> — specifies whether the copy should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the original — default: <tt>true</tt></li>
|
|
6207
|
-
<li><tt>deep: undefined</tt> — specifies whether the item’s children should also be cloned — default: <tt>true</tt></li>
|
|
6208
|
-
</ul>
|
|
6505
|
+
<p>Adds an effect at the end of the item’s effects.</p>
|
|
6506
|
+
|
|
6209
6507
|
|
|
6210
6508
|
<ul class="member-list">
|
|
6211
6509
|
<h4>Parameters:</h4>
|
|
6212
6510
|
|
|
6213
6511
|
<li>
|
|
6214
|
-
<tt>
|
|
6512
|
+
<tt>effect:</tt>
|
|
6215
6513
|
<tt>Object</tt>
|
|
6514
|
+
— the plain object describing the effect
|
|
6216
6515
|
|
|
6217
|
-
— optional, default: <tt>{ insert: true, deep: true }</tt>
|
|
6218
6516
|
</li>
|
|
6219
6517
|
|
|
6220
6518
|
</ul>
|
|
@@ -6224,7 +6522,7 @@ circle.set({
|
|
|
6224
6522
|
<h4>Returns:</h4>
|
|
6225
6523
|
|
|
6226
6524
|
<li>
|
|
6227
|
-
<tt><a href="../classes/
|
|
6525
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the added instance
|
|
6228
6526
|
</li>
|
|
6229
6527
|
|
|
6230
6528
|
|
|
@@ -6233,15 +6531,339 @@ circle.set({
|
|
|
6233
6531
|
|
|
6234
6532
|
|
|
6235
6533
|
|
|
6236
|
-
|
|
6237
|
-
|
|
6534
|
+
|
|
6535
|
+
</div>
|
|
6536
|
+
</div>
|
|
6537
|
+
</div>
|
|
6538
|
+
|
|
6539
|
+
|
|
6540
|
+
<div id="inserteffect-index-effect" class="member">
|
|
6541
|
+
<div class="member-link">
|
|
6542
|
+
<a name="inserteffect-index-effect" href="#inserteffect-index-effect"><tt><b>insertEffect</b>(index, effect)</tt></a>
|
|
6543
|
+
</div>
|
|
6544
|
+
<div class="member-description hidden">
|
|
6545
|
+
<div class="member-text">
|
|
6546
|
+
<p>Inserts an effect into the item’s effects at the given index.</p>
|
|
6547
|
+
|
|
6548
|
+
|
|
6549
|
+
<ul class="member-list">
|
|
6550
|
+
<h4>Parameters:</h4>
|
|
6551
|
+
|
|
6552
|
+
<li>
|
|
6553
|
+
<tt>index:</tt>
|
|
6554
|
+
<tt>Number</tt>
|
|
6555
|
+
— the index at which to insert the effect
|
|
6556
|
+
|
|
6557
|
+
</li>
|
|
6558
|
+
|
|
6559
|
+
<li>
|
|
6560
|
+
<tt>effect:</tt>
|
|
6561
|
+
<tt>Object</tt>
|
|
6562
|
+
— the plain object describing the effect
|
|
6563
|
+
|
|
6564
|
+
</li>
|
|
6565
|
+
|
|
6566
|
+
</ul>
|
|
6567
|
+
|
|
6568
|
+
|
|
6569
|
+
<ul class="member-list">
|
|
6570
|
+
<h4>Returns:</h4>
|
|
6571
|
+
|
|
6572
|
+
<li>
|
|
6573
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the inserted instance
|
|
6574
|
+
</li>
|
|
6575
|
+
|
|
6576
|
+
|
|
6577
|
+
</ul>
|
|
6578
|
+
|
|
6579
|
+
|
|
6580
|
+
|
|
6581
|
+
|
|
6582
|
+
|
|
6583
|
+
</div>
|
|
6584
|
+
</div>
|
|
6585
|
+
</div>
|
|
6586
|
+
|
|
6587
|
+
|
|
6588
|
+
<div id="inserteffects-index-effects" class="member">
|
|
6589
|
+
<div class="member-link">
|
|
6590
|
+
<a name="inserteffects-index-effects" href="#inserteffects-index-effects"><tt><b>insertEffects</b>(index, effects)</tt></a>
|
|
6591
|
+
</div>
|
|
6592
|
+
<div class="member-description hidden">
|
|
6593
|
+
<div class="member-text">
|
|
6594
|
+
<p>Inserts effects into the item’s effects at the given index.</p>
|
|
6595
|
+
|
|
6596
|
+
|
|
6597
|
+
<ul class="member-list">
|
|
6598
|
+
<h4>Parameters:</h4>
|
|
6599
|
+
|
|
6600
|
+
<li>
|
|
6601
|
+
<tt>index:</tt>
|
|
6602
|
+
<tt>Number</tt>
|
|
6603
|
+
— the index at which to insert the effects
|
|
6604
|
+
|
|
6605
|
+
</li>
|
|
6606
|
+
|
|
6607
|
+
<li>
|
|
6608
|
+
<tt>effects:</tt>
|
|
6609
|
+
Array of <tt>Object</tt> objects
|
|
6610
|
+
— the plain objects describing the effects
|
|
6611
|
+
|
|
6612
|
+
</li>
|
|
6613
|
+
|
|
6614
|
+
</ul>
|
|
6615
|
+
|
|
6616
|
+
|
|
6617
|
+
<ul class="member-list">
|
|
6618
|
+
<h4>Returns:</h4>
|
|
6619
|
+
|
|
6620
|
+
<li>
|
|
6621
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the inserted instances
|
|
6622
|
+
</li>
|
|
6623
|
+
|
|
6624
|
+
|
|
6625
|
+
</ul>
|
|
6626
|
+
|
|
6627
|
+
|
|
6628
|
+
|
|
6629
|
+
|
|
6630
|
+
|
|
6631
|
+
</div>
|
|
6632
|
+
</div>
|
|
6633
|
+
</div>
|
|
6634
|
+
|
|
6635
|
+
|
|
6636
|
+
<div id="removeeffect-index" class="member">
|
|
6637
|
+
<div class="member-link">
|
|
6638
|
+
<a name="removeeffect-index" href="#removeeffect-index"><tt><b>removeEffect</b>(index)</tt></a>
|
|
6639
|
+
</div>
|
|
6640
|
+
<div class="member-description hidden">
|
|
6641
|
+
<div class="member-text">
|
|
6642
|
+
<p>Removes the effect at the given index from the item’s effects.</p>
|
|
6643
|
+
|
|
6644
|
+
|
|
6645
|
+
<ul class="member-list">
|
|
6646
|
+
<h4>Parameters:</h4>
|
|
6647
|
+
|
|
6648
|
+
<li>
|
|
6649
|
+
<tt>index:</tt>
|
|
6650
|
+
<tt>Number</tt>
|
|
6651
|
+
— the index of the effect to remove
|
|
6652
|
+
|
|
6653
|
+
</li>
|
|
6654
|
+
|
|
6655
|
+
</ul>
|
|
6656
|
+
|
|
6657
|
+
|
|
6658
|
+
<ul class="member-list">
|
|
6659
|
+
<h4>Returns:</h4>
|
|
6660
|
+
|
|
6661
|
+
<li>
|
|
6662
|
+
<tt><a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a></tt> — the removed instance, or <code>null</code>
|
|
6663
|
+
</li>
|
|
6664
|
+
|
|
6665
|
+
|
|
6666
|
+
</ul>
|
|
6667
|
+
|
|
6668
|
+
|
|
6669
|
+
|
|
6670
|
+
|
|
6671
|
+
|
|
6672
|
+
</div>
|
|
6673
|
+
</div>
|
|
6674
|
+
</div>
|
|
6675
|
+
|
|
6676
|
+
|
|
6677
|
+
<div id="removeeffects" class="member">
|
|
6678
|
+
<div class="member-link">
|
|
6679
|
+
<a name="removeeffects" href="#removeeffects"><tt><b>removeEffects</b>([start[, end]])</tt></a>
|
|
6680
|
+
</div>
|
|
6681
|
+
<div class="member-description hidden">
|
|
6682
|
+
<div class="member-text">
|
|
6683
|
+
<p>Removes the effects from the start index to the end index from the item’s effects, or all of them.</p>
|
|
6684
|
+
|
|
6685
|
+
|
|
6686
|
+
<ul class="member-list">
|
|
6687
|
+
<h4>Parameters:</h4>
|
|
6688
|
+
|
|
6689
|
+
<li>
|
|
6690
|
+
<tt>start:</tt>
|
|
6691
|
+
<tt>Number</tt>
|
|
6692
|
+
— the index of the first effect to remove
|
|
6693
|
+
— optional, default: <tt>0</tt>
|
|
6694
|
+
</li>
|
|
6695
|
+
|
|
6696
|
+
<li>
|
|
6697
|
+
<tt>end:</tt>
|
|
6698
|
+
<tt>Number</tt>
|
|
6699
|
+
— the index after the last one
|
|
6700
|
+
— optional, default: <tt>effects.length</tt>
|
|
6701
|
+
</li>
|
|
6702
|
+
|
|
6703
|
+
</ul>
|
|
6704
|
+
|
|
6705
|
+
|
|
6706
|
+
<ul class="member-list">
|
|
6707
|
+
<h4>Returns:</h4>
|
|
6708
|
+
|
|
6709
|
+
<li>
|
|
6710
|
+
<tt>Array of <a href="../classes/EffectInstance.html"><tt>EffectInstance</tt></a> objects</tt> — the removed instances
|
|
6711
|
+
</li>
|
|
6712
|
+
|
|
6713
|
+
|
|
6714
|
+
</ul>
|
|
6715
|
+
|
|
6716
|
+
|
|
6717
|
+
|
|
6718
|
+
|
|
6719
|
+
|
|
6720
|
+
</div>
|
|
6721
|
+
</div>
|
|
6722
|
+
</div>
|
|
6723
|
+
|
|
6724
|
+
|
|
6725
|
+
<div id="geteffectoutput" class="member">
|
|
6726
|
+
<div class="member-link">
|
|
6727
|
+
<a name="geteffectoutput" href="#geteffectoutput"><tt><b>getEffectOutput</b>()</tt></a>
|
|
6728
|
+
</div>
|
|
6729
|
+
<div class="member-description hidden">
|
|
6730
|
+
<div class="member-text">
|
|
6731
|
+
<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>
|
|
6732
|
+
|
|
6733
|
+
|
|
6734
|
+
|
|
6735
|
+
<ul class="member-list">
|
|
6736
|
+
<h4>Returns:</h4>
|
|
6737
|
+
|
|
6738
|
+
<li>
|
|
6739
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a>⟋<tt>null</tt></tt> — the output of the effects
|
|
6740
|
+
</li>
|
|
6741
|
+
|
|
6742
|
+
|
|
6743
|
+
</ul>
|
|
6744
|
+
|
|
6745
|
+
|
|
6746
|
+
|
|
6747
|
+
|
|
6748
|
+
|
|
6749
|
+
</div>
|
|
6750
|
+
</div>
|
|
6751
|
+
</div>
|
|
6752
|
+
|
|
6753
|
+
|
|
6754
|
+
<div id="set-props" class="member">
|
|
6755
|
+
<div class="member-link">
|
|
6756
|
+
<a name="set-props" href="#set-props"><tt><b>set</b>(props)</tt></a>
|
|
6757
|
+
</div>
|
|
6758
|
+
<div class="member-description hidden">
|
|
6759
|
+
<div class="member-text">
|
|
6760
|
+
<p>Sets the properties of the passed object literal on this item to the values defined in the object literal, if the item has property of the given name (or a setter defined for it).</p>
|
|
6761
|
+
|
|
6762
|
+
|
|
6763
|
+
<ul class="member-list">
|
|
6764
|
+
<h4>Parameters:</h4>
|
|
6765
|
+
|
|
6766
|
+
<li>
|
|
6767
|
+
<tt>props:</tt>
|
|
6768
|
+
<tt>Object</tt>
|
|
6769
|
+
|
|
6770
|
+
|
|
6771
|
+
</li>
|
|
6772
|
+
|
|
6773
|
+
</ul>
|
|
6774
|
+
|
|
6775
|
+
|
|
6776
|
+
<ul class="member-list">
|
|
6777
|
+
<h4>Returns:</h4>
|
|
6778
|
+
|
|
6779
|
+
<li>
|
|
6780
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a></tt> — the item itself
|
|
6781
|
+
</li>
|
|
6782
|
+
|
|
6783
|
+
|
|
6784
|
+
</ul>
|
|
6785
|
+
|
|
6786
|
+
|
|
6787
|
+
|
|
6788
|
+
|
|
6789
|
+
<h4>Example:<span class="description">Setting properties through an object literal</span></h4>
|
|
6790
|
+
|
|
6238
6791
|
<div class="paperscript split">
|
|
6239
6792
|
|
|
6240
6793
|
<div class="buttons">
|
|
6241
6794
|
<div class="button run">Run</div>
|
|
6242
6795
|
</div>
|
|
6243
6796
|
|
|
6244
|
-
<script type="text/paperscript" canvas="canvas-
|
|
6797
|
+
<script type="text/paperscript" canvas="canvas-87">
|
|
6798
|
+
var circle = new Path.Circle({
|
|
6799
|
+
center: [80, 50],
|
|
6800
|
+
radius: 35
|
|
6801
|
+
});
|
|
6802
|
+
|
|
6803
|
+
circle.set({
|
|
6804
|
+
strokeColor: 'red',
|
|
6805
|
+
strokeWidth: 10,
|
|
6806
|
+
fillColor: 'black',
|
|
6807
|
+
selected: true
|
|
6808
|
+
});
|
|
6809
|
+
</script>
|
|
6810
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-87"></canvas></div>
|
|
6811
|
+
</div>
|
|
6812
|
+
|
|
6813
|
+
|
|
6814
|
+
</div>
|
|
6815
|
+
</div>
|
|
6816
|
+
</div>
|
|
6817
|
+
|
|
6818
|
+
|
|
6819
|
+
<div id="clone" class="member">
|
|
6820
|
+
<div class="member-link">
|
|
6821
|
+
<a name="clone" href="#clone"><tt><b>clone</b>([options])</tt></a>
|
|
6822
|
+
</div>
|
|
6823
|
+
<div class="member-description hidden">
|
|
6824
|
+
<div class="member-text">
|
|
6825
|
+
<p>Clones the item within the same project and places the copy above the item.</p>
|
|
6826
|
+
<ul class="member-list">
|
|
6827
|
+
<h4>Options:</h4>
|
|
6828
|
+
<li><tt>insert: undefined</tt> — specifies whether the copy should be inserted into the scene graph. When set to <code>true</code>, it is inserted above the original — default: <tt>true</tt></li>
|
|
6829
|
+
<li><tt>deep: undefined</tt> — specifies whether the item’s children should also be cloned — default: <tt>true</tt></li>
|
|
6830
|
+
</ul>
|
|
6831
|
+
|
|
6832
|
+
<ul class="member-list">
|
|
6833
|
+
<h4>Parameters:</h4>
|
|
6834
|
+
|
|
6835
|
+
<li>
|
|
6836
|
+
<tt>options:</tt>
|
|
6837
|
+
<tt>Object</tt>
|
|
6838
|
+
|
|
6839
|
+
— optional, default: <tt>{ insert: true, deep: true }</tt>
|
|
6840
|
+
</li>
|
|
6841
|
+
|
|
6842
|
+
</ul>
|
|
6843
|
+
|
|
6844
|
+
|
|
6845
|
+
<ul class="member-list">
|
|
6846
|
+
<h4>Returns:</h4>
|
|
6847
|
+
|
|
6848
|
+
<li>
|
|
6849
|
+
<tt><a href="../classes/Item.html"><tt>Item</tt></a></tt> — the newly cloned item
|
|
6850
|
+
</li>
|
|
6851
|
+
|
|
6852
|
+
|
|
6853
|
+
</ul>
|
|
6854
|
+
|
|
6855
|
+
|
|
6856
|
+
|
|
6857
|
+
|
|
6858
|
+
<h4>Example:<span class="description">Cloning items:</span></h4>
|
|
6859
|
+
|
|
6860
|
+
<div class="paperscript split">
|
|
6861
|
+
|
|
6862
|
+
<div class="buttons">
|
|
6863
|
+
<div class="button run">Run</div>
|
|
6864
|
+
</div>
|
|
6865
|
+
|
|
6866
|
+
<script type="text/paperscript" canvas="canvas-88">
|
|
6245
6867
|
var circle = new Path.Circle({
|
|
6246
6868
|
center: [50, 50],
|
|
6247
6869
|
radius: 10,
|
|
@@ -6256,7 +6878,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
6256
6878
|
copy.position.x += i * copy.bounds.width;
|
|
6257
6879
|
}
|
|
6258
6880
|
</script>
|
|
6259
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
6881
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-88"></canvas></div>
|
|
6260
6882
|
</div>
|
|
6261
6883
|
|
|
6262
6884
|
|
|
@@ -6382,7 +7004,7 @@ for (var i = 0; i < 20; i++) {
|
|
|
6382
7004
|
<div class="button run">Run</div>
|
|
6383
7005
|
</div>
|
|
6384
7006
|
|
|
6385
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7007
|
+
<script type="text/paperscript" canvas="canvas-89">
|
|
6386
7008
|
var circle = new Path.Circle({
|
|
6387
7009
|
center: [50, 50],
|
|
6388
7010
|
radius: 5,
|
|
@@ -6399,7 +7021,7 @@ raster.position.x += 100;
|
|
|
6399
7021
|
circle.scale(5);
|
|
6400
7022
|
raster.scale(5);
|
|
6401
7023
|
</script>
|
|
6402
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7024
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-89"></canvas></div>
|
|
6403
7025
|
</div>
|
|
6404
7026
|
|
|
6405
7027
|
|
|
@@ -6453,7 +7075,7 @@ raster.scale(5);
|
|
|
6453
7075
|
<div class="button run">Run</div>
|
|
6454
7076
|
</div>
|
|
6455
7077
|
|
|
6456
|
-
<script type="text/paperscript" canvas="canvas-
|
|
7078
|
+
<script type="text/paperscript" canvas="canvas-90">
|
|
6457
7079
|
var path = new Path.Star({
|
|
6458
7080
|
center: [50, 50],
|
|
6459
7081
|
points: 12,
|
|
@@ -6474,7 +7096,7 @@ function onMouseDown(event) {
|
|
|
6474
7096
|
}
|
|
6475
7097
|
}
|
|
6476
7098
|
</script>
|
|
6477
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
7099
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-90"></canvas></div>
|
|
6478
7100
|
</div>
|
|
6479
7101
|
|
|
6480
7102
|
|
|
@@ -6992,11 +7614,17 @@ function onMouseDown(event) {
|
|
|
6992
7614
|
</div>
|
|
6993
7615
|
<div class="member-description hidden">
|
|
6994
7616
|
<div class="member-text">
|
|
6995
|
-
<p>Exports the item with its content and child items as an SVG DOM.</p>
|
|
7617
|
+
<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>
|
|
6996
7618
|
<ul class="member-list">
|
|
6997
7619
|
<h4>Options:</h4>
|
|
6998
|
-
<li
|
|
6999
|
-
|
|
7620
|
+
<li>[options.bounds] {String|Rectangle} the bounds of the area to
|
|
7621
|
+
export, either as a string ({@values 'view', content'}), or a
|
|
7622
|
+
{@link Rectangle} object: `'view'` uses the view bounds,
|
|
7623
|
+
`'content'` uses the stroke bounds of the item</li>
|
|
7624
|
+
<li>[options.matrix] {Matrix} the matrix with which to transform the
|
|
7625
|
+
exported content: If `options.bounds` is set to `'view'`,
|
|
7626
|
+
`paper.view.matrix` is used, for all other settings of
|
|
7627
|
+
`options.bounds` the identity matrix is used.</li>
|
|
7000
7628
|
<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>
|
|
7001
7629
|
<li><tt>options.precision: <tt>Number</tt></tt> — the amount of fractional digits in numbers used in SVG data — default: <tt>5</tt></li>
|
|
7002
7630
|
<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>
|
|
@@ -7004,6 +7632,12 @@ function onMouseDown(event) {
|
|
|
7004
7632
|
<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>
|
|
7005
7633
|
<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>
|
|
7006
7634
|
<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>
|
|
7635
|
+
<li>[options.processNode] {Function} the function to process the
|
|
7636
|
+
SVG node made for each exported item, receiving an object with the
|
|
7637
|
+
`item` and its `node`: It can change the node, e.g. to add attributes
|
|
7638
|
+
that Paper.js doesn't export, or return a node to replace it with. It
|
|
7639
|
+
is called before the item's name, style, visibility and data are set
|
|
7640
|
+
on the node, which replace attributes of the same names.</li>
|
|
7007
7641
|
</ul>
|
|
7008
7642
|
|
|
7009
7643
|
<ul class="member-list">
|
|
@@ -7046,6 +7680,7 @@ function onMouseDown(event) {
|
|
|
7046
7680
|
<div class="member-text">
|
|
7047
7681
|
<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>
|
|
7048
7682
|
<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>
|
|
7683
|
+
<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>
|
|
7049
7684
|
<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>
|
|
7050
7685
|
<ul class="member-list">
|
|
7051
7686
|
<h4>Options:</h4>
|
|
@@ -7057,6 +7692,13 @@ function onMouseDown(event) {
|
|
|
7057
7692
|
<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>
|
|
7058
7693
|
<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>
|
|
7059
7694
|
<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>
|
|
7695
|
+
<li>[options.processItem] {Function} the function to process the
|
|
7696
|
+
item made for each imported SVG element, receiving an object with
|
|
7697
|
+
the `item` and its `node`: It can read attributes that Paper.js
|
|
7698
|
+
doesn't import, or return an item to replace it with. It is called
|
|
7699
|
+
after the element's attributes and data are applied to the item, so
|
|
7700
|
+
it can extend `item.data`. A replacement item doesn't receive them:
|
|
7701
|
+
copy them over from `item` as needed.</li>
|
|
7060
7702
|
</ul>
|
|
7061
7703
|
|
|
7062
7704
|
<ul class="member-list">
|
|
@@ -8295,7 +8937,7 @@ Array of <a href="../classes/Item.html"><tt>Item</tt></a> objects
|
|
|
8295
8937
|
<div class="button run">Run</div>
|
|
8296
8938
|
</div>
|
|
8297
8939
|
|
|
8298
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8940
|
+
<script type="text/paperscript" canvas="canvas-91">
|
|
8299
8941
|
// Create a rectangle shaped path with its top left
|
|
8300
8942
|
// point at {x: 80, y: 25} and a size of {width: 50, height: 50}:
|
|
8301
8943
|
var path = new Path.Rectangle(new Point(80, 25), new Size(50, 50));
|
|
@@ -8304,7 +8946,7 @@ path.fillColor = 'black';
|
|
|
8304
8946
|
// Rotate the path by 30 degrees:
|
|
8305
8947
|
path.rotate(30);
|
|
8306
8948
|
</script>
|
|
8307
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
8949
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-91"></canvas></div>
|
|
8308
8950
|
</div>
|
|
8309
8951
|
|
|
8310
8952
|
|
|
@@ -8316,7 +8958,7 @@ path.rotate(30);
|
|
|
8316
8958
|
<div class="button run">Run</div>
|
|
8317
8959
|
</div>
|
|
8318
8960
|
|
|
8319
|
-
<script type="text/paperscript" canvas="canvas-
|
|
8961
|
+
<script type="text/paperscript" canvas="canvas-92">
|
|
8320
8962
|
// Create a rectangle shaped path with its top left
|
|
8321
8963
|
// point at {x: 175, y: 50} and a size of {width: 100, height: 100}:
|
|
8322
8964
|
var topLeft = new Point(175, 50);
|
|
@@ -8338,7 +8980,7 @@ function onFrame(event) {
|
|
|
8338
8980
|
path.rotate(3, view.center);
|
|
8339
8981
|
}
|
|
8340
8982
|
</script>
|
|
8341
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
8983
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-92"></canvas></div>
|
|
8342
8984
|
</div>
|
|
8343
8985
|
|
|
8344
8986
|
|
|
@@ -8387,7 +9029,7 @@ function onFrame(event) {
|
|
|
8387
9029
|
<div class="button run">Run</div>
|
|
8388
9030
|
</div>
|
|
8389
9031
|
|
|
8390
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9032
|
+
<script type="text/paperscript" canvas="canvas-93">
|
|
8391
9033
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
8392
9034
|
// with a radius of 20:
|
|
8393
9035
|
var circle = new Path.Circle({
|
|
@@ -8399,7 +9041,7 @@ var circle = new Path.Circle({
|
|
|
8399
9041
|
// Scale the path by 150% from its center point
|
|
8400
9042
|
circle.scale(1.5);
|
|
8401
9043
|
</script>
|
|
8402
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9044
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-93"></canvas></div>
|
|
8403
9045
|
</div>
|
|
8404
9046
|
|
|
8405
9047
|
|
|
@@ -8411,7 +9053,7 @@ circle.scale(1.5);
|
|
|
8411
9053
|
<div class="button run">Run</div>
|
|
8412
9054
|
</div>
|
|
8413
9055
|
|
|
8414
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9056
|
+
<script type="text/paperscript" canvas="canvas-94">
|
|
8415
9057
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
8416
9058
|
// with a radius of 20:
|
|
8417
9059
|
var circle = new Path.Circle({
|
|
@@ -8423,7 +9065,7 @@ var circle = new Path.Circle({
|
|
|
8423
9065
|
// Scale the path 150% from its bottom left corner
|
|
8424
9066
|
circle.scale(1.5, circle.bounds.bottomLeft);
|
|
8425
9067
|
</script>
|
|
8426
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9068
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-94"></canvas></div>
|
|
8427
9069
|
</div>
|
|
8428
9070
|
|
|
8429
9071
|
|
|
@@ -8479,7 +9121,7 @@ circle.scale(1.5, circle.bounds.bottomLeft);
|
|
|
8479
9121
|
<div class="button run">Run</div>
|
|
8480
9122
|
</div>
|
|
8481
9123
|
|
|
8482
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9124
|
+
<script type="text/paperscript" canvas="canvas-95">
|
|
8483
9125
|
// Create a circle shaped path at { x: 100, y: 50 }
|
|
8484
9126
|
// with a radius of 20:
|
|
8485
9127
|
var circle = new Path.Circle({
|
|
@@ -8491,7 +9133,7 @@ var circle = new Path.Circle({
|
|
|
8491
9133
|
// Scale the path horizontally by 300%
|
|
8492
9134
|
circle.scale(3, 1);
|
|
8493
9135
|
</script>
|
|
8494
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9136
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-95"></canvas></div>
|
|
8495
9137
|
</div>
|
|
8496
9138
|
|
|
8497
9139
|
|
|
@@ -8929,7 +9571,7 @@ circle.scale(3, 1);
|
|
|
8929
9571
|
<div class="button run">Run</div>
|
|
8930
9572
|
</div>
|
|
8931
9573
|
|
|
8932
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9574
|
+
<script type="text/paperscript" canvas="canvas-96">
|
|
8933
9575
|
// Create a rectangle shaped path with its top left corner
|
|
8934
9576
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
8935
9577
|
var path = new Path.Rectangle({
|
|
@@ -8950,7 +9592,7 @@ var circlePath = new Path.Circle({
|
|
|
8950
9592
|
// the rectangular path:
|
|
8951
9593
|
circlePath.fitBounds(path.bounds);
|
|
8952
9594
|
</script>
|
|
8953
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9595
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-96"></canvas></div>
|
|
8954
9596
|
</div>
|
|
8955
9597
|
|
|
8956
9598
|
|
|
@@ -8962,7 +9604,7 @@ circlePath.fitBounds(path.bounds);
|
|
|
8962
9604
|
<div class="button run">Run</div>
|
|
8963
9605
|
</div>
|
|
8964
9606
|
|
|
8965
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9607
|
+
<script type="text/paperscript" canvas="canvas-97">
|
|
8966
9608
|
// Create a rectangle shaped path with its top left corner
|
|
8967
9609
|
// at {x: 80, y: 25} and a size of {width: 75, height: 50}:
|
|
8968
9610
|
var path = new Path.Rectangle({
|
|
@@ -8983,7 +9625,7 @@ var circlePath = new Path.Circle({
|
|
|
8983
9625
|
// the rectangular path:
|
|
8984
9626
|
circlePath.fitBounds(path.bounds, 'cover');
|
|
8985
9627
|
</script>
|
|
8986
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9628
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-97"></canvas></div>
|
|
8987
9629
|
</div>
|
|
8988
9630
|
|
|
8989
9631
|
|
|
@@ -8995,7 +9637,7 @@ circlePath.fitBounds(path.bounds, 'cover');
|
|
|
8995
9637
|
<div class="button run">Run</div>
|
|
8996
9638
|
</div>
|
|
8997
9639
|
|
|
8998
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9640
|
+
<script type="text/paperscript" canvas="canvas-98">
|
|
8999
9641
|
var path = new Path.Circle({
|
|
9000
9642
|
center: [80, 50],
|
|
9001
9643
|
radius: 30,
|
|
@@ -9005,7 +9647,7 @@ var path = new Path.Circle({
|
|
|
9005
9647
|
// Fit the path to the bounding rectangle of the view:
|
|
9006
9648
|
path.fitBounds(view.bounds);
|
|
9007
9649
|
</script>
|
|
9008
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
9650
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-98"></canvas></div>
|
|
9009
9651
|
</div>
|
|
9010
9652
|
|
|
9011
9653
|
|
|
@@ -9031,7 +9673,7 @@ path.fitBounds(view.bounds);
|
|
|
9031
9673
|
<li>
|
|
9032
9674
|
<tt>type:</tt>
|
|
9033
9675
|
<tt>String</tt>
|
|
9034
|
-
— 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>
|
|
9676
|
+
— 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>
|
|
9035
9677
|
|
|
9036
9678
|
</li>
|
|
9037
9679
|
|
|
@@ -9066,7 +9708,7 @@ path.fitBounds(view.bounds);
|
|
|
9066
9708
|
<div class="button run">Run</div>
|
|
9067
9709
|
</div>
|
|
9068
9710
|
|
|
9069
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9711
|
+
<script type="text/paperscript" canvas="canvas-99">
|
|
9070
9712
|
// Create a circle shaped path at the center of the view:
|
|
9071
9713
|
var path = new Path.Circle({
|
|
9072
9714
|
center: view.center,
|
|
@@ -9084,7 +9726,7 @@ path.on('mouseleave', function() {
|
|
|
9084
9726
|
this.fillColor = 'black';
|
|
9085
9727
|
});
|
|
9086
9728
|
</script>
|
|
9087
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9729
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-99"></canvas></div>
|
|
9088
9730
|
</div>
|
|
9089
9731
|
|
|
9090
9732
|
|
|
@@ -9108,7 +9750,7 @@ path.on('mouseleave', function() {
|
|
|
9108
9750
|
<li>
|
|
9109
9751
|
<tt>object:</tt>
|
|
9110
9752
|
<tt>Object</tt>
|
|
9111
|
-
— 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>
|
|
9753
|
+
— 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>
|
|
9112
9754
|
|
|
9113
9755
|
</li>
|
|
9114
9756
|
|
|
@@ -9136,7 +9778,7 @@ path.on('mouseleave', function() {
|
|
|
9136
9778
|
<div class="button run">Run</div>
|
|
9137
9779
|
</div>
|
|
9138
9780
|
|
|
9139
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9781
|
+
<script type="text/paperscript" canvas="canvas-100">
|
|
9140
9782
|
// Create a circle shaped path at the center of the view:
|
|
9141
9783
|
var path = new Path.Circle({
|
|
9142
9784
|
center: view.center,
|
|
@@ -9154,7 +9796,7 @@ path.on({
|
|
|
9154
9796
|
}
|
|
9155
9797
|
});
|
|
9156
9798
|
</script>
|
|
9157
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9799
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-100"></canvas></div>
|
|
9158
9800
|
</div>
|
|
9159
9801
|
|
|
9160
9802
|
|
|
@@ -9166,7 +9808,7 @@ path.on({
|
|
|
9166
9808
|
<div class="button run">Run</div>
|
|
9167
9809
|
</div>
|
|
9168
9810
|
|
|
9169
|
-
<script type="text/paperscript" canvas="canvas-
|
|
9811
|
+
<script type="text/paperscript" canvas="canvas-101">
|
|
9170
9812
|
var pathHandlers = {
|
|
9171
9813
|
mouseenter: function(event) {
|
|
9172
9814
|
this.fillColor = 'red';
|
|
@@ -9189,7 +9831,7 @@ function onMouseDown(event) {
|
|
|
9189
9831
|
path.on(pathHandlers);
|
|
9190
9832
|
}
|
|
9191
9833
|
</script>
|
|
9192
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
9834
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-101"></canvas></div>
|
|
9193
9835
|
</div>
|
|
9194
9836
|
|
|
9195
9837
|
|
|
@@ -9213,7 +9855,7 @@ function onMouseDown(event) {
|
|
|
9213
9855
|
<li>
|
|
9214
9856
|
<tt>type:</tt>
|
|
9215
9857
|
<tt>String</tt>
|
|
9216
|
-
— 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>
|
|
9858
|
+
— 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>
|
|
9217
9859
|
|
|
9218
9860
|
</li>
|
|
9219
9861
|
|
|
@@ -9261,7 +9903,7 @@ function onMouseDown(event) {
|
|
|
9261
9903
|
<li>
|
|
9262
9904
|
<tt>object:</tt>
|
|
9263
9905
|
<tt>Object</tt>
|
|
9264
|
-
— 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>
|
|
9906
|
+
— 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>
|
|
9265
9907
|
|
|
9266
9908
|
</li>
|
|
9267
9909
|
|
|
@@ -9302,7 +9944,7 @@ function onMouseDown(event) {
|
|
|
9302
9944
|
<li>
|
|
9303
9945
|
<tt>type:</tt>
|
|
9304
9946
|
<tt>String</tt>
|
|
9305
|
-
— 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>
|
|
9947
|
+
— 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>
|
|
9306
9948
|
|
|
9307
9949
|
</li>
|
|
9308
9950
|
|
|
@@ -9350,7 +9992,7 @@ function onMouseDown(event) {
|
|
|
9350
9992
|
<li>
|
|
9351
9993
|
<tt>type:</tt>
|
|
9352
9994
|
<tt>String</tt>
|
|
9353
|
-
— 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>
|
|
9995
|
+
— 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>
|
|
9354
9996
|
|
|
9355
9997
|
</li>
|
|
9356
9998
|
|
|
@@ -9417,7 +10059,7 @@ function onMouseDown(event) {
|
|
|
9417
10059
|
<div class="button run">Run</div>
|
|
9418
10060
|
</div>
|
|
9419
10061
|
|
|
9420
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10062
|
+
<script type="text/paperscript" canvas="canvas-102">
|
|
9421
10063
|
function onMouseDrag(event) {
|
|
9422
10064
|
// Create a circle shaped path at the mouse position,
|
|
9423
10065
|
// with a radius of 10:
|
|
@@ -9434,7 +10076,7 @@ function onMouseDrag(event) {
|
|
|
9434
10076
|
});
|
|
9435
10077
|
}
|
|
9436
10078
|
</script>
|
|
9437
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
10079
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-102"></canvas></div>
|
|
9438
10080
|
</div>
|
|
9439
10081
|
|
|
9440
10082
|
|
|
@@ -9464,7 +10106,7 @@ function onMouseDrag(event) {
|
|
|
9464
10106
|
<div class="button run">Run</div>
|
|
9465
10107
|
</div>
|
|
9466
10108
|
|
|
9467
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10109
|
+
<script type="text/paperscript" canvas="canvas-103">
|
|
9468
10110
|
function onMouseMove(event) {
|
|
9469
10111
|
// Create a circle shaped path at the mouse position,
|
|
9470
10112
|
// with a radius of 10:
|
|
@@ -9478,7 +10120,7 @@ function onMouseMove(event) {
|
|
|
9478
10120
|
path.removeOnMove();
|
|
9479
10121
|
}
|
|
9480
10122
|
</script>
|
|
9481
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
10123
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-103"></canvas></div>
|
|
9482
10124
|
</div>
|
|
9483
10125
|
|
|
9484
10126
|
|
|
@@ -9508,7 +10150,7 @@ function onMouseMove(event) {
|
|
|
9508
10150
|
<div class="button run">Run</div>
|
|
9509
10151
|
</div>
|
|
9510
10152
|
|
|
9511
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10153
|
+
<script type="text/paperscript" canvas="canvas-104">
|
|
9512
10154
|
function onMouseDown(event) {
|
|
9513
10155
|
// Create a circle shaped path at the mouse position,
|
|
9514
10156
|
// with a radius of 10:
|
|
@@ -9522,7 +10164,7 @@ function onMouseDown(event) {
|
|
|
9522
10164
|
path.removeOnDown();
|
|
9523
10165
|
}
|
|
9524
10166
|
</script>
|
|
9525
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
10167
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-104"></canvas></div>
|
|
9526
10168
|
</div>
|
|
9527
10169
|
|
|
9528
10170
|
|
|
@@ -9552,7 +10194,7 @@ function onMouseDown(event) {
|
|
|
9552
10194
|
<div class="button run">Run</div>
|
|
9553
10195
|
</div>
|
|
9554
10196
|
|
|
9555
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10197
|
+
<script type="text/paperscript" canvas="canvas-105">
|
|
9556
10198
|
function onMouseDrag(event) {
|
|
9557
10199
|
// Create a circle shaped path at the mouse position,
|
|
9558
10200
|
// with a radius of 10:
|
|
@@ -9566,7 +10208,7 @@ function onMouseDrag(event) {
|
|
|
9566
10208
|
path.removeOnDrag();
|
|
9567
10209
|
}
|
|
9568
10210
|
</script>
|
|
9569
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
10211
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-105"></canvas></div>
|
|
9570
10212
|
</div>
|
|
9571
10213
|
|
|
9572
10214
|
|
|
@@ -9596,7 +10238,7 @@ function onMouseDrag(event) {
|
|
|
9596
10238
|
<div class="button run">Run</div>
|
|
9597
10239
|
</div>
|
|
9598
10240
|
|
|
9599
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10241
|
+
<script type="text/paperscript" canvas="canvas-106">
|
|
9600
10242
|
function onMouseDown(event) {
|
|
9601
10243
|
// Create a circle shaped path at the mouse position,
|
|
9602
10244
|
// with a radius of 10:
|
|
@@ -9610,7 +10252,7 @@ function onMouseDown(event) {
|
|
|
9610
10252
|
path.removeOnUp();
|
|
9611
10253
|
}
|
|
9612
10254
|
</script>
|
|
9613
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
10255
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-106"></canvas></div>
|
|
9614
10256
|
</div>
|
|
9615
10257
|
|
|
9616
10258
|
|
|
@@ -9683,7 +10325,7 @@ function onMouseDown(event) {
|
|
|
9683
10325
|
<div class="button run">Run</div>
|
|
9684
10326
|
</div>
|
|
9685
10327
|
|
|
9686
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10328
|
+
<script type="text/paperscript" canvas="canvas-107">
|
|
9687
10329
|
var path = new Path.Circle({
|
|
9688
10330
|
radius: view.bounds.height * 0.4,
|
|
9689
10331
|
center: view.center
|
|
@@ -9694,7 +10336,7 @@ path.tween(
|
|
|
9694
10336
|
3000
|
|
9695
10337
|
);
|
|
9696
10338
|
</script>
|
|
9697
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
10339
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-107"></canvas></div>
|
|
9698
10340
|
</div>
|
|
9699
10341
|
|
|
9700
10342
|
|
|
@@ -9706,7 +10348,7 @@ path.tween(
|
|
|
9706
10348
|
<div class="button run">Run</div>
|
|
9707
10349
|
</div>
|
|
9708
10350
|
|
|
9709
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10351
|
+
<script type="text/paperscript" canvas="canvas-108">
|
|
9710
10352
|
var path = new Shape.Rectangle({
|
|
9711
10353
|
fillColor: 'red',
|
|
9712
10354
|
center: [50, view.center.y],
|
|
@@ -9721,7 +10363,7 @@ path.tween({
|
|
|
9721
10363
|
duration: 2000
|
|
9722
10364
|
});
|
|
9723
10365
|
</script>
|
|
9724
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
10366
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-108"></canvas></div>
|
|
9725
10367
|
</div>
|
|
9726
10368
|
|
|
9727
10369
|
|
|
@@ -9787,7 +10429,7 @@ path.tween({
|
|
|
9787
10429
|
<div class="button run">Run</div>
|
|
9788
10430
|
</div>
|
|
9789
10431
|
|
|
9790
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10432
|
+
<script type="text/paperscript" canvas="canvas-109">
|
|
9791
10433
|
var path = new Path.Rectangle({
|
|
9792
10434
|
size: [100, 100],
|
|
9793
10435
|
position: view.center,
|
|
@@ -9801,7 +10443,7 @@ path.tween({
|
|
|
9801
10443
|
'segments[2].point.x': '-= 50'
|
|
9802
10444
|
}, 3000);
|
|
9803
10445
|
</script>
|
|
9804
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
10446
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-109"></canvas></div>
|
|
9805
10447
|
</div>
|
|
9806
10448
|
|
|
9807
10449
|
|
|
@@ -9860,7 +10502,7 @@ path.tween({
|
|
|
9860
10502
|
<div class="button run">Run</div>
|
|
9861
10503
|
</div>
|
|
9862
10504
|
|
|
9863
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10505
|
+
<script type="text/paperscript" canvas="canvas-110">
|
|
9864
10506
|
var path = new Path.Circle({
|
|
9865
10507
|
fillColor: 'blue',
|
|
9866
10508
|
radius: view.bounds.height * 0.4,
|
|
@@ -9876,7 +10518,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
9876
10518
|
path.interpolate(pathFrom, pathTo, event.factor)
|
|
9877
10519
|
};
|
|
9878
10520
|
</script>
|
|
9879
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
10521
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-110"></canvas></div>
|
|
9880
10522
|
</div>
|
|
9881
10523
|
|
|
9882
10524
|
|
|
@@ -9997,7 +10639,7 @@ path.tween(2000).onUpdate = function(event) {
|
|
|
9997
10639
|
<div class="button run">Run</div>
|
|
9998
10640
|
</div>
|
|
9999
10641
|
|
|
10000
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10642
|
+
<script type="text/paperscript" canvas="canvas-111">
|
|
10001
10643
|
var path = new Path.Circle({
|
|
10002
10644
|
fillColor: 'blue',
|
|
10003
10645
|
radius: view.bounds.height * 0.4,
|
|
@@ -10005,7 +10647,7 @@ var path = new Path.Circle({
|
|
|
10005
10647
|
});
|
|
10006
10648
|
path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
10007
10649
|
</script>
|
|
10008
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
10650
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-111"></canvas></div>
|
|
10009
10651
|
</div>
|
|
10010
10652
|
|
|
10011
10653
|
|
|
@@ -10171,12 +10813,12 @@ path.tweenFrom({ fillColor: 'red' }, { duration: 1000 });
|
|
|
10171
10813
|
<div class="button run">Run</div>
|
|
10172
10814
|
</div>
|
|
10173
10815
|
|
|
10174
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10816
|
+
<script type="text/paperscript" canvas="canvas-112">
|
|
10175
10817
|
var result = new Path.RegularPolygon([50, 50], 3, 40)
|
|
10176
10818
|
.unite(new Path.Circle([50, 50], 25));
|
|
10177
10819
|
result.fillColor = 'red';
|
|
10178
10820
|
</script>
|
|
10179
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
10821
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-112"></canvas></div>
|
|
10180
10822
|
</div>
|
|
10181
10823
|
|
|
10182
10824
|
|
|
@@ -10188,7 +10830,7 @@ result.fillColor = 'red';
|
|
|
10188
10830
|
<div class="button run">Run</div>
|
|
10189
10831
|
</div>
|
|
10190
10832
|
|
|
10191
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10833
|
+
<script type="text/paperscript" canvas="canvas-113">
|
|
10192
10834
|
var circles = [];
|
|
10193
10835
|
for (var i = 0; i < 6; i++) {
|
|
10194
10836
|
circles.push(new Path.Circle([30 + i * 20, 50], 20));
|
|
@@ -10196,7 +10838,7 @@ for (var i = 0; i < 6; i++) {
|
|
|
10196
10838
|
var result = circles[0].unite(circles.slice(1));
|
|
10197
10839
|
result.fillColor = 'red';
|
|
10198
10840
|
</script>
|
|
10199
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
10841
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-113"></canvas></div>
|
|
10200
10842
|
</div>
|
|
10201
10843
|
|
|
10202
10844
|
|
|
@@ -10259,12 +10901,12 @@ result.fillColor = 'red';
|
|
|
10259
10901
|
<div class="button run">Run</div>
|
|
10260
10902
|
</div>
|
|
10261
10903
|
|
|
10262
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10904
|
+
<script type="text/paperscript" canvas="canvas-114">
|
|
10263
10905
|
var result = new Path.RegularPolygon([50, 50], 3, 40)
|
|
10264
10906
|
.intersect(new Path.Circle([50, 50], 25));
|
|
10265
10907
|
result.fillColor = 'red';
|
|
10266
10908
|
</script>
|
|
10267
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
10909
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-114"></canvas></div>
|
|
10268
10910
|
</div>
|
|
10269
10911
|
|
|
10270
10912
|
|
|
@@ -10299,7 +10941,245 @@ result.fillColor = 'red';
|
|
|
10299
10941
|
<li>
|
|
10300
10942
|
<tt>options:</tt>
|
|
10301
10943
|
<tt>Object</tt>
|
|
10302
|
-
— the boolean operation options
|
|
10944
|
+
— the boolean operation options
|
|
10945
|
+
— optional
|
|
10946
|
+
</li>
|
|
10947
|
+
|
|
10948
|
+
</ul>
|
|
10949
|
+
|
|
10950
|
+
|
|
10951
|
+
<ul class="member-list">
|
|
10952
|
+
<h4>Returns:</h4>
|
|
10953
|
+
|
|
10954
|
+
<li>
|
|
10955
|
+
<tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt> — the resulting path item
|
|
10956
|
+
</li>
|
|
10957
|
+
|
|
10958
|
+
|
|
10959
|
+
</ul>
|
|
10960
|
+
|
|
10961
|
+
|
|
10962
|
+
|
|
10963
|
+
|
|
10964
|
+
<h4>Example:</h4>
|
|
10965
|
+
|
|
10966
|
+
<div class="paperscript split">
|
|
10967
|
+
|
|
10968
|
+
<div class="buttons">
|
|
10969
|
+
<div class="button run">Run</div>
|
|
10970
|
+
</div>
|
|
10971
|
+
|
|
10972
|
+
<script type="text/paperscript" canvas="canvas-115">
|
|
10973
|
+
var result = new Path.RegularPolygon([50, 50], 3, 40)
|
|
10974
|
+
.subtract(new Path.Circle([50, 50], 25));
|
|
10975
|
+
result.fillColor = 'red';
|
|
10976
|
+
</script>
|
|
10977
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-115"></canvas></div>
|
|
10978
|
+
</div>
|
|
10979
|
+
|
|
10980
|
+
|
|
10981
|
+
</div>
|
|
10982
|
+
</div>
|
|
10983
|
+
</div>
|
|
10984
|
+
|
|
10985
|
+
|
|
10986
|
+
<div id="exclude-path" class="member">
|
|
10987
|
+
<div class="member-link">
|
|
10988
|
+
<a name="exclude-path" href="#exclude-path"><tt><b>exclude</b>(path[, options])</tt></a>
|
|
10989
|
+
</div>
|
|
10990
|
+
<div class="member-description hidden">
|
|
10991
|
+
<div class="member-text">
|
|
10992
|
+
<p>Excludes the intersection of the geometry of the specified path with this path’s geometry and returns the result as a new path item. With an array of paths, the result covers the areas inside an odd number of the paths, this one included. Each path keeps its own fill rule.</p>
|
|
10993
|
+
<ul class="member-list">
|
|
10994
|
+
<h4>Options:</h4>
|
|
10995
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting item should be inserted back into the scene graph, above all paths involved in the operation — default: <tt>true</tt></li>
|
|
10996
|
+
</ul>
|
|
10997
|
+
|
|
10998
|
+
<ul class="member-list">
|
|
10999
|
+
<h4>Parameters:</h4>
|
|
11000
|
+
|
|
11001
|
+
<li>
|
|
11002
|
+
<tt>path:</tt>
|
|
11003
|
+
<a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
|
|
11004
|
+
— the path or paths to exclude the intersection of
|
|
11005
|
+
|
|
11006
|
+
</li>
|
|
11007
|
+
|
|
11008
|
+
<li>
|
|
11009
|
+
<tt>options:</tt>
|
|
11010
|
+
<tt>Object</tt>
|
|
11011
|
+
— the boolean operation options
|
|
11012
|
+
— optional
|
|
11013
|
+
</li>
|
|
11014
|
+
|
|
11015
|
+
</ul>
|
|
11016
|
+
|
|
11017
|
+
|
|
11018
|
+
<ul class="member-list">
|
|
11019
|
+
<h4>Returns:</h4>
|
|
11020
|
+
|
|
11021
|
+
<li>
|
|
11022
|
+
<tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt> — the resulting path item
|
|
11023
|
+
</li>
|
|
11024
|
+
|
|
11025
|
+
|
|
11026
|
+
</ul>
|
|
11027
|
+
|
|
11028
|
+
|
|
11029
|
+
|
|
11030
|
+
|
|
11031
|
+
<h4>Example:</h4>
|
|
11032
|
+
|
|
11033
|
+
<div class="paperscript split">
|
|
11034
|
+
|
|
11035
|
+
<div class="buttons">
|
|
11036
|
+
<div class="button run">Run</div>
|
|
11037
|
+
</div>
|
|
11038
|
+
|
|
11039
|
+
<script type="text/paperscript" canvas="canvas-116">
|
|
11040
|
+
var result = new Path.RegularPolygon([50, 50], 3, 40)
|
|
11041
|
+
.exclude(new Path.Circle([50, 50], 25));
|
|
11042
|
+
result.fillColor = 'red';
|
|
11043
|
+
</script>
|
|
11044
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-116"></canvas></div>
|
|
11045
|
+
</div>
|
|
11046
|
+
|
|
11047
|
+
|
|
11048
|
+
</div>
|
|
11049
|
+
</div>
|
|
11050
|
+
</div>
|
|
11051
|
+
|
|
11052
|
+
|
|
11053
|
+
<div id="divide-path" class="member">
|
|
11054
|
+
<div class="member-link">
|
|
11055
|
+
<a name="divide-path" href="#divide-path"><tt><b>divide</b>(path[, options])</tt></a>
|
|
11056
|
+
</div>
|
|
11057
|
+
<div class="member-description hidden">
|
|
11058
|
+
<div class="member-text">
|
|
11059
|
+
<p>Splits the geometry of this path along the geometry of the specified path returns the result as a new group item. This is equivalent to calling <a href="../classes/PathItem.html#subtract-path"><tt>subtract(path)</tt></a> and <a href="../classes/PathItem.html#intersect-path"><tt>intersect(path)</tt></a> and putting the results into a new group.</p>
|
|
11060
|
+
<ul class="member-list">
|
|
11061
|
+
<h4>Options:</h4>
|
|
11062
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting item should be inserted back into the scene graph, above both paths involved in the operation — default: <tt>true</tt></li>
|
|
11063
|
+
<li><tt>options.trace: <tt>Boolean</tt></tt> — whether the tracing method is used, treating both paths as areas when determining which parts of the paths are to be kept in the result, or whether the first path is only to be split at intersections. — default: <tt>true</tt></li>
|
|
11064
|
+
</ul>
|
|
11065
|
+
|
|
11066
|
+
<ul class="member-list">
|
|
11067
|
+
<h4>Parameters:</h4>
|
|
11068
|
+
|
|
11069
|
+
<li>
|
|
11070
|
+
<tt>path:</tt>
|
|
11071
|
+
<a href="../classes/PathItem.html"><tt>PathItem</tt></a>
|
|
11072
|
+
— the path to divide by
|
|
11073
|
+
|
|
11074
|
+
</li>
|
|
11075
|
+
|
|
11076
|
+
<li>
|
|
11077
|
+
<tt>options:</tt>
|
|
11078
|
+
<tt>Object</tt>
|
|
11079
|
+
— the boolean operation options
|
|
11080
|
+
— optional
|
|
11081
|
+
</li>
|
|
11082
|
+
|
|
11083
|
+
</ul>
|
|
11084
|
+
|
|
11085
|
+
|
|
11086
|
+
<ul class="member-list">
|
|
11087
|
+
<h4>Returns:</h4>
|
|
11088
|
+
|
|
11089
|
+
<li>
|
|
11090
|
+
<tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt> — the resulting path item
|
|
11091
|
+
</li>
|
|
11092
|
+
|
|
11093
|
+
|
|
11094
|
+
</ul>
|
|
11095
|
+
|
|
11096
|
+
|
|
11097
|
+
|
|
11098
|
+
|
|
11099
|
+
|
|
11100
|
+
</div>
|
|
11101
|
+
</div>
|
|
11102
|
+
</div>
|
|
11103
|
+
|
|
11104
|
+
|
|
11105
|
+
<div id="reorient" class="member">
|
|
11106
|
+
<div class="member-link">
|
|
11107
|
+
<a name="reorient" href="#reorient"><tt><b>reorient</b>([nonZero[, clockwise]])</tt></a>
|
|
11108
|
+
</div>
|
|
11109
|
+
<div class="member-description hidden">
|
|
11110
|
+
<div class="member-text">
|
|
11111
|
+
<p>Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting them so that they are of different winding direction than their containing paths, except for disjoint sub-paths, i.e. islands, which are oriented so that they have the same winding direction as the the biggest path.</p>
|
|
11112
|
+
|
|
11113
|
+
|
|
11114
|
+
<ul class="member-list">
|
|
11115
|
+
<h4>Parameters:</h4>
|
|
11116
|
+
|
|
11117
|
+
<li>
|
|
11118
|
+
<tt>nonZero:</tt>
|
|
11119
|
+
<tt>Boolean</tt>
|
|
11120
|
+
— controls if the non-zero fill-rule is to be applied, by counting the winding of each nested path and discarding sub-paths that do not contribute to the final result
|
|
11121
|
+
— optional, default: <tt>false</tt>
|
|
11122
|
+
</li>
|
|
11123
|
+
|
|
11124
|
+
<li>
|
|
11125
|
+
<tt>clockwise:</tt>
|
|
11126
|
+
<tt>Boolean</tt>
|
|
11127
|
+
— if provided, the orientation of the root paths will be set to the orientation specified by <code>clockwise</code>, otherwise the orientation of the largest root child is used.
|
|
11128
|
+
— optional
|
|
11129
|
+
</li>
|
|
11130
|
+
|
|
11131
|
+
</ul>
|
|
11132
|
+
|
|
11133
|
+
|
|
11134
|
+
<ul class="member-list">
|
|
11135
|
+
<h4>Returns:</h4>
|
|
11136
|
+
|
|
11137
|
+
<li>
|
|
11138
|
+
<tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt> — a reference to the item itself, reoriented
|
|
11139
|
+
</li>
|
|
11140
|
+
|
|
11141
|
+
|
|
11142
|
+
</ul>
|
|
11143
|
+
|
|
11144
|
+
|
|
11145
|
+
|
|
11146
|
+
|
|
11147
|
+
|
|
11148
|
+
</div>
|
|
11149
|
+
</div>
|
|
11150
|
+
</div>
|
|
11151
|
+
|
|
11152
|
+
|
|
11153
|
+
<h3>Offsetting and Outlining</h3>
|
|
11154
|
+
|
|
11155
|
+
<div id="offset-distance" class="member">
|
|
11156
|
+
<div class="member-link">
|
|
11157
|
+
<a name="offset-distance" href="#offset-distance"><tt><b>offset</b>(distance[, options])</tt></a>
|
|
11158
|
+
</div>
|
|
11159
|
+
<div class="member-description hidden">
|
|
11160
|
+
<div class="member-text">
|
|
11161
|
+
<p>Offsets the path item by the given distance and returns the result as a new path item. Closed paths and compound paths grow by positive distances and shrink by negative ones, open paths are offset along their normals for positive distances, and against them for negative ones. As with the boolean operations, the path item’s matrix is applied first.</p>
|
|
11162
|
+
<ul class="member-list">
|
|
11163
|
+
<h4>Options:</h4>
|
|
11164
|
+
<li><tt>options.join: <tt>String</tt></tt> — the shape of the corners that the offset adds where the path turns away from it: <tt>‘miter’</tt>, <tt>‘round’</tt>, <tt>‘bevel’</tt> — default: <tt>‘miter’</tt></li>
|
|
11165
|
+
<li><tt>options.miterLimit: <tt>Number</tt></tt> — the limit of miter corners, see <a href="../classes/Style.html#miterlimit"><tt>style.miterLimit</tt></a> — default: <tt>10</tt></li>
|
|
11166
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting item should be inserted back into the scene graph, above this path — default: <tt>true</tt></li>
|
|
11167
|
+
</ul>
|
|
11168
|
+
|
|
11169
|
+
<ul class="member-list">
|
|
11170
|
+
<h4>Parameters:</h4>
|
|
11171
|
+
|
|
11172
|
+
<li>
|
|
11173
|
+
<tt>distance:</tt>
|
|
11174
|
+
<tt>Number</tt>
|
|
11175
|
+
— the distance to offset the path item by
|
|
11176
|
+
|
|
11177
|
+
</li>
|
|
11178
|
+
|
|
11179
|
+
<li>
|
|
11180
|
+
<tt>options:</tt>
|
|
11181
|
+
<tt>Object</tt>
|
|
11182
|
+
— the offset options
|
|
10303
11183
|
— optional
|
|
10304
11184
|
</li>
|
|
10305
11185
|
|
|
@@ -10327,12 +11207,13 @@ result.fillColor = 'red';
|
|
|
10327
11207
|
<div class="button run">Run</div>
|
|
10328
11208
|
</div>
|
|
10329
11209
|
|
|
10330
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10331
|
-
var
|
|
10332
|
-
|
|
10333
|
-
result
|
|
11210
|
+
<script type="text/paperscript" canvas="canvas-117">
|
|
11211
|
+
var path = new Path.Star([50, 50], 5, 20, 40);
|
|
11212
|
+
path.strokeColor = 'black';
|
|
11213
|
+
var result = path.offset(10, { join: 'round' });
|
|
11214
|
+
result.strokeColor = 'red';
|
|
10334
11215
|
</script>
|
|
10335
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
11216
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-117"></canvas></div>
|
|
10336
11217
|
</div>
|
|
10337
11218
|
|
|
10338
11219
|
|
|
@@ -10341,32 +11222,30 @@ result.fillColor = 'red';
|
|
|
10341
11222
|
</div>
|
|
10342
11223
|
|
|
10343
11224
|
|
|
10344
|
-
<div id="
|
|
11225
|
+
<div id="outline" class="member">
|
|
10345
11226
|
<div class="member-link">
|
|
10346
|
-
<a name="
|
|
11227
|
+
<a name="outline" href="#outline"><tt><b>outline</b>([options])</tt></a>
|
|
10347
11228
|
</div>
|
|
10348
11229
|
<div class="member-description hidden">
|
|
10349
11230
|
<div class="member-text">
|
|
10350
|
-
<p>
|
|
11231
|
+
<p>Outlines the stroke of the path item, and returns the area that it covers as a new path item, filled with the stroke’s color. As with the boolean operations, the path item’s matrix is applied first. Dashed strokes are outlined as their dashes, each with the stroke’s caps, as the canvas draws them, see <a href="../classes/PathItem.html#dash-options"><tt>dash(options)</tt></a>.</p>
|
|
11232
|
+
<p>Paths with a <a href="../classes/Path.html#strokeprofile"><tt>path.strokeProfile</tt></a> are outlined as the area that its pens sweep. Their round joins and caps are the pens themselves, and their other joins and caps connect the points where the pens touch the sides of the stroke. Steps in the profile end the parts of the stroke straight across, as butt caps do.</p>
|
|
10351
11233
|
<ul class="member-list">
|
|
10352
11234
|
<h4>Options:</h4>
|
|
10353
|
-
<li><tt>options.
|
|
11235
|
+
<li><tt>options.width: <tt>Number</tt></tt> — the width of the stroke — default: <tt>this.strokeWidth</tt></li>
|
|
11236
|
+
<li><tt>options.join: <tt>String</tt></tt> — the shape of the stroke’s corners: <tt>‘miter’</tt>, <tt>‘round’</tt>, <tt>‘bevel’</tt> — default: <tt>this.strokeJoin</tt></li>
|
|
11237
|
+
<li><tt>options.cap: <tt>String</tt></tt> — the shape of the stroke’s ends: <tt>‘round’</tt>, <tt>‘square’</tt>, <tt>‘butt’</tt> — default: <tt>this.strokeCap</tt></li>
|
|
11238
|
+
<li><tt>options.miterLimit: <tt>Number</tt></tt> — the limit of miter corners, see <a href="../classes/Style.html#miterlimit"><tt>style.miterLimit</tt></a> — default: <tt>this.miterLimit</tt></li>
|
|
11239
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting item should be inserted back into the scene graph, above this path — default: <tt>true</tt></li>
|
|
10354
11240
|
</ul>
|
|
10355
11241
|
|
|
10356
11242
|
<ul class="member-list">
|
|
10357
11243
|
<h4>Parameters:</h4>
|
|
10358
11244
|
|
|
10359
|
-
<li>
|
|
10360
|
-
<tt>path:</tt>
|
|
10361
|
-
<a href="../classes/PathItem.html"><tt>PathItem</tt></a>⟋Array of <a href="../classes/PathItem.html"><tt>PathItem</tt></a> objects
|
|
10362
|
-
— the path or paths to exclude the intersection of
|
|
10363
|
-
|
|
10364
|
-
</li>
|
|
10365
|
-
|
|
10366
11245
|
<li>
|
|
10367
11246
|
<tt>options:</tt>
|
|
10368
11247
|
<tt>Object</tt>
|
|
10369
|
-
— the
|
|
11248
|
+
— the outline options
|
|
10370
11249
|
— optional
|
|
10371
11250
|
</li>
|
|
10372
11251
|
|
|
@@ -10394,12 +11273,17 @@ result.fillColor = 'red';
|
|
|
10394
11273
|
<div class="button run">Run</div>
|
|
10395
11274
|
</div>
|
|
10396
11275
|
|
|
10397
|
-
<script type="text/paperscript" canvas="canvas-
|
|
10398
|
-
var
|
|
10399
|
-
|
|
10400
|
-
|
|
11276
|
+
<script type="text/paperscript" canvas="canvas-118">
|
|
11277
|
+
var path = new Path.Arc([20, 70], [50, 20], [80, 70]);
|
|
11278
|
+
path.strokeColor = 'black';
|
|
11279
|
+
path.strokeWidth = 20;
|
|
11280
|
+
path.strokeCap = 'round';
|
|
11281
|
+
var result = path.outline();
|
|
11282
|
+
result.strokeColor = 'red';
|
|
11283
|
+
result.strokeWidth = 1;
|
|
11284
|
+
path.remove();
|
|
10401
11285
|
</script>
|
|
10402
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
11286
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-118"></canvas></div>
|
|
10403
11287
|
</div>
|
|
10404
11288
|
|
|
10405
11289
|
|
|
@@ -10408,33 +11292,27 @@ result.fillColor = 'red';
|
|
|
10408
11292
|
</div>
|
|
10409
11293
|
|
|
10410
11294
|
|
|
10411
|
-
<div id="
|
|
11295
|
+
<div id="dash" class="member">
|
|
10412
11296
|
<div class="member-link">
|
|
10413
|
-
<a name="
|
|
11297
|
+
<a name="dash" href="#dash"><tt><b>dash</b>([options])</tt></a>
|
|
10414
11298
|
</div>
|
|
10415
11299
|
<div class="member-description hidden">
|
|
10416
11300
|
<div class="member-text">
|
|
10417
|
-
<p>
|
|
11301
|
+
<p>Cuts the stroke of the path item into its dashes, as the canvas draws them with the <a href="../classes/Style.html#dasharray"><tt>style.dashArray</tt></a> and <a href="../classes/Style.html#dashoffset"><tt>style.dashOffset</tt></a> of the path item or those of the options, and returns them as a new group of open paths with the path item’s style, without its dash pattern. The pattern starts over on each path of a compound path, and the dashes keep the parts of the paths’ stroke profiles. As with the boolean operations, the path item’s matrix is applied first.</p>
|
|
10418
11302
|
<ul class="member-list">
|
|
10419
11303
|
<h4>Options:</h4>
|
|
10420
|
-
<li><tt>options.
|
|
10421
|
-
<li><tt>options.
|
|
11304
|
+
<li><tt>options.dashArray: Array of <tt>Numbers</tt></tt> — the lengths of the dashes and the gaps between them — default: <tt>this.dashArray</tt></li>
|
|
11305
|
+
<li><tt>options.dashOffset: <tt>Number</tt></tt> — the offset into the pattern at which the dashes start — default: <tt>this.dashOffset</tt></li>
|
|
11306
|
+
<li><tt>options.insert: <tt>Boolean</tt></tt> — whether the resulting group should be inserted back into the scene graph, above this path item — default: <tt>true</tt></li>
|
|
10422
11307
|
</ul>
|
|
10423
11308
|
|
|
10424
11309
|
<ul class="member-list">
|
|
10425
11310
|
<h4>Parameters:</h4>
|
|
10426
11311
|
|
|
10427
|
-
<li>
|
|
10428
|
-
<tt>path:</tt>
|
|
10429
|
-
<a href="../classes/PathItem.html"><tt>PathItem</tt></a>
|
|
10430
|
-
— the path to divide by
|
|
10431
|
-
|
|
10432
|
-
</li>
|
|
10433
|
-
|
|
10434
11312
|
<li>
|
|
10435
11313
|
<tt>options:</tt>
|
|
10436
11314
|
<tt>Object</tt>
|
|
10437
|
-
— the
|
|
11315
|
+
— the dash options
|
|
10438
11316
|
— optional
|
|
10439
11317
|
</li>
|
|
10440
11318
|
|
|
@@ -10445,7 +11323,7 @@ result.fillColor = 'red';
|
|
|
10445
11323
|
<h4>Returns:</h4>
|
|
10446
11324
|
|
|
10447
11325
|
<li>
|
|
10448
|
-
<tt><a href="../classes/
|
|
11326
|
+
<tt><a href="../classes/Group.html"><tt>Group</tt></a></tt> — the dashes, as a new group of paths
|
|
10449
11327
|
</li>
|
|
10450
11328
|
|
|
10451
11329
|
|
|
@@ -10454,55 +11332,34 @@ result.fillColor = 'red';
|
|
|
10454
11332
|
|
|
10455
11333
|
|
|
10456
11334
|
|
|
10457
|
-
|
|
10458
|
-
</div>
|
|
10459
|
-
</div>
|
|
10460
|
-
</div>
|
|
10461
|
-
|
|
10462
|
-
|
|
10463
|
-
<div id="reorient" class="member">
|
|
10464
|
-
<div class="member-link">
|
|
10465
|
-
<a name="reorient" href="#reorient"><tt><b>reorient</b>([nonZero[, clockwise]])</tt></a>
|
|
10466
|
-
</div>
|
|
10467
|
-
<div class="member-description hidden">
|
|
10468
|
-
<div class="member-text">
|
|
10469
|
-
<p>Fixes the orientation of the sub-paths of a compound-path, assuming that non of its sub-paths intersect, by reorienting them so that they are of different winding direction than their containing paths, except for disjoint sub-paths, i.e. islands, which are oriented so that they have the same winding direction as the the biggest path.</p>
|
|
10470
|
-
|
|
10471
|
-
|
|
10472
|
-
<ul class="member-list">
|
|
10473
|
-
<h4>Parameters:</h4>
|
|
10474
|
-
|
|
10475
|
-
<li>
|
|
10476
|
-
<tt>nonZero:</tt>
|
|
10477
|
-
<tt>Boolean</tt>
|
|
10478
|
-
— controls if the non-zero fill-rule is to be applied, by counting the winding of each nested path and discarding sub-paths that do not contribute to the final result
|
|
10479
|
-
— optional, default: <tt>false</tt>
|
|
10480
|
-
</li>
|
|
10481
|
-
|
|
10482
|
-
<li>
|
|
10483
|
-
<tt>clockwise:</tt>
|
|
10484
|
-
<tt>Boolean</tt>
|
|
10485
|
-
— if provided, the orientation of the root paths will be set to the orientation specified by <code>clockwise</code>, otherwise the orientation of the largest root child is used.
|
|
10486
|
-
— optional
|
|
10487
|
-
</li>
|
|
10488
|
-
|
|
10489
|
-
</ul>
|
|
11335
|
+
<h4>Example:</h4>
|
|
10490
11336
|
|
|
10491
|
-
|
|
10492
|
-
<ul class="member-list">
|
|
10493
|
-
<h4>Returns:</h4>
|
|
10494
|
-
|
|
10495
|
-
<li>
|
|
10496
|
-
<tt><a href="../classes/PathItem.html"><tt>PathItem</tt></a></tt> — a reference to the item itself, reoriented
|
|
10497
|
-
</li>
|
|
11337
|
+
<div class="paperscript split">
|
|
10498
11338
|
|
|
10499
|
-
|
|
10500
|
-
|
|
11339
|
+
<div class="buttons">
|
|
11340
|
+
<div class="button run">Run</div>
|
|
11341
|
+
</div>
|
|
10501
11342
|
|
|
11343
|
+
<script type="text/paperscript" canvas="canvas-119">
|
|
11344
|
+
var path = new Path.Circle({
|
|
11345
|
+
center: [80, 50],
|
|
11346
|
+
radius: 35,
|
|
11347
|
+
strokeColor: 'black',
|
|
11348
|
+
strokeWidth: 4,
|
|
11349
|
+
dashArray: [12, 6]
|
|
11350
|
+
});
|
|
11351
|
+
// Turn every other dash red:
|
|
11352
|
+
var dashes = path.dash();
|
|
11353
|
+
dashes.children.forEach(function(dash, i) {
|
|
11354
|
+
if (i % 2)
|
|
11355
|
+
dash.strokeColor = 'red';
|
|
11356
|
+
});
|
|
11357
|
+
path.remove();
|
|
11358
|
+
</script>
|
|
11359
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-119"></canvas></div>
|
|
11360
|
+
</div>
|
|
10502
11361
|
|
|
10503
11362
|
|
|
10504
|
-
|
|
10505
|
-
|
|
10506
11363
|
</div>
|
|
10507
11364
|
</div>
|
|
10508
11365
|
</div>
|
|
@@ -10567,7 +11424,7 @@ result.fillColor = 'red';
|
|
|
10567
11424
|
<div class="button run">Run</div>
|
|
10568
11425
|
</div>
|
|
10569
11426
|
|
|
10570
|
-
<script type="text/paperscript" canvas="canvas-
|
|
11427
|
+
<script type="text/paperscript" canvas="canvas-120">
|
|
10571
11428
|
var path = new Path.Rectangle(new Point(30, 25), new Size(50, 50));
|
|
10572
11429
|
path.strokeColor = 'black';
|
|
10573
11430
|
|
|
@@ -10590,7 +11447,7 @@ function onFrame(event) {
|
|
|
10590
11447
|
}
|
|
10591
11448
|
}
|
|
10592
11449
|
</script>
|
|
10593
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
11450
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-120"></canvas></div>
|
|
10594
11451
|
</div>
|
|
10595
11452
|
|
|
10596
11453
|
|
|
@@ -10731,7 +11588,7 @@ function onFrame(event) {
|
|
|
10731
11588
|
<div class="button run">Run</div>
|
|
10732
11589
|
</div>
|
|
10733
11590
|
|
|
10734
|
-
<script type="text/paperscript" canvas="canvas-
|
|
11591
|
+
<script type="text/paperscript" canvas="canvas-121">
|
|
10735
11592
|
var star = new Path.Star({
|
|
10736
11593
|
center: view.center,
|
|
10737
11594
|
points: 10,
|
|
@@ -10755,7 +11612,7 @@ function onMouseMove(event) {
|
|
|
10755
11612
|
circle.position = nearestPoint;
|
|
10756
11613
|
}
|
|
10757
11614
|
</script>
|
|
10758
|
-
<div class="canvas"><canvas width="516" height="200" id="canvas-
|
|
11615
|
+
<div class="canvas"><canvas width="516" height="200" id="canvas-121"></canvas></div>
|
|
10759
11616
|
</div>
|
|
10760
11617
|
|
|
10761
11618
|
|
|
@@ -10818,7 +11675,7 @@ function onMouseMove(event) {
|
|
|
10818
11675
|
<div class="button run">Run</div>
|
|
10819
11676
|
</div>
|
|
10820
11677
|
|
|
10821
|
-
<script type="text/paperscript" canvas="canvas-
|
|
11678
|
+
<script type="text/paperscript" canvas="canvas-122">
|
|
10822
11679
|
// Create a circle shaped path at { x: 80, y: 50 }
|
|
10823
11680
|
// with a radius of 35:
|
|
10824
11681
|
var path = new Path.Circle({
|
|
@@ -10836,7 +11693,7 @@ copy.position.x += 150;
|
|
|
10836
11693
|
// Flatten the copied path, with a maximum error of 4 points:
|
|
10837
11694
|
copy.flatten(4);
|
|
10838
11695
|
</script>
|
|
10839
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
11696
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-122"></canvas></div>
|
|
10840
11697
|
</div>
|
|
10841
11698
|
|
|
10842
11699
|
|
|
@@ -10914,7 +11771,7 @@ copy.flatten(4);
|
|
|
10914
11771
|
<div class="button run">Run</div>
|
|
10915
11772
|
</div>
|
|
10916
11773
|
|
|
10917
|
-
<script type="text/paperscript" canvas="canvas-
|
|
11774
|
+
<script type="text/paperscript" canvas="canvas-123">
|
|
10918
11775
|
// Create a rectangular path with its top-left point at
|
|
10919
11776
|
// {x: 30, y: 25} and a size of {width: 50, height: 50}:
|
|
10920
11777
|
var path = new Path.Rectangle({
|
|
@@ -10933,7 +11790,7 @@ copy.position.x += 100;
|
|
|
10933
11790
|
// Smooth the segments of the copy:
|
|
10934
11791
|
copy.smooth({ type: 'continuous' });
|
|
10935
11792
|
</script>
|
|
10936
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
11793
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-123"></canvas></div>
|
|
10937
11794
|
</div>
|
|
10938
11795
|
|
|
10939
11796
|
|
|
@@ -10945,7 +11802,7 @@ copy.smooth({ type: 'continuous' });
|
|
|
10945
11802
|
<div class="button run">Run</div>
|
|
10946
11803
|
</div>
|
|
10947
11804
|
|
|
10948
|
-
<script type="text/paperscript" canvas="canvas-
|
|
11805
|
+
<script type="text/paperscript" canvas="canvas-124">
|
|
10949
11806
|
var path = new Path();
|
|
10950
11807
|
path.strokeColor = 'black';
|
|
10951
11808
|
|
|
@@ -10970,7 +11827,7 @@ copy.fullySelected = true;
|
|
|
10970
11827
|
// Smooth the path using centripetal Catmull-Rom splines:
|
|
10971
11828
|
copy.smooth({ type: 'catmull-rom', factor: 0.5 });
|
|
10972
11829
|
</script>
|
|
10973
|
-
<div class="canvas"><canvas width="516" height="220" id="canvas-
|
|
11830
|
+
<div class="canvas"><canvas width="516" height="220" id="canvas-124"></canvas></div>
|
|
10974
11831
|
</div>
|
|
10975
11832
|
|
|
10976
11833
|
|
|
@@ -10982,7 +11839,7 @@ copy.smooth({ type: 'catmull-rom', factor: 0.5 });
|
|
|
10982
11839
|
<div class="button run">Run</div>
|
|
10983
11840
|
</div>
|
|
10984
11841
|
|
|
10985
|
-
<script type="text/paperscript" canvas="canvas-
|
|
11842
|
+
<script type="text/paperscript" canvas="canvas-125">
|
|
10986
11843
|
// Create 5 rectangles, next to each other:
|
|
10987
11844
|
var paths = [];
|
|
10988
11845
|
for (var i = 0; i < 5; i++) {
|
|
@@ -11012,7 +11869,7 @@ paths[3].smooth({ type: 'continuous', from: 0, to: 2 });
|
|
|
11012
11869
|
// Smooth a range, using negative indices:
|
|
11013
11870
|
paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
|
|
11014
11871
|
</script>
|
|
11015
|
-
<div class="canvas"><canvas width="516" height="110" id="canvas-
|
|
11872
|
+
<div class="canvas"><canvas width="516" height="110" id="canvas-125"></canvas></div>
|
|
11016
11873
|
</div>
|
|
11017
11874
|
|
|
11018
11875
|
|
|
@@ -11023,22 +11880,28 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
|
|
|
11023
11880
|
|
|
11024
11881
|
<div id="simplify" class="member">
|
|
11025
11882
|
<div class="member-link">
|
|
11026
|
-
<a name="simplify" href="#simplify"><tt><b>simplify</b>([
|
|
11883
|
+
<a name="simplify" href="#simplify"><tt><b>simplify</b>([options])</tt></a>
|
|
11027
11884
|
</div>
|
|
11028
11885
|
<div class="member-description hidden">
|
|
11029
11886
|
<div class="member-text">
|
|
11030
11887
|
<p>Fits a sequence of as few curves as possible through the path’s anchor points, ignoring the path items’s curve-handles, with an allowed maximum error. When called on <a href="../classes/CompoundPath.html"><tt>CompoundPath</tt></a> items, each of the nested paths is simplified. On <a href="../classes/Path.html"><tt>Path</tt></a> items, the <a href="../classes/Path.html#segments"><tt>path.segments</tt></a> array is processed and replaced by the resulting sequence of fitted curves.</p>
|
|
11031
11888
|
<p>This method can be used to process and simplify the point data received from a mouse or touch device.</p>
|
|
11032
|
-
|
|
11889
|
+
<p>With <code>options.from</code> and <code>options.to</code>, only the segments in that range are replaced. The fitted curves join the curves outside of the range tangentially where these have handles.</p>
|
|
11890
|
+
<ul class="member-list">
|
|
11891
|
+
<h4>Options:</h4>
|
|
11892
|
+
<li><tt>options.tolerance: <tt>Number</tt></tt> — the allowed maximum error when fitting the curves through the segment points — default: <tt>2.5</tt></li>
|
|
11893
|
+
<li><tt>options.from: <tt>Number</tt>⟋<a href="../classes/Segment.html"><tt>Segment</tt></a>⟋<a href="../classes/Curve.html"><tt>Curve</tt></a></tt> — the segment or curve at which to start simplifying, if not the full path shall be simplified (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path.</li>
|
|
11894
|
+
<li><tt>options.to: <tt>Number</tt>⟋<a href="../classes/Segment.html"><tt>Segment</tt></a>⟋<a href="../classes/Curve.html"><tt>Curve</tt></a></tt> — the segment or curve up to which to simplify (inclusive). This can either be a segment index, or a segment or curve object that is part of the path. If the passed number is negative, the index is wrapped around the end of the path.</li>
|
|
11895
|
+
</ul>
|
|
11033
11896
|
|
|
11034
11897
|
<ul class="member-list">
|
|
11035
11898
|
<h4>Parameters:</h4>
|
|
11036
11899
|
|
|
11037
11900
|
<li>
|
|
11038
|
-
<tt>
|
|
11039
|
-
<tt>Number</tt>
|
|
11040
|
-
— the
|
|
11041
|
-
— optional
|
|
11901
|
+
<tt>options:</tt>
|
|
11902
|
+
<tt>Object</tt>⟋<tt>Number</tt>
|
|
11903
|
+
— the simplification options, or the tolerance as a number
|
|
11904
|
+
— optional
|
|
11042
11905
|
</li>
|
|
11043
11906
|
|
|
11044
11907
|
</ul>
|
|
@@ -11065,7 +11928,7 @@ paths[4].smooth({ type: 'continuous', from: -1, to: 1 });
|
|
|
11065
11928
|
<div class="button run">Run</div>
|
|
11066
11929
|
</div>
|
|
11067
11930
|
|
|
11068
|
-
<script type="text/paperscript" canvas="canvas-
|
|
11931
|
+
<script type="text/paperscript" canvas="canvas-126">
|
|
11069
11932
|
var path;
|
|
11070
11933
|
function onMouseDown(event) {
|
|
11071
11934
|
// If we already made a path before, deselect it:
|
|
@@ -11095,7 +11958,7 @@ function onMouseUp(event) {
|
|
|
11095
11958
|
path.selected = true;
|
|
11096
11959
|
}
|
|
11097
11960
|
</script>
|
|
11098
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
11961
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-126"></canvas></div>
|
|
11099
11962
|
</div>
|
|
11100
11963
|
|
|
11101
11964
|
|
|
@@ -11294,7 +12157,7 @@ function onMouseUp(event) {
|
|
|
11294
12157
|
<div class="button run">Run</div>
|
|
11295
12158
|
</div>
|
|
11296
12159
|
|
|
11297
|
-
<script type="text/paperscript" canvas="canvas-
|
|
12160
|
+
<script type="text/paperscript" canvas="canvas-127">
|
|
11298
12161
|
var path = new Path();
|
|
11299
12162
|
path.strokeColor = 'black';
|
|
11300
12163
|
|
|
@@ -11314,7 +12177,7 @@ path.arcTo(throughPoint, toPoint);
|
|
|
11314
12177
|
var circle = new Path.Circle(throughPoint, 3);
|
|
11315
12178
|
circle.fillColor = 'red';
|
|
11316
12179
|
</script>
|
|
11317
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
12180
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-127"></canvas></div>
|
|
11318
12181
|
</div>
|
|
11319
12182
|
|
|
11320
12183
|
|
|
@@ -11326,7 +12189,7 @@ circle.fillColor = 'red';
|
|
|
11326
12189
|
<div class="button run">Run</div>
|
|
11327
12190
|
</div>
|
|
11328
12191
|
|
|
11329
|
-
<script type="text/paperscript" canvas="canvas-
|
|
12192
|
+
<script type="text/paperscript" canvas="canvas-128">
|
|
11330
12193
|
var myPath;
|
|
11331
12194
|
function onMouseDrag(event) {
|
|
11332
12195
|
// If we created a path before, remove it:
|
|
@@ -11354,7 +12217,7 @@ function onMouseUp(event) {
|
|
|
11354
12217
|
myPath.fillColor = 'black';
|
|
11355
12218
|
}
|
|
11356
12219
|
</script>
|
|
11357
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
12220
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-128"></canvas></div>
|
|
11358
12221
|
</div>
|
|
11359
12222
|
|
|
11360
12223
|
|
|
@@ -11403,7 +12266,7 @@ function onMouseUp(event) {
|
|
|
11403
12266
|
<div class="button run">Run</div>
|
|
11404
12267
|
</div>
|
|
11405
12268
|
|
|
11406
|
-
<script type="text/paperscript" canvas="canvas-
|
|
12269
|
+
<script type="text/paperscript" canvas="canvas-129">
|
|
11407
12270
|
var path = new Path();
|
|
11408
12271
|
path.strokeColor = 'black';
|
|
11409
12272
|
|
|
@@ -11418,7 +12281,7 @@ path2.add(new Point(180, 25));
|
|
|
11418
12281
|
// we pass `false` as the second argument to arcTo:
|
|
11419
12282
|
path2.arcTo(new Point(280, 25), false);
|
|
11420
12283
|
</script>
|
|
11421
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
12284
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-129"></canvas></div>
|
|
11422
12285
|
</div>
|
|
11423
12286
|
|
|
11424
12287
|
|
|
@@ -11430,7 +12293,7 @@ path2.arcTo(new Point(280, 25), false);
|
|
|
11430
12293
|
<div class="button run">Run</div>
|
|
11431
12294
|
</div>
|
|
11432
12295
|
|
|
11433
|
-
<script type="text/paperscript" canvas="canvas-
|
|
12296
|
+
<script type="text/paperscript" canvas="canvas-130">
|
|
11434
12297
|
var myPath;
|
|
11435
12298
|
|
|
11436
12299
|
// The mouse has to move at least 20 points before
|
|
@@ -11451,7 +12314,158 @@ function onMouseDrag(event) {
|
|
|
11451
12314
|
myPath.arcTo(event.point);
|
|
11452
12315
|
}
|
|
11453
12316
|
</script>
|
|
11454
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
12317
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-130"></canvas></div>
|
|
12318
|
+
</div>
|
|
12319
|
+
|
|
12320
|
+
|
|
12321
|
+
</div>
|
|
12322
|
+
</div>
|
|
12323
|
+
</div>
|
|
12324
|
+
|
|
12325
|
+
|
|
12326
|
+
<div id="arcaround-center-angle" class="member">
|
|
12327
|
+
<div class="member-link">
|
|
12328
|
+
<a name="arcaround-center-angle" href="#arcaround-center-angle"><tt><b>arcAround</b>(center, angle)</tt></a>
|
|
12329
|
+
</div>
|
|
12330
|
+
<div class="member-description hidden">
|
|
12331
|
+
<div class="member-text">
|
|
12332
|
+
<p>Adds an arc that sweeps the specified angle around the specified <code>center</code> point, from the position of the last segment in the path, by adding one or more segments to the path. Positive angles draw the arc in clockwise direction, negative ones in anticlockwise direction.</p>
|
|
12333
|
+
|
|
12334
|
+
|
|
12335
|
+
<ul class="member-list">
|
|
12336
|
+
<h4>Parameters:</h4>
|
|
12337
|
+
|
|
12338
|
+
<li>
|
|
12339
|
+
<tt>center:</tt>
|
|
12340
|
+
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
12341
|
+
— the center of the arc
|
|
12342
|
+
|
|
12343
|
+
</li>
|
|
12344
|
+
|
|
12345
|
+
<li>
|
|
12346
|
+
<tt>angle:</tt>
|
|
12347
|
+
<tt>Number</tt>
|
|
12348
|
+
— the angle in degrees that the arc sweeps over
|
|
12349
|
+
|
|
12350
|
+
</li>
|
|
12351
|
+
|
|
12352
|
+
</ul>
|
|
12353
|
+
|
|
12354
|
+
|
|
12355
|
+
|
|
12356
|
+
|
|
12357
|
+
|
|
12358
|
+
<h4>Example:</h4>
|
|
12359
|
+
|
|
12360
|
+
<div class="paperscript split">
|
|
12361
|
+
|
|
12362
|
+
<div class="buttons">
|
|
12363
|
+
<div class="button run">Run</div>
|
|
12364
|
+
</div>
|
|
12365
|
+
|
|
12366
|
+
<script type="text/paperscript" canvas="canvas-131">
|
|
12367
|
+
var path = new Path();
|
|
12368
|
+
path.strokeColor = 'black';
|
|
12369
|
+
path.add(new Point(30, 75));
|
|
12370
|
+
path.lineTo(new Point(80, 75));
|
|
12371
|
+
|
|
12372
|
+
// Draw a half circle around (105, 75) and continue on the other side:
|
|
12373
|
+
path.arcAround(new Point(105, 75), 180);
|
|
12374
|
+
path.lineTo(new Point(180, 75));
|
|
12375
|
+
|
|
12376
|
+
// Draw a full circle around (230, 75):
|
|
12377
|
+
var circle = new Path();
|
|
12378
|
+
circle.strokeColor = 'red';
|
|
12379
|
+
circle.add(new Point(250, 75));
|
|
12380
|
+
circle.arcAround(new Point(230, 75), 360);
|
|
12381
|
+
</script>
|
|
12382
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-131"></canvas></div>
|
|
12383
|
+
</div>
|
|
12384
|
+
|
|
12385
|
+
|
|
12386
|
+
</div>
|
|
12387
|
+
</div>
|
|
12388
|
+
</div>
|
|
12389
|
+
|
|
12390
|
+
|
|
12391
|
+
<div id="arctowards-to" class="member">
|
|
12392
|
+
<div class="member-link">
|
|
12393
|
+
<a name="arctowards-to" href="#arctowards-to"><tt><b>arcTowards</b>(to)</tt></a>
|
|
12394
|
+
</div>
|
|
12395
|
+
<div class="member-description hidden">
|
|
12396
|
+
<div class="member-text">
|
|
12397
|
+
<p>Adds an arc from the position of the last segment in the path to the specified point, by adding one or more segments to the path. The arc continues in the direction in which the path ends, without a corner.</p>
|
|
12398
|
+
|
|
12399
|
+
|
|
12400
|
+
<ul class="member-list">
|
|
12401
|
+
<h4>Parameters:</h4>
|
|
12402
|
+
|
|
12403
|
+
<li>
|
|
12404
|
+
<tt>to:</tt>
|
|
12405
|
+
<a href="../classes/Point.html"><tt>Point</tt></a>
|
|
12406
|
+
— the point where the arc should end
|
|
12407
|
+
|
|
12408
|
+
</li>
|
|
12409
|
+
|
|
12410
|
+
</ul>
|
|
12411
|
+
|
|
12412
|
+
|
|
12413
|
+
|
|
12414
|
+
|
|
12415
|
+
|
|
12416
|
+
<h4>Example:</h4>
|
|
12417
|
+
|
|
12418
|
+
<div class="paperscript split">
|
|
12419
|
+
|
|
12420
|
+
<div class="buttons">
|
|
12421
|
+
<div class="button run">Run</div>
|
|
12422
|
+
</div>
|
|
12423
|
+
|
|
12424
|
+
<script type="text/paperscript" canvas="canvas-132">
|
|
12425
|
+
var path = new Path();
|
|
12426
|
+
path.strokeColor = 'black';
|
|
12427
|
+
path.add(new Point(30, 125));
|
|
12428
|
+
path.lineTo(new Point(80, 125));
|
|
12429
|
+
|
|
12430
|
+
// Each arc continues smoothly from where the path ends:
|
|
12431
|
+
path.arcTowards(new Point(130, 75));
|
|
12432
|
+
path.arcTowards(new Point(230, 75));
|
|
12433
|
+
path.lineTo(new Point(230, 125));
|
|
12434
|
+
</script>
|
|
12435
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-132"></canvas></div>
|
|
12436
|
+
</div>
|
|
12437
|
+
|
|
12438
|
+
|
|
12439
|
+
<h4>Example:<span class="description">Interactive example. Click and drag in the view below:</span></h4>
|
|
12440
|
+
|
|
12441
|
+
<div class="paperscript split">
|
|
12442
|
+
|
|
12443
|
+
<div class="buttons">
|
|
12444
|
+
<div class="button run">Run</div>
|
|
12445
|
+
</div>
|
|
12446
|
+
|
|
12447
|
+
<script type="text/paperscript" canvas="canvas-133">
|
|
12448
|
+
var myPath;
|
|
12449
|
+
|
|
12450
|
+
// The mouse has to move at least 20 points before
|
|
12451
|
+
// the next mouse drag event is fired:
|
|
12452
|
+
tool.minDistance = 20;
|
|
12453
|
+
|
|
12454
|
+
// When the user clicks, create a new path that starts
|
|
12455
|
+
// with a horizontal line ending at the mouse position:
|
|
12456
|
+
function onMouseDown(event) {
|
|
12457
|
+
myPath = new Path();
|
|
12458
|
+
myPath.strokeColor = 'black';
|
|
12459
|
+
myPath.add(event.point - [20, 0], event.point);
|
|
12460
|
+
}
|
|
12461
|
+
|
|
12462
|
+
// On each mouse drag event, continue the path smoothly
|
|
12463
|
+
// with an arc to the current position of the mouse:
|
|
12464
|
+
function onMouseDrag(event) {
|
|
12465
|
+
myPath.arcTowards(event.point);
|
|
12466
|
+
}
|
|
12467
|
+
</script>
|
|
12468
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-133"></canvas></div>
|
|
11455
12469
|
</div>
|
|
11456
12470
|
|
|
11457
12471
|
|
|
@@ -11507,7 +12521,7 @@ function onMouseDrag(event) {
|
|
|
11507
12521
|
<div class="button run">Run</div>
|
|
11508
12522
|
</div>
|
|
11509
12523
|
|
|
11510
|
-
<script type="text/paperscript" canvas="canvas-
|
|
12524
|
+
<script type="text/paperscript" canvas="canvas-134">
|
|
11511
12525
|
var myPath;
|
|
11512
12526
|
function onMouseMove(event) {
|
|
11513
12527
|
// If we created a path before, remove it:
|
|
@@ -11528,7 +12542,7 @@ function onMouseMove(event) {
|
|
|
11528
12542
|
myPath.selected = true;
|
|
11529
12543
|
}
|
|
11530
12544
|
</script>
|
|
11531
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
12545
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-134"></canvas></div>
|
|
11532
12546
|
</div>
|
|
11533
12547
|
|
|
11534
12548
|
|
|
@@ -11713,7 +12727,7 @@ function onMouseMove(event) {
|
|
|
11713
12727
|
<div class="button run">Run</div>
|
|
11714
12728
|
</div>
|
|
11715
12729
|
|
|
11716
|
-
<script type="text/paperscript" canvas="canvas-
|
|
12730
|
+
<script type="text/paperscript" canvas="canvas-135">
|
|
11717
12731
|
var path = new Path();
|
|
11718
12732
|
path.strokeColor = 'black';
|
|
11719
12733
|
|
|
@@ -11727,7 +12741,7 @@ path.lineBy(50, 0);
|
|
|
11727
12741
|
// 0 in x direction and 50 in y direction, becomes {x: 75, y: 75}
|
|
11728
12742
|
path.lineBy(0, 50);
|
|
11729
12743
|
</script>
|
|
11730
|
-
<div class="canvas"><canvas width="516" height="100" id="canvas-
|
|
12744
|
+
<div class="canvas"><canvas width="516" height="100" id="canvas-135"></canvas></div>
|
|
11731
12745
|
</div>
|
|
11732
12746
|
|
|
11733
12747
|
|
|
@@ -11739,7 +12753,7 @@ path.lineBy(0, 50);
|
|
|
11739
12753
|
<div class="button run">Run</div>
|
|
11740
12754
|
</div>
|
|
11741
12755
|
|
|
11742
|
-
<script type="text/paperscript" canvas="canvas-
|
|
12756
|
+
<script type="text/paperscript" canvas="canvas-136">
|
|
11743
12757
|
var path = new Path();
|
|
11744
12758
|
path.strokeColor = 'black';
|
|
11745
12759
|
|
|
@@ -11765,7 +12779,7 @@ path.smooth();
|
|
|
11765
12779
|
// the construction of the path:
|
|
11766
12780
|
// path.selected = true;
|
|
11767
12781
|
</script>
|
|
11768
|
-
<div class="canvas"><canvas width="516" height="300" id="canvas-
|
|
12782
|
+
<div class="canvas"><canvas width="516" height="300" id="canvas-136"></canvas></div>
|
|
11769
12783
|
</div>
|
|
11770
12784
|
|
|
11771
12785
|
|
|
@@ -11984,7 +12998,7 @@ path.smooth();
|
|
|
11984
12998
|
|
|
11985
12999
|
<!-- =========================== copyright notice ========================== -->
|
|
11986
13000
|
<p class="footer">
|
|
11987
|
-
Paper.js v0.
|
|
13001
|
+
Paper.js v0.17.0<br>
|
|
11988
13002
|
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>
|
|
11989
13003
|
<div class="content-end"></div>
|
|
11990
13004
|
|