const Night = Kapsule({ props: { time: { default: new Date() } }, stateInit: () => ({ halfGlobe: d3.geoCircle() .radius(90), geoPath: d3.geoPath() }), init(svg, state, projection) { state.geoPath.projection(projection); state.nightPath = svg.append('path') .attr('class', 'geo night'); }, update(state) { state.nightPath.attr('d', state.geoPath( state.halfGlobe.center(antipode(solarPosition(state.time)))() )); } });