const START_DATE = '2018-05-24'; const TIME_STEP = 5 * 60; // secs const SatellitesView = Kapsule({ props: { satData: { default: [] }, onTimeChange: { default: () => {}} }, init(domNode, state) { const frameView = SatellitesFrame()(domNode); const timeStep = TIME_STEP * 1000; let time = new Date(START_DATE); const ticker = new FrameTicker.default(); ticker.onTick.add(() => { time = new Date(+time + timeStep); state.onTimeChange(time); frameView .satellites(getSatPositions(state.satData, time)) .time(time); }); // function getSatPositions(sats, posTime) { const gmst = satellite.gstime(posTime); // Get sidereal time return sats .map(sat => { // x,y,z position / velocity const location = satellite.propagate(sat.satrec, posTime); if (!location.position) return null; // can't compute satellite pos // lat, lng, height sat.coords = satellite.eciToGeodetic(location.position, gmst); return sat; }) .filter(d => d); // filter out nulls } }, update(state) {} });