Skip to content
Browse files

fixed up path issue

  • Loading branch information...
1 parent 47ddf9a commit 080e3a73b84641ff6336408b567d0d306b0c6836 @markmarkoh committed Sep 11, 2012
Showing with 33 additions and 29 deletions.
  1. +33 −29 js/flat.js
View
62 js/flat.js
@@ -44,14 +44,16 @@
.append("svg:g")
.attr("id", "states");
- d3.json("/js/world-countries.json", function(json) {
+ d3.json("js/world-countries.json", function(json) {
g.selectAll("path")
.data(json.features)
.enter().append("svg:path")
.attr("d", path)
.style("fill", "#DDD")
.on("click", click);
+ startAnimation();
+
});
@@ -274,41 +276,43 @@ function colour(d, i) {
//houston
//hostCoords = {longitude: -95.22, latitude: 29.45};
- if (navigator.geolocation) {
-
- navigator.geolocation.getCurrentPosition(function(position) {
-
- console.log(position);
- target(position.coords);
+ function startAnimation() {
+ if (navigator.geolocation) {
- //save
- targetCoords = position.coords;
+ navigator.geolocation.getCurrentPosition(function(position) {
- window.setTimeout(function() {
-
- target(hostCoords, true);
+ console.log(position);
+ target(position.coords);
+ //save
+ targetCoords = position.coords;
window.setTimeout(function() {
- d3.selectAll("line")
- .transition()
- .duration(700)
- .attr("opacity", 0);
- window.setTimeout(function() {
- drawArc(hostCoords, targetCoords);
- drawArc(hostCoords, targetCoords, true);
- }, 1500);
- }, 6000);
+ target(hostCoords, true);
- },600);
- }, function(err) {
- alert('please share');
- });
- }
- else {
- console.log('hey');
+ window.setTimeout(function() {
+ d3.selectAll("line")
+ .transition()
+ .duration(700)
+ .attr("opacity", 0);
+
+ window.setTimeout(function() {
+ drawArc(hostCoords, targetCoords);
+ drawArc(hostCoords, targetCoords, true);
+ }, 1500);
+ }, 6000);
+
+ },600);
+
+ }, function(err) {
+ alert('please share');
+ });
+ }
+ else {
+ console.log('hey');
+ }
}
-})();
+})();

0 comments on commit 080e3a7

Please sign in to comment.
Something went wrong with that request. Please try again.