Skip to content

Instantly share code, notes, and snippets.

@wolfspider
Created September 30, 2017 21:39
Show Gist options
  • Select an option

  • Save wolfspider/ccfd47483e7fb231b327a40e6121c575 to your computer and use it in GitHub Desktop.

Select an option

Save wolfspider/ccfd47483e7fb231b327a40e6121c575 to your computer and use it in GitHub Desktop.
Swift SVG playground
Display the source blob
Display the rendered blob
Raw
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
id="svg2"
width="960"
version="1.1"
height="540">
<metadata
id="metadata94">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs92" />
<g
id="RenderLayer_pencil">
<g
id="strokes">
<path
id="path6"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 338.193,214.706 331.731,209.869 328.985,205.273 328.413,204.337 327.993,203.652 327.709,204.660 328.283,205.595 331.358,210.580 337.783,215.145 329.091,212.695 325.443,206.896 324.872,205.960 324.453,205.273 " />
<path
fill="none"
stroke="rgb(0,0,0)"
stroke-width="5.0"
stroke-linecap="butt"
stroke-linejoin="round"
stroke-opacity="1.0"
id="path8"
d=" M 604.447,167.101 603.853,168.018 598.756,175.828 593.327,181.210 588.480,185.755 579.371,191.956 574.883,194.896 565.290,199.675 558.150,203.059 548.256,206.611 538.750,209.808 538.541,209.877 528.492,212.352 518.702,214.623 516.512,215.121 506.443,216.715 496.503,218.253 492.675,218.849 482.695,219.807 472.704,220.852 467.713,221.418 457.878,222.027 447.896,222.850 442.272,223.406 432.561,223.925 422.593,224.722 417.931,225.173 408.248,225.576 398.252,226.146 395.990,226.291 386.258,226.184 376.631,226.104 366.898,225.045 360.113,224.268 350.583,221.808 346.704,220.767 346.742,220.778 337.758,216.378 336.893,215.944 336.621,215.807 336.533,216.632 345.415,221.226 346.270,221.680 346.344,221.720 355.902,224.869 359.699,226.176 369.558,228.330 376.211,229.875 386.278,231.296 395.807,232.726 406.043,233.463 416.049,234.182 418.313,234.338 428.658,234.264 438.673,234.076 443.358,233.929 453.684,232.799 463.597,231.477 469.178,230.621 479.304,228.273 489.006,225.797 493.848,224.496 503.638,221.130 513.082,217.738 516.714,216.413 526.104,212.270 535.276,208.177 537.325,207.264 546.273,202.493 555.147,197.805 555.342,197.703 563.770,192.335 570.480,188.143 578.214,182.089 582.482,178.828 586.798,174.311 591.116,169.931 595.599,162.562 596.183,161.638 601.230,166.284 596.208,174.144 591.267,179.033 586.473,183.635 577.816,189.694 573.406,192.748 564.235,197.693 557.283,201.430 547.797,205.528 538.620,209.501 538.419,209.588 528.709,212.994 519.273,216.305 517.164,217.044 507.269,219.802 497.634,222.480 493.923,223.511 483.879,225.653 474.098,227.733 469.202,228.772 459.035,230.292 449.141,231.745 443.552,232.554 433.285,233.365 423.312,234.093 418.640,234.412 408.312,234.363 398.311,234.233 396.048,234.197 385.746,233.193 376.185,232.204 366.018,230.129 359.339,228.736 349.487,225.344 345.696,224.021 345.166,223.791 336.467,218.845 335.625,218.367 335.360,218.217 " />
<path
id="path10"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 426.380,136.883 419.934,138.334 410.343,141.032 402.036,143.401 392.617,146.696 385.322,149.281 376.147,153.225 370.004,155.886 361.167,160.540 356.318,163.103 347.971,168.580 344.538,170.837 343.295,171.851 335.698,178.345 333.589,180.151 327.304,187.860 326.543,188.793 325.096,190.777 323.844,193.416 319.849,202.330 318.801,205.830 316.614,215.551 315.339,221.268 313.262,231.045 312.121,236.490 310.244,246.299 309.279,251.393 307.669,261.235 306.909,265.905 305.711,275.197 305.095,279.952 304.239,289.829 303.915,293.466 303.336,303.372 303.171,306.033 302.733,315.966 302.555,319.579 302.700,329.392 302.724,332.337 303.596,342.069 303.787,344.354 305.119,351.405 305.889,355.606 308.245,365.183 309.209,369.172 312.621,378.357 312.988,379.352 318.135,387.628 320.926,392.148 326.522,400.415 326.626,400.569 333.673,407.208 341.003,414.027 346.076,418.735 353.744,423.593 362.396,428.700 370.138,433.239 377.483,436.344 386.936,439.882 396.315,443.362 397.228,443.700 399.309,444.273 403.405,445.391 413.321,447.578 423.091,449.722 425.766,450.308 430.165,451.114 433.661,451.726 431.355,443.508 427.107,442.732 417.469,440.629 407.694,438.511 405.017,437.934 401.127,436.889 399.291,436.402 390.262,433.133 380.842,429.773 379.925,429.447 372.945,426.668 364.779,422.097 356.925,417.766 349.393,413.340 342.616,407.361 337.378,402.848 330.076,396.501 324.943,389.350 324.832,389.201 319.335,381.133 316.331,376.760 312.944,368.539 312.526,367.565 309.905,358.593 308.726,354.664 307.834,350.831 306.111,343.595 304.864,334.192 304.551,331.919 304.041,322.316 303.875,319.373 303.982,309.642 304.017,306.021 304.329,296.092 304.415,293.426 305.080,283.534 305.338,279.889 305.884,275.224 307.039,265.869 308.687,256.064 309.518,251.407 311.607,241.665 312.758,236.611 315.253,226.949 316.717,221.578 319.529,211.984 321.237,206.369 322.529,203.098 327.106,194.901 328.584,192.395 329.809,191.187 336.645,184.171 337.485,183.303 344.952,178.099 347.202,176.460 348.428,175.622 356.639,171.092 360.208,169.045 368.686,165.136 373.622,162.737 382.332,159.150 388.470,156.478 397.355,153.109 404.555,150.260 413.612,147.115 421.756,144.211 427.746,142.362 418.257,131.603 408.560,135.154 400.447,138.159 390.993,142.230 383.875,145.304 374.704,149.911 368.713,152.920 359.903,158.138 355.176,160.932 346.862,166.878 343.513,169.264 342.153,170.435 334.731,177.201 332.672,179.068 326.407,187.119 325.669,188.069 324.229,190.135 322.932,192.972 319.103,201.988 318.082,205.606 316.047,215.416 314.860,221.154 312.918,230.967 311.845,236.427 310.079,246.264 309.168,251.370 307.655,261.232 306.935,265.910 305.796,275.211 305.202,279.968 304.389,289.845 304.082,293.484 303.568,303.390 303.427,306.052 303.113,315.987 302.994,319.603 303.356,329.382 303.457,332.326 304.635,341.963 304.905,344.240 306.488,351.115 307.421,355.282 310.142,364.652 311.266,368.596 314.953,377.386 315.356,378.366 320.551,385.984 323.488,390.403 329.258,398.375 329.366,398.526 336.080,404.407 343.560,411.017 348.737,415.602 355.882,419.872 364.510,424.773 372.304,429.214 379.137,432.021 388.434,435.481 397.800,438.999 398.711,439.344 400.405,439.820 404.491,440.978 414.168,443.244 423.910,445.532 426.577,446.158 430.824,447.002 434.281,447.662 " />
<path
id="path12"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 604.163,157.231 603.975,157.978 602.106,165.331 596.587,156.145 596.781,155.400 603.841,157.945 601.912,165.283 " />
<path
id="path14"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 527.151,123.847 536.007,123.763 546.545,124.447 552.545,124.872 563.112,126.531 567.568,127.257 578.085,130.131 580.885,130.918 591.168,135.433 592.293,135.943 601.545,142.566 606.111,148.288 590.062,154.120 584.259,150.042 576.722,146.414 575.620,145.855 567.155,142.924 564.411,141.934 555.364,139.576 550.986,138.382 541.541,136.474 535.611,135.220 527.001,133.903 535.897,131.102 545.797,133.409 551.716,134.799 561.211,137.873 565.559,139.245 574.461,143.123 577.167,144.250 585.140,149.053 586.219,149.665 592.327,155.288 593.225,157.672 " />
<path
id="path16"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 594.645,151.385 594.969,154.051 595.447,158.011 604.520,152.123 604.197,149.457 593.942,154.258 594.431,158.216 " />
<path
id="path18"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 626.565,171.100 623.634,165.532 618.758,156.722 615.709,151.422 610.496,143.704 608.326,140.713 605.540,137.894 596.742,131.532 594.514,130.128 584.347,125.976 582.898,125.426 580.749,124.789 570.668,122.683 567.619,122.094 557.126,121.216 552.379,120.889 542.047,121.023 535.751,121.141 525.605,121.969 517.909,122.561 507.931,123.803 498.944,124.787 489.082,126.211 484.230,126.832 493.881,122.850 498.748,122.379 508.825,122.067 517.853,121.927 527.911,122.463 535.596,122.929 545.542,124.233 551.766,125.049 561.514,127.110 566.161,128.065 575.590,130.983 578.558,131.871 580.093,132.414 589.066,136.437 590.486,137.056 592.189,138.183 600.370,143.829 602.438,145.707 604.532,148.270 610.209,155.255 616.159,163.206 619.861,168.062 623.649,173.050 620.388,167.703 614.203,159.817 610.421,155.015 604.492,148.263 602.091,145.613 599.925,143.911 591.583,138.894 589.615,137.818 580.639,134.651 579.182,134.118 577.843,133.795 568.250,131.702 565.227,131.017 555.748,129.860 551.049,129.234 541.454,128.704 535.198,128.305 525.540,128.300 517.851,128.251 508.166,128.730 499.152,129.147 489.472,130.097 484.605,130.569 " />
<path
id="path20"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 327.867,202.520 331.850,195.604 338.926,188.524 339.572,187.871 347.609,182.250 349.587,180.832 358.115,176.187 361.518,174.262 370.317,170.250 375.058,167.991 384.040,164.420 389.985,161.959 393.653,160.692 386.173,152.529 376.708,156.654 370.832,159.272 361.707,164.239 357.114,166.775 348.466,172.689 345.259,174.908 337.352,181.979 335.556,183.607 328.918,192.141 328.364,192.868 324.800,201.179 335.172,197.057 340.665,189.921 341.213,189.189 348.093,182.808 349.859,181.146 357.640,175.471 360.784,173.158 369.168,168.104 373.661,165.381 382.478,160.886 388.217,157.959 392.038,156.307 " />
<path
id="path22"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 676.751,305.283 676.942,303.325 677.765,293.355 677.854,292.361 677.461,288.176 676.791,280.548 674.921,270.596 674.481,268.190 672.403,258.315 671.599,254.438 668.951,244.573 668.268,242.027 664.854,232.279 663.768,229.211 659.703,219.726 658.149,216.187 653.488,207.022 651.417,203.095 646.623,195.005 639.542,210.130 644.692,218.444 647.102,222.178 652.184,230.501 654.244,233.779 659.081,242.249 660.718,245.071 665.095,253.824 666.282,256.187 670.248,265.286 671.829,268.929 675.524,278.264 676.416,280.549 678.410,288.026 679.463,292.085 680.064,302.428 680.112,303.426 680.157,305.455 674.442,303.198 674.136,293.250 674.117,292.253 673.337,288.827 671.930,281.315 669.331,272.098 668.704,269.741 665.984,260.244 664.936,256.441 661.874,247.150 661.064,244.650 657.437,235.585 656.234,232.569 652.076,223.648 650.435,220.155 645.798,211.409 643.692,207.502 639.046,199.662 " />
<path
id="path24"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 597.902,414.790 601.225,412.607 605.298,409.866 609.683,406.313 617.278,399.768 617.450,399.619 625.015,393.020 626.383,391.821 631.168,386.634 637.536,379.054 644.032,371.400 644.290,371.098 648.828,364.403 653.632,356.119 658.032,348.847 661.856,340.875 664.721,332.319 666.999,326.070 669.249,318.236 669.686,316.775 683.154,322.166 680.568,330.521 676.568,340.306 673.979,346.439 668.673,355.407 662.272,363.891 657.110,370.640 651.118,377.328 643.351,384.380 635.944,391.111 635.651,391.379 629.944,396.139 621.419,401.994 619.927,403.023 611.718,408.738 611.532,408.868 606.808,412.035 602.344,414.548 598.859,416.480 599.729,409.967 603.970,407.558 608.421,404.490 616.470,398.658 616.653,398.525 624.747,392.652 626.214,391.589 631.432,386.930 638.489,380.020 645.659,373.048 645.943,372.772 651.263,366.394 656.934,358.388 661.867,351.481 666.467,343.375 670.057,334.307 672.521,328.127 675.063,319.879 675.513,318.422 " />
<path
id="path26"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 625.906,195.298 635.917,194.859 640.208,194.672 647.518,194.344 657.554,193.928 667.238,193.467 677.282,193.077 684.957,192.721 695.011,192.493 700.598,192.343 710.662,192.551 714.092,192.613 724.123,193.623 725.370,193.747 733.780,195.795 734.368,195.938 733.503,197.001 725.196,194.982 715.311,194.037 714.064,193.918 704.094,193.820 700.664,193.788 690.683,194.217 685.102,194.465 675.133,195.232 667.480,195.841 657.528,196.835 647.899,197.833 640.642,198.658 630.709,199.813 626.452,200.315 636.363,198.951 640.618,198.438 647.868,197.557 657.806,196.411 667.423,195.290 677.384,194.288 685.024,193.512 695.028,192.795 700.600,192.391 710.661,192.175 714.091,192.100 724.198,192.727 725.448,192.805 734.061,194.564 734.655,194.686 " />
<path
id="path28"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 671.967,312.192 680.690,307.298 686.937,303.955 695.014,299.124 703.681,294.128 703.966,293.966 711.772,288.797 719.130,283.976 726.489,278.239 732.268,273.720 738.973,267.282 743.269,263.126 749.093,255.943 752.076,252.239 752.893,250.988 757.985,242.633 760.024,239.257 763.424,230.812 764.603,227.905 766.468,219.067 767.026,216.496 767.265,207.511 767.352,205.050 767.109,202.407 765.289,193.255 765.008,191.806 760.589,185.146 760.507,185.009 758.871,182.746 752.165,177.935 751.942,177.763 744.117,175.054 742.296,174.354 740.009,173.601 730.990,172.055 727.025,171.327 717.670,170.684 710.920,170.164 701.244,170.052 691.627,169.890 681.768,170.093 671.750,170.276 669.306,170.317 659.347,170.709 649.335,171.109 644.110,171.325 634.113,171.858 624.115,172.437 623.879,172.451 633.964,172.639 643.947,171.924 644.183,171.906 654.151,171.210 664.125,170.442 669.328,170.017 679.264,169.396 689.242,168.725 691.677,168.555 701.573,168.262 711.172,167.937 720.990,168.267 727.751,168.456 737.372,169.824 741.365,170.363 743.631,171.035 753.010,174.190 754.864,174.801 762.600,180.268 762.833,180.428 764.572,182.693 770.150,190.894 770.241,191.027 772.726,200.512 773.113,201.941 773.617,205.238 774.073,215.310 774.195,217.779 772.932,228.001 772.613,230.623 769.647,240.671 768.753,243.692 764.219,253.288 762.515,256.859 761.468,258.835 755.721,267.613 753.079,271.578 746.074,279.693 742.103,284.161 734.161,291.310 728.625,296.113 719.977,302.264 712.727,307.234 703.606,312.463 694.862,317.336 694.576,317.495 685.176,321.952 678.750,324.959 682.771,311.215 689.192,308.200 697.705,303.497 706.438,298.608 706.723,298.448 714.823,293.033 722.100,288.099 729.634,281.914 735.273,277.231 742.081,270.270 746.246,265.987 752.155,258.284 755.049,254.512 756.019,252.963 761.029,244.411 763.025,241.010 766.584,232.069 767.757,229.159 769.817,219.790 770.396,217.223 770.839,207.646 770.966,205.187 770.777,202.135 769.109,192.525 768.860,191.070 764.146,183.020 764.066,182.880 762.304,180.299 754.832,174.429 754.611,174.253 745.684,170.789 743.870,170.071 741.372,169.225 731.687,167.503 727.719,166.793 717.822,166.212 711.068,165.817 701.090,165.961 691.486,166.121 681.500,166.745 671.521,167.411 669.087,167.581 659.123,168.544 649.177,169.583 643.989,170.157 634.062,171.407 624.147,172.714 623.912,172.746 " />
<path
id="path30"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 677.863,292.350 678.012,296.738 677.714,301.630 677.240,305.302 677.066,306.676 677.426,305.324 677.879,301.647 678.112,296.747 677.870,292.350 677.866,296.746 677.714,301.630 677.359,305.316 677.231,306.695 " />
<path
id="path32"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 740.552,204.912 740.613,209.046 739.529,217.030 737.163,225.920 733.507,235.216 733.421,235.435 728.741,244.307 728.616,244.543 728.212,245.303 727.556,243.937 732.280,235.118 732.407,234.883 736.179,225.725 736.269,225.508 738.825,216.741 740.127,208.824 740.179,204.902 742.980,209.111 741.563,217.394 738.796,226.427 734.726,235.750 734.631,235.966 729.585,244.790 729.452,245.021 729.023,245.768 " />
<path
id="path34"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 728.368,244.445 722.272,252.374 721.456,253.424 714.496,260.628 712.355,262.830 704.683,269.216 701.656,271.737 693.415,277.291 689.399,280.025 680.721,284.783 676.472,287.162 686.371,284.331 690.566,281.857 698.641,275.757 702.480,272.776 709.698,265.735 712.496,262.955 718.772,255.147 720.687,252.736 725.971,244.322 726.678,243.191 724.241,253.836 723.539,254.970 717.221,263.129 715.336,265.567 708.120,273.100 705.385,275.951 697.308,282.731 693.568,285.850 684.696,291.744 680.618,294.422 " />
<path
id="path36"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 304.230,272.326 294.824,271.420 285.743,268.339 281.229,266.740 273.096,261.478 270.366,259.677 263.388,252.848 261.433,250.910 255.294,243.215 253.573,241.037 247.648,233.036 245.871,230.623 239.450,222.788 237.358,220.234 229.823,213.115 227.038,210.500 218.087,204.776 213.954,202.178 210.027,200.432 206.543,199.274 203.395,198.570 197.911,197.778 195.448,197.585 188.349,197.451 180.129,197.862 171.545,198.753 170.745,198.857 162.826,200.050 155.534,201.623 149.517,203.565 145.096,206.073 143.614,207.430 142.032,211.169 144.289,216.872 147.719,218.977 150.248,220.336 154.728,222.111 160.591,223.939 169.264,227.735 178.459,231.664 182.269,233.267 188.906,238.785 196.815,244.910 198.006,245.815 203.769,252.717 210.398,260.232 210.942,260.835 216.449,268.689 222.346,276.829 222.883,277.559 228.596,285.791 234.392,294.030 234.970,294.849 241.216,302.672 247.266,310.345 247.962,311.080 255.030,317.773 261.571,324.258 262.758,325.233 270.490,330.035 278.737,335.697 280.750,337.145 288.545,340.111 297.676,344.229 303.196,346.905 303.530,346.965 300.720,356.443 290.735,351.496 281.889,346.632 276.505,343.600 268.995,336.333 261.777,329.250 259.979,327.504 259.068,326.148 253.734,317.793 248.583,310.129 248.233,309.390 243.869,300.697 239.197,292.178 234.771,283.610 229.857,274.898 229.352,274.041 223.742,265.500 217.999,257.271 217.472,256.535 210.184,248.777 203.132,241.589 202.559,241.010 193.691,235.287 185.186,229.892 183.919,229.080 174.402,226.216 164.849,223.125 160.926,221.788 155.543,220.560 151.301,219.180 148.455,217.834 145.818,216.464 144.132,215.069 143.746,209.479 144.847,207.725 149.129,204.879 155.398,202.681 162.769,201.107 170.850,200.052 171.598,199.973 180.074,199.388 188.178,199.328 195.206,199.789 197.509,200.070 202.793,201.079 205.630,201.832 208.859,203.047 212.315,204.729 220.684,210.452 224.723,213.211 231.811,220.238 234.541,222.915 240.698,230.642 242.777,233.207 248.658,241.191 250.453,243.590 256.746,251.443 258.493,253.599 265.806,260.810 267.776,262.733 276.451,268.610 279.169,270.427 289.025,274.326 293.489,276.054 303.368,277.705 294.953,270.620 286.177,267.210 281.700,265.514 273.842,260.347 271.093,258.578 264.117,252.084 262.086,250.225 255.622,242.938 253.769,240.872 247.298,233.315 245.340,231.046 238.336,223.777 236.037,221.407 228.105,215.082 225.110,212.708 216.184,208.004 211.858,205.733 208.366,204.516 205.190,203.723 202.456,203.329 197.268,202.943 195.124,202.923 188.316,203.214 180.506,204.063 172.294,205.370 171.673,205.488 163.942,207.052 157.170,208.867 151.969,210.850 149.177,212.791 149.553,212.616 149.665,213.470 149.777,211.015 151.684,211.865 154.080,213.029 157.704,214.245 163.071,215.686 172.762,219.513 182.053,223.217 185.891,224.754 194.805,231.556 202.652,237.758 203.822,238.688 210.759,247.308 216.883,255.214 217.375,255.857 222.646,265.095 227.442,273.873 227.868,274.668 232.295,283.809 236.530,292.884 236.946,293.790 241.501,302.497 245.945,311.156 246.503,312.109 252.239,320.141 257.571,327.652 258.805,329.141 266.385,335.709 273.977,342.277 275.861,343.903 285.340,348.493 294.398,352.803 299.945,355.410 302.302,355.946 " />
<path
id="path38"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 149.004,213.950 146.338,212.867 149.367,213.256 146.078,213.364 " />
<path
id="path40"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 199.889,205.581 199.719,205.678 197.050,207.189 196.686,207.395 191.514,208.822 184.810,209.942 177.247,210.703 171.446,210.983 169.485,211.079 162.184,211.056 158.162,210.771 157.491,210.725 156.011,210.625 157.415,216.461 158.087,216.506 162.273,216.788 169.892,216.797 172.036,216.685 177.923,216.390 185.771,215.578 192.850,214.363 198.645,212.715 200.097,211.988 202.758,210.466 202.928,210.369 197.181,201.680 194.522,203.205 194.159,203.414 190.022,204.400 183.815,205.475 176.565,206.311 171.002,206.682 169.045,206.822 161.970,206.960 158.215,206.778 157.543,206.750 156.062,206.690 " />
<path
id="path42"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 205.303,204.882 205.209,205.858 205.135,206.616 195.217,204.577 195.313,203.601 205.313,205.872 205.239,206.630 " />
<path
id="path44"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 202.495,205.302 202.388,206.377 197.667,204.709 202.439,206.384 " />
<path
id="path46"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 173.066,215.082 173.396,214.849 176.627,213.548 181.034,212.242 186.058,211.112 191.239,210.241 196.139,209.693 197.416,209.645 195.941,205.855 190.787,206.432 185.391,207.356 180.129,208.566 175.387,210.008 171.545,211.637 170.983,211.996 172.653,213.748 176.130,212.284 180.664,210.896 185.774,209.705 191.028,208.784 196.008,208.195 197.395,208.134 " />
<path
id="path48"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 477.841,135.561 478.134,135.112 478.152,135.085 478.841,134.031 481.900,129.331 484.304,125.545 485.770,123.227 486.727,121.389 489.016,115.665 489.114,113.860 488.167,109.419 487.394,107.960 485.868,106.828 483.592,105.918 478.627,104.036 476.098,103.501 473.018,103.210 469.433,103.176 465.401,103.413 460.976,103.930 456.204,104.736 451.358,105.790 446.717,107.025 442.336,108.409 438.275,109.910 434.599,111.496 431.377,113.129 428.691,114.765 426.633,116.340 425.318,117.747 421.787,121.671 420.966,123.122 421.281,123.480 422.502,125.574 422.932,127.052 423.097,126.155 427.303,130.027 429.474,131.281 432.704,133.398 437.976,136.853 438.998,137.532 439.008,137.539 442.154,140.295 444.072,142.033 444.652,142.563 435.774,151.050 433.870,149.296 431.431,147.022 432.089,147.548 431.087,146.841 425.929,143.135 422.795,140.797 419.998,138.677 415.158,133.514 413.742,131.750 412.272,127.750 411.627,123.047 412.392,118.878 414.708,115.509 419.430,111.357 421.638,109.678 424.739,107.901 428.243,106.388 432.128,105.075 436.359,103.944 440.889,102.991 445.669,102.220 450.646,101.639 455.769,101.256 460.760,101.089 465.355,101.139 469.516,101.395 473.198,101.848 476.357,102.493 478.941,103.323 483.729,105.637 486.021,106.790 487.472,108.113 488.059,109.560 488.712,113.967 488.514,115.643 486.064,121.085 485.094,122.832 483.609,125.078 481.167,128.834 478.118,133.537 477.439,134.598 477.422,134.625 477.134,135.077 477.933,134.975 477.951,134.948 478.625,133.884 481.604,129.129 483.926,125.291 485.337,122.936 486.227,121.109 488.343,115.370 488.332,113.789 487.272,109.574 486.530,108.365 485.219,107.597 483.144,106.892 478.154,105.131 475.775,104.705 472.825,104.500 469.346,104.533 465.404,104.817 461.058,105.361 456.357,106.165 451.570,107.183 446.978,108.349 442.635,109.635 438.600,111.014 434.938,112.461 431.721,113.945 429.031,115.429 426.966,116.856 425.643,118.121 421.942,121.829 421.044,123.179 421.278,123.479 422.264,125.620 422.609,127.127 422.772,126.438 426.777,130.546 428.953,132.023 432.083,134.283 437.218,137.952 438.214,138.667 438.225,138.675 441.146,141.390 443.014,143.183 443.580,143.727 " />
<path
id="path50"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 409.685,123.664 410.072,125.306 412.909,129.778 416.800,132.390 420.984,133.830 425.502,134.600 430.444,134.870 435.844,134.685 441.684,134.044 447.919,132.937 454.212,131.426 460.219,129.621 465.855,127.583 471.042,125.374 475.704,123.053 479.769,120.671 483.167,118.278 485.833,115.913 487.699,113.608 488.691,111.391 488.712,109.390 488.264,111.164 487.385,113.212 485.604,115.437 482.989,117.743 479.620,120.066 475.571,122.352 470.920,124.542 465.744,126.581 460.127,128.408 454.156,129.967 447.923,131.205 441.796,132.036 436.119,132.432 430.960,132.425 426.369,132.043 422.378,131.307 418.989,130.203 416.169,128.647 413.917,126.362 412.683,122.974 420.706,122.858 421.051,122.615 422.121,123.062 424.261,123.776 427.370,124.440 431.308,124.924 435.968,125.165 441.258,125.124 447.095,124.770 453.116,124.102 458.938,123.157 464.460,121.961 469.580,120.546 474.204,118.950 478.237,117.218 481.590,115.402 484.171,113.566 485.891,111.798 486.680,110.247 486.599,109.188 " />
<path
id="path52"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 442.677,150.688 442.973,151.013 443.024,151.069 443.247,151.314 443.321,151.395 444.119,151.802 445.315,152.186 446.878,152.480 448.766,152.652 450.940,152.686 453.366,152.569 450.952,154.783 448.631,154.739 446.564,154.539 444.770,154.185 443.263,153.675 442.047,152.985 441.707,152.682 441.485,152.436 441.435,152.380 441.141,152.052 443.137,150.868 443.187,150.924 443.408,151.170 443.481,151.252 444.224,151.625 445.379,152.003 446.915,152.305 448.783,152.492 450.944,152.546 453.361,152.454 " />
<path
id="path54"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 473.792,139.519 473.859,139.346 474.746,137.068 475.978,133.962 478.150,138.753 477.216,141.008 477.145,141.178 473.032,138.937 473.982,136.690 475.306,133.629 " />
<path
id="path56"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 459.516,156.164 462.213,155.777 464.952,155.236 467.535,154.578 469.934,153.812 472.125,152.940 474.091,151.952 475.827,150.815 477.333,149.442 470.245,144.500 469.448,144.898 468.218,145.443 466.625,146.023 464.734,146.580 462.605,147.078 460.293,147.492 457.847,147.801 462.606,157.746 465.450,157.200 468.145,156.529 470.665,155.736 472.994,154.818 475.126,153.753 477.068,152.489 478.841,150.888 " />
<path
id="path58"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 478.624,144.806 478.660,144.327 478.965,140.148 471.011,143.986 470.978,144.465 478.908,144.338 479.186,140.158 " />
<path
id="path60"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 475.522,149.167 474.820,148.433 474.643,148.248 472.814,146.334 478.910,143.904 479.087,144.089 479.788,144.824 474.996,148.253 474.820,148.068 472.994,146.151 " />
<path
id="path62"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 434.939,143.389 426.392,145.491 416.868,148.269 411.074,149.921 401.676,153.122 396.734,154.780 392.203,156.614 383.553,160.086 374.596,164.470 371.753,165.859 367.361,168.212 358.826,173.463 356.589,174.844 348.769,181.230 347.819,182.011 341.406,189.698 337.906,197.558 336.262,201.724 340.743,198.687 343.905,191.127 349.698,183.743 356.931,177.241 357.840,176.413 365.893,170.770 368.040,169.254 372.214,166.650 380.856,161.675 383.596,160.093 391.961,156.066 396.417,153.917 405.683,150.143 410.509,148.172 419.993,144.892 425.688,142.914 434.196,140.426 426.448,145.717 417.104,149.039 411.427,151.073 402.351,154.957 397.558,157.018 393.341,159.186 385.034,163.434 376.773,168.527 374.071,170.179 370.074,172.843 362.301,178.666 360.184,180.229 353.516,186.662 352.618,187.503 347.532,194.528 345.315,200.648 343.796,204.588 " />
<path
id="path64"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 344.071,202.303 344.023,209.594 346.578,213.468 350.756,216.693 336.487,220.920 331.828,212.349 331.160,202.237 344.292,209.595 346.919,213.306 351.088,216.334 " />
<path
id="path66"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 583.232,172.722 585.364,169.406 586.405,163.397 584.842,159.033 581.476,155.576 597.706,153.626 600.345,163.813 598.262,175.027 595.104,180.611 584.622,168.913 585.617,163.193 584.157,159.156 581.044,155.878 " />
<path
id="path68"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 479.676,141.262 477.741,141.051 477.866,151.185 477.688,141.344 " />
<path
id="path70"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 586.379,152.344 583.446,149.214 576.588,144.455 567.637,140.827 567.516,140.777 558.066,138.501 556.411,138.097 546.741,136.832 543.552,136.401 538.981,135.781 529.237,135.238 526.757,135.082 525.381,134.993 515.608,134.977 510.468,134.911 500.678,135.256 494.341,135.390 484.523,135.986 478.670,136.270 488.185,130.846 494.050,130.688 504.156,131.034 510.512,131.301 520.507,132.363 525.640,132.920 526.918,133.161 536.805,134.926 539.263,135.359 543.539,136.503 553.257,138.989 556.387,139.765 565.411,143.024 567.024,143.579 575.297,147.854 575.415,147.912 581.234,152.658 583.245,155.145 588.574,144.631 580.772,138.822 570.532,134.392 570.410,134.342 559.960,131.790 558.299,131.410 547.865,130.186 544.662,129.843 540.058,129.364 529.750,129.139 527.260,129.094 525.878,129.069 515.689,129.564 510.544,129.814 500.482,130.865 494.167,131.504 484.228,132.994 478.430,133.833 " />
<path
id="path72"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 402.307,437.053 405.794,438.689 414.676,441.131 421.965,443.237 431.107,444.524 440.810,446.004 450.042,446.287 460.041,446.705 462.047,446.793 471.256,446.210 481.247,445.703 485.329,445.517 494.455,444.223 504.372,442.932 509.199,442.322 518.176,440.319 527.953,438.216 532.076,437.337 540.828,434.571 550.381,431.614 553.434,430.673 561.853,427.114 571.089,423.280 572.787,422.578 580.741,418.215 589.546,413.472 589.726,413.376 597.023,408.164 603.874,403.336 610.214,397.217 612.607,394.945 616.429,413.090 614.033,415.359 604.979,421.817 598.097,426.600 588.473,431.703 579.570,436.268 579.388,436.360 569.371,440.177 559.955,443.585 558.220,444.200 547.961,446.726 538.181,448.952 535.049,449.641 524.727,450.901 514.735,451.986 510.519,452.425 500.325,452.533 490.266,452.604 485.372,452.645 475.466,451.813 465.448,451.080 461.356,450.818 451.814,449.285 441.889,447.949 439.896,447.710 430.693,445.617 421.066,443.752 412.166,440.990 404.868,438.911 402.016,437.601 401.574,446.618 411.876,449.347 419.264,451.161 429.575,452.281 439.370,453.297 449.483,453.247 459.512,453.290 461.523,453.315 471.396,452.512 481.385,451.900 485.467,451.709 495.185,450.462 505.128,449.395 509.973,448.938 519.638,447.223 529.514,445.587 533.682,444.920 543.292,442.479 553.001,440.024 556.102,439.236 565.525,435.798 574.905,432.305 576.625,431.654 585.637,427.020 594.478,422.344 594.658,422.247 602.966,416.308 609.733,411.367 617.009,404.125 619.331,401.780 " />
<path
id="path74"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 157.626,217.509 153.884,216.934 158.600,209.743 153.911,216.721 " />
<path
id="path76"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 332.241,205.634 332.307,202.903 332.355,200.618 324.733,202.693 324.689,205.425 332.201,202.900 332.226,200.614 " />
<path
id="path78"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 444.929,151.886 443.990,154.310 443.910,154.515 443.246,156.204 436.726,151.219 436.807,151.014 437.780,148.605 444.394,154.496 444.310,154.699 443.612,156.372 " />
<path
id="path80"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 437.924,147.409 439.764,151.139 440.220,152.066 443.308,149.599 441.480,145.863 440.185,150.955 440.635,151.886 " />
<path
id="path82"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 443.148,157.082 440.197,158.811 437.910,148.436 440.116,158.677 " />
<path
id="path84"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 733.465,196.770 737.722,198.876 740.577,200.285 738.153,197.976 733.891,195.882 737.654,199.017 740.516,200.414 " />
<path
id="path86"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 745.193,199.954 746.139,203.636 746.236,204.015 737.123,206.240 736.183,202.556 745.884,203.710 745.980,204.088 " />
<path
id="path88"
stroke-width="5.0"
stroke-opacity="1.0"
stroke-linejoin="round"
stroke-linecap="butt"
stroke="rgb(0,0,0)"
fill="none"
d=" M 735.537,200.684 738.279,203.425 739.443,204.586 739.459,204.603 739.647,204.790 743.932,200.428 743.915,200.412 742.750,199.251 740.002,196.517 738.594,203.130 739.763,204.288 739.779,204.304 739.968,204.491 " />
</g>
</g>
</svg>
Display the source blob
Display the rendered blob
Raw
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
//: Playground - noun: a place where people can play
import SpriteKit
import PlaygroundSupport
import Foundation
let fileURL = Bundle.main.url(forResource: "blurplain", withExtension: "svg")
let content = try String(contentsOf: fileURL!, encoding: String.Encoding.utf8)
let frame = CGRect(x: 0, y: 0, width: 1024, height: 768)
//Set up the view and show the scene
let view = SKView(frame: frame)
var scene = SKScene(size: frame.size)
scene.scaleMode = SKSceneScaleMode.aspectFit
let midPoint = CGPoint(x: frame.width / 6 , y: frame.height )
var path = CGMutablePath()
var compositePath = CGMutablePath()
var pathPointX:Float = 0.0
var pathPointY:Float = 0.0
var qpathPointCX:Float = 0.0
var qpathPointCY:Float = 0.0
var qpathPointX:Float = 0.0
var qpathPointY:Float = 0.0
var cpoint = CGPoint()
var mpoint = CGPoint()
var qswitch:Bool = false
var qswitch2:Bool = false
var qswitch3:Bool = false
class ParserBase : NSObject, XMLParserDelegate {
var currentElement:String = ""
var foundCharacters = ""
weak var parent:ParserBase? = nil
func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String]) {
currentElement = elementName
}
func parser(_ parser: XMLParser, foundCharacters string: String) {
self.foundCharacters += string
}
}
class SVG : ParserBase {
var id = ""
var groups = [Group]()
override func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String]) {
print("processing <\(elementName)> tag from SVG")
if elementName == "svg" {
if let id = String?(attributeDict["id"]!) {
self.id = id
print(id)
}
}
if elementName == "g" {
let group = Group()
self.groups.append(group)
parser.delegate = group
group.parent = self
}
}
}
class Group : ParserBase {
var path = ""
override func parser(_ parser: XMLParser, didStartElement elementName: String, namespaceURI: String?, qualifiedName qName: String?, attributes attributeDict: [String : String]) {
print("processing <\(elementName)> tag from Group")
if elementName == "path" {
if let d = String?(attributeDict["d"]!) {
self.path.append(d)
}
parser.delegate = self
}
foundCharacters = ""
}
}
let xmlData = content.data(using: String.Encoding.utf8)
let parser = XMLParser(data: xmlData!)
let svg = SVG()
parser.delegate = svg
parser.parse()
var commandBuffer:String = ""
var commandWindow:Bool = false
func closePath()
{
path.addPath(compositePath)
compositePath = CGMutablePath()
commandWindow = false
//print("path closed")
}
func moveTo (_ point: String)
{
//let pathShape = shapeArray[0]
let coords = point.characters.split(separator: ",")
if(commandWindow == false)
{
pathPointX += (String(coords[0]) as NSString).floatValue
pathPointY += (String(coords[1]) as NSString).floatValue
mpoint.x = CGFloat(pathPointX)
mpoint.y = CGFloat(pathPointY)
compositePath.move(to: mpoint)
//print("Move To:")
//print(mpoint)
//print(pathPointX,pathPointY)
commandWindow = true
}
else
{
pathPointX += (String(coords[0]) as NSString).floatValue
pathPointY += (String(coords[1]) as NSString).floatValue
mpoint.x = CGFloat(pathPointX)
mpoint.y = CGFloat(pathPointY)
compositePath.addLine(to: mpoint)
//print(mpoint)
//print("Move To Draw Line:")
//print(pathPointX,pathPointY)
}
}
func moveToAbsolute (_ point: String)
{
//let pathShape = shapeArray[0]
let coords = point.characters.split(separator: ",")
if(commandWindow == false)
{
pathPointX = (String(coords[0]) as NSString).floatValue
pathPointY = (String(coords[1]) as NSString).floatValue
mpoint.x = CGFloat(pathPointX)
mpoint.y = CGFloat(pathPointY)
compositePath.move(to: mpoint)
//print("Move To Absolute:")
//print(mpoint)
//print(pathPointX,pathPointY)
commandWindow = true
}
else
{
pathPointX = (String(coords[0]) as NSString).floatValue
pathPointY = (String(coords[1]) as NSString).floatValue
mpoint.x = CGFloat(pathPointX)
mpoint.y = CGFloat(pathPointY)
compositePath.addLine(to: mpoint)
//print(mpoint)
//print("Move To Draw Line:")
//print(pathPointX,pathPointY)
}
}
func quadCurve (_ point: String)
{
//these things come in 3s
let coords = point.characters.split(separator: ",")
if(qswitch == false && qswitch2 == false && qswitch3 == false){
qpathPointCX = pathPointX
qpathPointCY = pathPointY
qpathPointCX += (String(coords[0]) as NSString).floatValue
qpathPointCY += (String(coords[1]) as NSString).floatValue
qswitch = true
return
}
if(qswitch2 == false && qswitch == true && qswitch3 == false){
qpathPointX = pathPointX
qpathPointY = pathPointY
qpathPointX += (String(coords[0]) as NSString).floatValue
qpathPointY += (String(coords[1]) as NSString).floatValue
mpoint.x = CGFloat(qpathPointX)
mpoint.y = CGFloat(qpathPointY)
cpoint.x = CGFloat(qpathPointCX)
cpoint.y = CGFloat(qpathPointCY)
//print("quadcurve:")
//print(pathPointX,pathPointY,qpathPointCX,qpathPointCY,qpathPointX,qpathPointY)
compositePath.addQuadCurve(to: mpoint, control: cpoint)
qswitch2 = true
return
}
if(qswitch == true && qswitch2 == true && qswitch3 == false){
qpathPointCX = qpathPointX + (String(coords[0]) as NSString).floatValue
qpathPointCY = qpathPointY + (String(coords[1]) as NSString).floatValue
qswitch3 = true
return
}
if(qswitch == true && qswitch2 == true && qswitch3 == true){
qpathPointX = qpathPointX + (String(coords[0]) as NSString).floatValue
qpathPointY = qpathPointY + (String(coords[1]) as NSString).floatValue
mpoint.x = CGFloat(qpathPointX)
mpoint.y = CGFloat(qpathPointY)
cpoint.x = CGFloat(qpathPointCX)
cpoint.y = CGFloat(qpathPointCY)
compositePath.addQuadCurve(to: mpoint, control: cpoint)
qswitch3 = false
pathPointX = qpathPointX
pathPointY = qpathPointY
return
}
}
func drawLine (_ point: String)
{
let coords = point.characters.split(separator: ",")
pathPointX += (String(coords[0]) as NSString).floatValue
pathPointY += (String(coords[1]) as NSString).floatValue
mpoint.x = CGFloat(pathPointX)
mpoint.y = CGFloat(pathPointY)
compositePath.addLine(to: mpoint)
commandWindow = false
qswitch = false
qswitch2 = false
qswitch3 = false
}
func getDescription (_ descriptorValue: String.CharacterView)
{
//print(String(descriptorValue))
let command = String(descriptorValue)
let commandList = ["c","C","h","H","l","L","m","M","q","Q","s","S","t","T","z","Z"]
if(commandBuffer != "" && !commandList.contains(command))
{
//print("Command Buffer is "+commandBuffer)
switch commandBuffer {
case "MoveTo":moveTo(command)
case "MoveToAbsolute":moveToAbsolute(command)
case "QuadCurve":quadCurve(command)
case "DrawLine":drawLine(command)
default: break
}
}
switch command {
case "c": break
case "C": break
case "h": break
case "H": break
case "l": commandBuffer = "DrawLine"
case "L": break
case "m": commandBuffer = "MoveTo"
case "M": commandBuffer = "MoveToAbsolute"
closePath()
case "q": commandBuffer = "QuadCurve"
case "Q": break
case "s": break
case "S": break
case "t": break
case "T": break
case "z": closePath()
case "Z": break
default: break
}
}
for group in svg.groups {
//This should have a some way to describe yes we have a path
//print("group path = \(group.path)")
let pathSplit = group.path.characters.split(separator: " ")
pathSplit.forEach { getDescription($0) }
}
closePath()
let effect = SKEffectNode()
var shape = SKShapeNode.init(path: path)
path = CGMutablePath()
shape.isAntialiased = true
shape.setScale(CGFloat(0.8))
shape.strokeColor = .black
//shape.fillColor = .cyan
shape.yScale = -shape.yScale
shape.position = midPoint
effect.addChild(shape)
let blurFilter = CIFilter(name:"CIGaussianBlur",
withInputParameters: ["inputRadius": 1])
effect.filter = blurFilter
scene.addChild(effect)
scene.backgroundColor = .white
view.presentScene(scene)
PlaygroundSupport.PlaygroundPage.current.liveView = view
PlaygroundPage.current.needsIndefiniteExecution = true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment