git ssb

0+

dinoworm 🐛 / solarpunk-icon



Commit cb5a52b55aa645ec97e69005be26cc9ecb027e87

test

Michael Williams committed on 2/7/2019, 8:21:48 PM
Parent: 029395cd787e08e84642683dd7e4b839cfb1a979

Files changed

index.jschanged
package.jsonchanged
package-lock.jsonadded
index.jsView
@@ -25,17 +25,17 @@
2525 fill: purple;
2626 }
2727 </style>
2828 <g class="gear">
29- ${range({ start: 0, stop: 1, step: 1/8 })
30- .map(index => gearTooth({
31- angle: (1/16 + index) * 2 * Math.PI,
32- offset: offsetRadius,
33- length: toothLength,
34- width: toothWidth
35- }))
36- .join('\n')
37- }
29 + ${range({ start: 0, stop: 1, step: 1 / 8 })
30 + .map(index => gearTooth({
31 + angle: (1 / 16 + index) * 2 * Math.PI,
32 + offset: offsetRadius,
33 + length: toothLength,
34 + width: toothWidth
35 + }))
36 + .join('\n')
37 +}
3838 </g>
3939 `
4040 }
4141
@@ -63,16 +63,16 @@
6363 .plant-leaf {
6464 fill: green;
6565 }
6666 </style>
67- ${range({ start: 0, stop: 1, step: 1/8 })
68- .map(index => plant({
69- size,
70- angle: index * 2 * Math.PI,
71- offsetRadius
72- }))
73- .join('\n')
74- }
67 + ${range({ start: 0, stop: 1, step: 1 / 8 })
68 + .map(index => plant({
69 + size,
70 + angle: index * 2 * Math.PI,
71 + offsetRadius
72 + }))
73 + .join('\n')
74 +}
7575 `
7676 }
7777
7878 function plant ({ size, angle, offsetRadius }) {
@@ -134,16 +134,16 @@
134134 .moon-back {
135135 fill: purple;
136136 }
137137 </style>
138- ${range({ start: 0, stop: 1, step: 1/8 })
139- .map(index => moon({
140- radius: moonRadius,
141- center: rotate({ angle: index * 2 * Math.PI, point: { x: 0, y: offsetRadius } }),
142- phase: index
143- }))
144- .join('\n')
145- }
138 + ${range({ start: 0, stop: 1, step: 1 / 8 })
139 + .map(index => moon({
140 + radius: moonRadius,
141 + center: rotate({ angle: index * 2 * Math.PI, point: { x: 0, y: offsetRadius } }),
142 + phase: index
143 + }))
144 + .join('\n')
145 +}
146146 `
147147 }
148148
149149 // inspired by https://github.com/tingletech/moon-phase
@@ -155,18 +155,18 @@
155155 // zero and one are both new moon; 0.50 is full moon
156156 if (phase <= 0.25) {
157157 sweep = [ 1, 0 ]
158158 mag = 1 - phase * 4
159- } else if (phase <= 0.50) {
159 + } else if (phase <= 0.50) {
160160 sweep = [ 0, 0 ]
161161 mag = (phase - 0.25) * 4
162162 } else if (phase <= 0.75) {
163163 sweep = [ 1, 1 ]
164164 mag = 1 - (phase - 0.50) * 4
165165 } else if (phase <= 1) {
166166 sweep = [ 0, 1 ]
167167 mag = (phase - 0.75) * 4
168- } else {
168 + } else {
169169 throw new Error(`unexpected moon phase: ${phase}`)
170170 }
171171
172172 // http://www.w3.org/TR/SVG/paths.html#PathDataEllipticalArcCommands
@@ -191,18 +191,17 @@
191191 </g>
192192 `
193193 }
194194
195-function rotate ({ center = { x: 0, y: 0}, angle, point }) {
195 +function rotate ({ center = { x: 0, y: 0 }, angle, point }) {
196196 const a = Math.atan2(point.y - center.y, point.x - center.x)
197197 const r = Math.sqrt(Math.pow(point.x - center.x, 2) + Math.pow(point.y - center.y, 2))
198198 return {
199199 x: r * Math.cos(a + angle),
200200 y: r * Math.sin(a + angle)
201201 }
202202 }
203203
204-
205204 // https://stackoverflow.com/a/44957114
206205 function range ({ start = 0, stop, step = 1 }) {
207206 return Array(Math.ceil((stop - start) / step))
208207 .fill(start).map((x, y) => x + y * step)
package.jsonView
@@ -27,10 +27,9 @@
2727 ]
2828 }
2929 },
3030 "standard": {
31- "globals": [
32- ]
31 + "globals": []
3332 },
3433 "repository": {
3534 "type": "git",
3635 "url": "git+https://github.com/ahdinosaur/solarpunk-icon.git"
package-lock.jsonView
The diff is too large to show. Use a local git client to view these changes.
Old file size: 0 bytes
New file size: 355228 bytes

Built with git-ssb-web