Skip to content

Commit

Permalink
add hour marker
Browse files Browse the repository at this point in the history
  • Loading branch information
nate-parrott committed Dec 7, 2017
1 parent dab2fcd commit c5b3fac
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 2 deletions.
14 changes: 14 additions & 0 deletions OneHour.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions OneHourWithoutLabel.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added assets.sketch
Binary file not shown.
13 changes: 11 additions & 2 deletions map.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,15 @@ svg.call(zoom);

let maxTravelTime = 70 * 60;

let hourLine = container.append("circle").attr("class", "hour").attr("cx", width/2).attr("cy", height/2).attr('r', 60*60/maxTravelTime * 250) // .attr('opacity', 0);
//let hourLine = container.append("circle").attr("class", "hour").attr("cx", width/2).attr("cy", height/2).attr('r', 60*60/maxTravelTime * 250) // .attr('opacity', 0);
let hourLineSvgSize = 60 * 60 / maxTravelTime * width;

let createHourCircle= (href) => {
return container.append("image").attr("xlink:href", href).attr("x", (width - hourLineSvgSize) / 2).attr("y", (height - hourLineSvgSize) / 2).attr("width", hourLineSvgSize).attr("height", hourLineSvgSize);
}

let hourCircleBlank = createHourCircle('OneHourWithoutLabel.svg');
let hourCircle = createHourCircle('OneHour.svg').attr('opacity', 0);

let {stations, lines} = subway;

Expand Down Expand Up @@ -108,7 +116,8 @@ let setStationPositions = (stationPositions) => {

let updateMap = (homeStationId, schedule) => {
if (homeStationId) {
hourLine.transition().attr('opacity', 1);
hourCircleBlank.transition().attr('opacity', 0);
hourCircle.transition().attr('opacity', 1);
document.getElementById('initial').style.display = 'none';
document.getElementById('explanation').style.display = 'block';
}
Expand Down

0 comments on commit c5b3fac

Please sign in to comment.