{"id":5525,"date":"2017-12-04T17:46:55","date_gmt":"2017-12-04T08:46:55","guid":{"rendered":"https:\/\/gunmagisgeek.com\/wordpress\/?p=5525"},"modified":"2017-12-04T17:46:55","modified_gmt":"2017-12-04T08:46:55","slug":"d3%e3%81%a7%ef%bc%92%e7%82%b9%e9%96%93%e3%81%ae%e7%b7%af%e5%ba%a6%e7%b5%8c%e5%ba%a6%e3%82%92%e8%a3%9c%e5%ae%8c%e3%81%97%e3%82%a2%e3%83%8b%e3%83%a1%e3%83%bc%e3%82%b7%e3%83%a7%e3%83%b3%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/leaflet-js\/5525","title":{"rendered":"D3\u3067\uff12\u70b9\u9593\u306e\u7def\u5ea6\u7d4c\u5ea6\u3092\u88dc\u5b8c\u3057\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3059\u308b\u3002"},"content":{"rendered":"<p><a href=\"http:\/\/bl.ocks.org\/shimizu\/f3b13ab8b506d257f861875993b65371\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2017\/12\/interpolate-latitude-and-longitude-Bl.ock-Builder-2017-12-04-16-44-48.png\" alt=\"interpolate latitude and longitude - Bl.ock Builder 2017-12-04 16-44-48\" width=\"955\" height=\"496\" class=\"aligncenter size-full wp-image-5526 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2017\/12\/interpolate-latitude-and-longitude-Bl.ock-Builder-2017-12-04-16-44-48.png 955w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2017\/12\/interpolate-latitude-and-longitude-Bl.ock-Builder-2017-12-04-16-44-48-289x150.png 289w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2017\/12\/interpolate-latitude-and-longitude-Bl.ock-Builder-2017-12-04-16-44-48-768x399.png 768w\" sizes=\"auto, (max-width: 955px) 100vw, 955px\" \/><\/a><\/p>\n<p><a href=\"http:\/\/bl.ocks.org\/shimizu\/f3b13ab8b506d257f861875993b65371\">example<\/a><\/p>\n<p>d3.js\u3092\u7528\u3044\u3066\uff12\u70b9\u9593\u306e\u7def\u5ea6\u7d4c\u5ea6\u3092\u88dc\u5b8c\u3057\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u884c\u306a\u3063\u3066\u3044\u307e\u3059\u3002<br \/>\n\u753b\u9762\u4e0a\u306e\u5ea7\u6a19\u3067\u306f\u306a\u304f\u3001\u7def\u5ea6\u7d4c\u5ea6\u3092\u88dc\u5b8c\u3059\u308b\u3053\u3068\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u4e2d\u306b\u5730\u56f3\u3092\u79fb\u52d5\u30fb\u30d1\u30f3\uff0f\u30ba\u30fc\u30e0\u3057\u3066\u3082\u6b63\u3057\u304f\u79fb\u52d5\u3057\u307e\u3059\u3002<\/p>\n<p>\u5730\u56f3\u30e9\u30a4\u30d6\u30e9\u30ea\u306b\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u6a5f\u80fd\u304c\u5099\u308f\u3063\u3066\u3044\u306a\u3044\u5834\u5408\u3067\u3082D3\u3092\u4f7f\u3046\u3053\u3068\u3067\u30b9\u30e0\u30fc\u30ba\u306a\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3092\u5b9f\u88c5\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h2>\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n<pre class=\"lang:js decode:true \" >var soruce = {\n    lat:36.3219088,\n    lng:139.0032936,\n}\n\nvar target = {\n    lat:35.6811673,\n    lng:139.76705160000006, \n}\n\n\nfunction moveTween(soruce, target, duration, ease) {\n    if(!ease) ease = d3.easeLinear;\n    var scale = d3.scaleLinear().domain([0, duration]).range([0, 1]).clamp(true);\n\n    var interpolateLat = d3.interpolate(soruce.lat, target.lat);\n    var interpolateLng = d3.interpolate(soruce.lng, target.lng);\n\n\n    var t = d3.timer(function(elapsed) {\n        var c = ease(scale(elapsed));\n        var lat = interpolateLat(c);\n        var lng = interpolateLng(c);\n        \n        console.log(lat, lng);\n        \n        if (elapsed &gt; duration) t.stop();\n    }, 100);\n\n}<\/pre>\n<p>duration\u3068\u3057\u3066\u6307\u5b9a\u3055\u308c\u305f\u79d2\u6570\u30920\u301c1\u306e\u5024\u306b\u6b63\u898f\u5316(scaleLinear)\u3059\u308b\u30b9\u30b1\u30fc\u30eb\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001interplate\u30e1\u30bd\u30c3\u30c9\u3092\u4f7f\u3063\u3066\u3001soruce\u304b\u3089target\u307e\u3067\u306e\u7def\u5ea6\u7d4c\u5ea6\u3092\u88dc\u5b8c\u3059\u308b\u95a2\u6570\u3092\u4f5c\u6210\u3057\u3066\u3044\u307e\u3059\u3002<br \/>\nd3.timer\u306b\u6e21\u3055\u308c\u305f\u30b3\u30fc\u30eb\u30d0\u30c3\u30af\u306f\u5f15\u6570\u306b\u7d4c\u904e\u6642\u9593\u3092\u53d6\u308a\u307e\u3059\u3002\u53d6\u5f97\u3057\u305f\u7d4c\u904e\u6642\u9593\u3092\u6b63\u898f\u5316\u3057\u88dc\u5b8c\u95a2\u6570\u306b\u6e21\u3059\u3053\u3068\u3067\u7d4c\u904e\u3057\u305f\u6642\u9593\u3092\u3082\u3068\u306b\u88dc\u5b8c\u3057\u305f\u7def\u5ea6\u7d4c\u5ea6\u3092\u53d6\u5f97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br \/>\n\u307e\u305f\u3001\u6b63\u898f\u5316\u3057\u305f\u7d4c\u904e\u6642\u9593\u306b\u30a4\u30fc\u30b8\u30f3\u30b0\u30e1\u30bd\u30c3\u30c9\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001d3\u306e\u8c4a\u5bcc\u306a\u30a4\u30fc\u30b8\u30f3\u30b0\u6a5f\u80fd\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>moveTween\u3092\u5b9f\u884c\u3059\u308b\u3068\u88dc\u5b8c\u3057\u305f\u7def\u5ea6\u7d4c\u5ea6\u3092\u51fa\u529b\u3057\u307e\u3059\u3002<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2017\/12\/D3-ver.4-2017-12-04-17-16-50.png\" alt=\"\u7def\u5ea6\u7d4c\u5ea6\u306e\u88dc\u5b8c\" width=\"567\" height=\"869\" class=\"aligncenter size-full wp-image-5527 border\" srcset=\"https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2017\/12\/D3-ver.4-2017-12-04-17-16-50.png 567w, https:\/\/gunmagisgeek.com\/blog\/wp-content\/uploads\/2017\/12\/D3-ver.4-2017-12-04-17-16-50-98x150.png 98w\" sizes=\"auto, (max-width: 567px) 100vw, 567px\" \/><\/p>\n<h2>\u4f8b<\/h2>\n<p>\uff12\u70b9\u9593\u3092\uff11\u79d2\u304b\u3051\u3066\u79fb\u52d5\u3055\u305b\u308b\u5834\u5408\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u5b9f\u884c\u3057\u307e\u3059\u3002<\/p>\n<pre class=\"lang:js decode:true \" >moveTween(soruce, target, 1000);<\/pre>\n<p>d3\u306e\u30a4\u30fc\u30b8\u30f3\u30b0\u6a5f\u80fd\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u5730\u56f3\u4e0a\u3067\u3082\u7d30\u304b\u306a\u52d5\u304d\u3092\u518d\u73fe\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u4f8b:\u30d0\u30a6\u30f3\u30c9\u3059\u308b\u3088\u3046\u306a\u52d5\u304d\u3002<\/p>\n<pre class=\"lang:js decode:true \" >moveTween(soruce, target, 1000, d3.easeBounce);<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>example d3.js\u3092\u7528\u3044\u3066\uff12\u70b9\u9593\u306e\u7def\u5ea6\u7d4c\u5ea6&hellip;<\/p>\n","protected":false},"author":1,"featured_media":5527,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[69,55],"tags":[],"class_list":["post-5525","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-d3v4","category-leaflet-js","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/5525","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/comments?post=5525"}],"version-history":[{"count":0,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/5525\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/5527"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=5525"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=5525"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=5525"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}