Last active
October 1, 2018 19:46
-
-
Save brunovcosta/b20a641999c8fc5e2f6ae1ec5fb9ac34 to your computer and use it in GitHub Desktop.
to be used in https://brunovcosta.github.io/explainer/
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
g9 { | |
r: 200 | |
t: 10, | |
p: 10, | |
},(d,c)-> | |
points = 20 | |
sphere = (x,y)-> | |
[d.r*Math.cos(d.p+x*2*Math.PI/points)*Math.sin(y*Math.PI/points), | |
d.r*Math.sin(d.p+x*2*Math.PI/points)*Math.sin(y*Math.PI/points), | |
d.r*Math.cos(y*Math.PI/points)] | |
for x in [0..points] | |
for y in [0..points] | |
c.point sphere(x,y)[0],sphere(x,y)[2],{'r': (1-0.5*sphere(x,y)[1]/d.r)*5, fill: "hsl("+(50*(1+0.5*sphere(x,y)[1]/d.r))+", 100%, "+(50*(1+0.5*sphere(x,y)[1]/d.r))+"%)"} | |
c.line sphere(x,y)[0],sphere(x,y)[2],sphere(x+1,y)[0],sphere(x+1,y)[2], 'stroke-width': 0.1 | |
c.line sphere(x,y)[0],sphere(x,y)[2],sphere(x,y+1)[0],sphere(x,y+1)[2], 'stroke-width': 0.1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment