Created
December 15, 2020 21:56
-
-
Save anotherjesse/91e1cd26c924860dcfaa11fabc3533c4 to your computer and use it in GitHub Desktop.
rings and strings - glowforge + paperjs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| const inch = 72.0; | |
| const circle = ({x, y, radius, color}) => { | |
| const c = new Path.Circle(new Point(x, y), radius); | |
| c.strokeColor = color; | |
| return c | |
| } | |
| const outer = ({radius, center, points, extra, color}) => { | |
| circle({x: center.x, y: center.y, radius, color}) | |
| for (var i=0; i<points; i++) { | |
| var theta = 2*3.1415926*i/points | |
| circle({ | |
| x: center.x+(radius-0.125*inch)*Math.sin(theta), | |
| y: center.y+(radius-0.125*inch)*Math.cos(theta), | |
| radius: 0.03*inch, | |
| color: '#000000' | |
| }); | |
| if (i%extra == 0) { | |
| circle({ | |
| x: center.x+(radius-0.125*inch)*Math.sin(theta), | |
| y: center.y+(radius-0.125*inch)*Math.cos(theta), | |
| radius: 0.05*inch, | |
| color: '#00ff00' | |
| }); | |
| } | |
| } | |
| } | |
| const inner = ({radius, center, color}) => { | |
| circle({x: center.x, y: center.y, radius, color}) | |
| } | |
| const center = {x: 2.5*inch, y: 2.5*inch} | |
| outer({center, radius: 2.5*inch, points: 30, extra: 5, color: '#000099'}) | |
| outer({center, radius: 2.25*inch, points: 30, extra: 5, color: '#000088'}) | |
| outer({center, radius: 2*inch, points: 30, extra: 5, color: '#000077'}) | |
| outer({center, radius: 1.75*inch, points: 30, extra: 5, color: '#000066'}) | |
| outer({center, radius: 1.5*inch, points: 30, extra: 5, color: '#000055'}) | |
| outer({center, radius: 1.25*inch, points: 30, extra: 5, color: '#000044'}) | |
| outer({center, radius: 1*inch, points: 30, extra: 5, color: '#000033'}) | |
| outer({center, radius: 0.75*inch, points: 30, extra: 5, color: '#000022'}) | |
| circle({x: center.x, y: center.y, radius: 0.5*inch, color: '#000011'}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment