move = function() {
let fromStation = pick(stations);
let toStation = pick(stations);
while (fromStation == toStation) {
fromStation = pick(stations);
toStation = pick(stations);
}
let distance = getDistance(
fromStation.x,
fromStation.y,
toStation.x,
toStation.y
);
let color = "white";
d3.select('#mainArea')
.append('circle')
.attr('cx', fromStation.x)
.attr('cy', fromStation.y)
.attr('r', 0)
.attr('fill', color)
.transition()
.duration(timing * .25)
.attr('r', 10)
.transition()
.duration(timing * .5)
.attr('cx', toStation.x)
.attr('cy', toStation.y)
.transition()
.duration(timing * .25)
.attr('r', 0)
.remove();
updateStations(fromStation, toStation);
d3.selectAll('.stations')
.transition()
.duration(1000)
.attr('fill', d => d3.interpolateViridis(scooterScale(d.scooters)));
return "moved 1 scooter from " + fromStation.name + " to " + toStation.name;
}