Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/Draw-a-sphere/Jq/draw-a-sphere-1.jq
Normal file
19
Task/Draw-a-sphere/Jq/draw-a-sphere-1.jq
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
def svg:
|
||||
"<svg width='100%' height='100%' version='1.1'
|
||||
xmlns='http://www.w3.org/2000/svg'
|
||||
xmlns:xlink='http://www.w3.org/1999/xlink'>" ;
|
||||
|
||||
# A radial gradient to make a circle look like a sphere.
|
||||
# "colors" should be [startColor, intermediateColor, endColor]
|
||||
# or null for ["white", "teal", "black"]
|
||||
def sphericalGradient(id; colors):
|
||||
"<defs>
|
||||
<radialGradient id = '\(id)' cx = '30%' cy = '30%' r = '100%' fx='10%' fy='10%' >
|
||||
<stop stop-color = '\(colors[0]//"white")' offset = '0%'/>
|
||||
<stop stop-color = '\(colors[1]//"teal")' offset = '50%'/>
|
||||
<stop stop-color = '\(colors[1]//"black")' offset = '100%'/>
|
||||
</radialGradient>
|
||||
</defs>" ;
|
||||
|
||||
def sphere(cx; cy; r; gradientId):
|
||||
"<circle fill='url(#\(gradientId))' cx='\(cx)' cy='\(cy)' r='\(r)' />" ;
|
||||
9
Task/Draw-a-sphere/Jq/draw-a-sphere-2.jq
Normal file
9
Task/Draw-a-sphere/Jq/draw-a-sphere-2.jq
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def draw_sphere:
|
||||
svg,
|
||||
"<title>Teal sphere</title>",
|
||||
sphericalGradient("tealGradient"; null), # define the gradient to use
|
||||
sphere(100;100;100; "tealGradient"), # draw a sphere using the gradient
|
||||
sphere(100;300;100; "tealGradient"), # draw another sphere using the same gradient
|
||||
"</svg>" ;
|
||||
|
||||
draw_sphere
|
||||
1
Task/Draw-a-sphere/Jq/draw-a-sphere-3.jq
Normal file
1
Task/Draw-a-sphere/Jq/draw-a-sphere-3.jq
Normal file
|
|
@ -0,0 +1 @@
|
|||
$ jq -r -n -f spheres.jq > spheres.svg
|
||||
Loading…
Add table
Add a link
Reference in a new issue