git ssb

0+

dinoworm 🐛 / solarpunk-icon



Commit 3bbf848a52801dc212408be047c6d41ea59e312e

beginnings of plants

Michael Williams committed on 2/6/2019, 11:00:46 AM
Parent: fc704a02d1ed48331ea440f2de8a5ec2def88696

Files changed

icon.svgchanged
index.jschanged
package.jsonchanged
icon.svg
icon.svg
index.jsView
@@ -6,15 +6,16 @@
66 xmlns="http://www.w3.org/2000/svg"
77 xmlns:xlink="http://www.w3.org/1999/xlink"
88 viewBox="-1 -1 2 2"
99 >
10- ${moons({ moonRadius: 0.1, centerRadius: 0.7 })}
11- ${gears({ centerRadius: 0.15, toothLength: 0.3, toothWidth: 0.2 })}
10 + ${plants({ size: 0.25, offsetRadius: 0.2 })}
11 + ${gear({ offsetRadius: 0.15, toothLength: 0.3, toothWidth: 0.2 })}
12 + ${moons({ moonRadius: 0.1, offsetRadius: 0.7 })}
1213 </svg>
1314 `
1415 }
1516
16-function gears ({ centerRadius, toothLength, toothWidth }) {
17 +function gear ({ offsetRadius, toothLength, toothWidth }) {
1718 return `
1819 <style type="text/css">
1920 .gear {
2021 stroke: black;
@@ -27,9 +28,9 @@
2728 <g class="gear">
2829 ${range({ start: 0, stop: 1, step: 1/8 })
2930 .map(index => gearTooth({
3031 angle: (1/16 + index) * 2 * Math.PI,
31- offset: centerRadius,
32 + offset: offsetRadius,
3233 length: toothLength,
3334 width: toothWidth
3435 }))
3536 .join('\n')
@@ -48,11 +49,64 @@
4849 </g>
4950 `
5051 }
5152
52-function moons ({ moonRadius, centerRadius }) {
53 +function plants ({ size, offsetRadius }) {
5354 return `
5455 <style type="text/css">
56 + .plant {
57 + stroke: black;
58 + stroke-width: ${size / 20};
59 + }
60 + .plant-stem {
61 + fill: none;
62 + }
63 + </style>
64 + ${range({ start: 0, stop: 1, step: 1/8 })
65 + .map(index => plant({
66 + size,
67 + angle: index * 2 * Math.PI,
68 + offsetRadius
69 + }))
70 + .join('\n')
71 + }
72 + `
73 +}
74 +
75 +function plant ({ size, angle, offsetRadius }) {
76 + return `
77 + <g
78 + class="plant"
79 + transform="
80 + rotate(${angle * 180 / Math.PI})
81 + translate(0, ${offsetRadius})
82 + "
83 + >
84 + <path class="plant-stem"
85 + d="
86 + M 0,0
87 + L 0,${size}
88 + "
89 + />
90 + <path class="plant-stem"
91 + d="
92 + M 0,${size * 0.9}
93 + C 0,${size * 0.8} 0,${size * 1.2} ${size * 0.3},${size * 1.4}
94 + "
95 + />
96 + <path class="plant-stem"
97 + d="
98 + M 0,${size * 0.9}
99 + C 0,${size * 0.8} 0,${size * 1.2} ${size * -0.3},${size * 1.4}
100 + "
101 + />
102 + </g>
103 + `
104 +}
105 +
106 +function moons ({ moonRadius, offsetRadius }) {
107 + return `
108 + <style type="text/css">
55109 .moon {
56110 stroke: black;
57111 stroke-width: ${moonRadius / 20};
58112 }
@@ -65,9 +119,9 @@
65119 </style>
66120 ${range({ start: 0, stop: 1, step: 1/8 })
67121 .map(index => moon({
68122 radius: moonRadius,
69- center: rotate({ angle: index * 2 * Math.PI, point: { x: 0, y: centerRadius } }),
123 + center: rotate({ angle: index * 2 * Math.PI, point: { x: 0, y: offsetRadius } }),
70124 phase: index
71125 }))
72126 .join('\n')
73127 }
package.jsonView
@@ -3,8 +3,9 @@
33 "version": "0.0.0",
44 "description": "a solarpunk icon generated from JavaScript code",
55 "main": "index.js",
66 "scripts": {
7 + "start": "node example > icon.svg",
78 "style:format": "prettier-standard '**/*.js' '**/*.md'",
89 "style:lint": "standard",
910 "style": "npm-run-all -s style:format style:lint",
1011 "test:deps": "dependency-check . && dependency-check . --extra --no-dev",

Built with git-ssb-web