drawPlanets.frink

Download or view drawPlanets.frink in plain text format

// Draws all the planets and their sizes and phase angles for a moment in time.

use planets.frink
d=now[]

lat=40 deg North
long=105 deg West

// Uses the average colors from here:
// https://twitter.com/DonaldM38768041/status/1345288891801116672

colors = new dict[[["Mercury", makeColor[114, 102, 88]],
["Venus",   makeColor[239, 235, 223]],
["Earth",   makeColor[164, 159, 179]],
["Mars",    makeColor[136, 100, 68]],
["Jupiter", makeColor[195, 190, 171]],
["Saturn",  makeColor[201, 179, 142]],
["Uranus",  makeColor[168, 192, 194]],
["Neptune", makeColor[145, 175, 186]],
["Pluto",   makeColor[158, 147, 129]]]]


g=new graphics

y = 0 deg
x = 0 deg
spacing = 10 arcsec

for planet = Planet.planetsMinusEarth
{
   rad= Planet.Earth.radiusAngle[d, planet]
   // g.color[randomFloat[0,1], randomFloat[0,1], randomFloat[0,1]]
   g.color[colors@(planet.getName[])]
   if planet != Planet.Saturn
      g.add[planet.drawPolygonRelativeToZenith[d, lat, long, x, y + rad + spacing, rad, true]]
   else
      g.add[planet.drawSaturnRelativeToZenith[d, lat, long, x, y+rad+spacing, rad]]
   
   y = y + 2 rad + spacing
}

g.invertGrays[].show[]
g.invertGrays[].write["drawPlanets.png", 300, undef]

makeColor[r, g, b] := new color[r/255, g/255, b/255]


Download or view drawPlanets.frink in plain text format


This is a program written in the programming language Frink.
For more information, view the Frink Documentation or see More Sample Frink Programs.

Alan Eliasen was born 20217 days, 14 hours, 59 minutes ago.