Google Chrome Browser
A Code Editor
- index.html setup basic html5 launcher page
- index.html import d3, topojson, and moment libraries
- index.html stub and link
./css/styles.css
- index.html stub and import
./js/meteorites.js
- styles.css set the background color
- world-50m.json save
world
data json file to./data/
directory as./data/world-50m.json
- meteorites.js add initial variables and script to render d3.geo.mercator map with land, projection, and graticule using the
world-50m.json
data file. - styles.css add styles for map
- meteorites.js d3.json(-->world) use d3 to load json formatted meteorite data from https://data.nasa.gov look at data
- meteorites.js d3.json(-->meteorites) create coordinates by filtering out data from
features
that do not havegeometry
look at data - meteorites.js d3.json(-->meteorites) filter coordinates further by only including geometry with
type
"Point"
look at data - meteorites.js d3.json(-->meteorites) generate formatted data needed by d3 in the format
{ date, lat, long }
from the filtered coordinates look at data - meteorites.js d3.json(-->meteorites) sort the resulting coordinate data by
year
inascending
order look at data - meteorites.js d3.json(-->meteorites) create then invoke a function named
showMeteorites()
that will add svg elements for each meteorite projected on the map - meteorites.js d3.json(-->meteorites) (above
showMeteorites()
) generate a new array of unique years from the years incoordinates
look at data - meteorites.js d3.json(-->meteorites)
- track the
curYearIdx
by setting it to0
- initialize
curYear
- (inside
showMeteorites()
) display curYear in theyearLabel
svg element
- track the
- meteorites.js d3.json(-->meteorites)
- initialize a new array named
coordsThisYear
- in the
showMeteorites()
function, setcoordsThisYear
to thecoordinates
that belong to the current year - then set the
fallingMeteorites
data tocoordsThisYear
- initialize a new array named
- meteorites.js showMeteorites()
- before
fallingMeteorites
, remove all previousstar-container
elements. - before the end of
showMeteorites()
conditionally incrementcurYearIdx
, looping through the years. - set
curYear
to the newcurYearIdx
. - add a
setTimeout
to invokeshowMetorites
again - (after the
showMeteorites()
function) replace the initial invocation with a1000
ms delay.
- before
- meteorites.js fallingMeteorites.enter() replace the white circle with a shape (svg
path
) of a falling meteorite from http://codepen.io/nakaz/pen/dMdPmZ - [meteorites.js fallingMeteorites.enter()] add a
star
class attribute to the new svg path- styles.css add styles and animation to the "falling star"
- styles.css style the
.year-label
text
add more animation delays in css (hint, nth-child(__)
)
display the names of each meteorite!
make each meteorite render a different size based on it's actual size