{"id":7551,"date":"2021-12-13T08:21:45","date_gmt":"2021-12-12T23:21:45","guid":{"rendered":"https:\/\/gunmagisgeek.com\/blog\/?p=7551"},"modified":"2021-12-13T08:21:47","modified_gmt":"2021-12-12T23:21:47","slug":"deck-gl%e3%81%a7%e3%82%ab%e3%83%a1%e3%83%a9%e7%a7%bb%e5%8b%95%e3%82%92%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%e3%80%82","status":"publish","type":"post","link":"https:\/\/gunmagisgeek.com\/blog\/deck-gl\/7551","title":{"rendered":"deck.gl\u3067\u30ab\u30e1\u30e9\u79fb\u52d5\u3092\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3059\u308b\u3002"},"content":{"rendered":"\n<p>\u3053\u306e\u8a18\u4e8b\u306f<a href=\"https:\/\/qiita.com\/advent-calendar\/2021\/deckgl\">deck.gl Advent Calendar 2021&nbsp;<\/a>\u53c2\u52a0\u8a18\u4e8b\u3067\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u6982\u8981<\/h2>\n\n\n\n<p>deck.gl\u3067\u306f\u3001viewState\u3092\u5909\u66f4\u3059\u308b\u3053\u3068\u3067\u5730\u56f3\u4e0a\u306e\u8868\u793a\u9818\u57df\u3092\u5909\u66f4\u3067\u304d\u307e\u3059\u3002\u66f4\u65b0\u3059\u308bviewState\u306b\u30c8\u30e9\u30f3\u30b8\u30b7\u30e7\u30f3\u306e\u8a2d\u5b9a\u3092\u884c\u3046\u3053\u3068\u3067\u3001\u3042\u308b\u5730\u70b9\u304b\u3089\u3042\u308b\u5730\u70b9\u3078\u306e\u79fb\u52d5\u3092\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3057\u3066\u63cf\u753b\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">\u30b5\u30f3\u30d7\u30eb\u30b3\u30fc\u30c9<\/h2>\n\n\n\n<iframe src=\"https:\/\/codesandbox.io\/embed\/kamerayi-dong-woanimesiyonsaseru-507j9?fontsize=14&amp;hidenavigation=1&amp;theme=dark&amp;view=split\" style=\"width:100%; height:500px; border:0; border-radius: 4px; overflow:hidden;\" title=\"\u30ab\u30e1\u30e9\u79fb\u52d5\u3092\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3055\u305b\u308b\" allow=\"accelerometer; ambient-light-sensor; camera; encrypted-media; geolocation; gyroscope; hid; microphone; midi; payment; usb; vr; xr-spatial-tracking\" sandbox=\"allow-forms allow-modals allow-popups allow-presentation allow-same-origin allow-scripts\"><\/iframe>\n\n\n\n<h2 class=\"wp-block-heading\">\u89e3\u8aac<\/h2>\n\n\n\n<p>viewState(\u30ab\u30e1\u30e9\u8a2d\u5b9a)\u306e\u66f4\u65b0\u3092\u884c\u3046\u969b\u306b\u3001\u65b0\u898f\u306eviewState\u306btransitionDuration\u30d7\u30ed\u30d1\u30c6\u30a3\u3092\u542b\u3081\u3066\u66f4\u65b0\u3059\u308b\u3068\u73fe\u5728\u8a2d\u5b9a\u3055\u308c\u3066\u3044\u308b\u5024\u3068\u66f4\u65b0\u3055\u308c\u308bviewState\u306e\u5024\u306e\u9593\u3092\u5024\u3092\u88dc\u5b8c\u3057\u3066\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u884c\u308f\u308c\u307e\u3059\u3002\u307e\u305f\u3001transitionInterpolator\u30d7\u30ed\u30d1\u30c6\u30a3\u3067\u30a4\u30fc\u30b8\u30f3\u30b0\u306e\u7a2e\u985e\u3092\u8a2d\u5b9a\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u3053\u3053\u3067\u306f\u3001FlyToInterpolator\u95a2\u6570\u3092\u4f7f\u3063\u3066 &#8220;Fly To&#8221;\u30b9\u30bf\u30a4\u30eb\uff08\u73fe\u5728\u4f4d\u7f6e\u304b\u3089\u4e00\u65e6\u30d1\u30f3\u3057\u3066\u79fb\u52d5\u3057\u76ee\u7684\u5730\u306b\u30ba\u30fc\u30e0\u3059\u308b\uff09\u306e\u30a4\u30fc\u30b8\u30f3\u30b0\u3092\u6307\u5b9a\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<div class=\"wp-block-urvanov-syntax-highlighter-code-block\"><pre class=\"lang:js decode:true \">\/\/FlyToInterpolator\u95a2\u6570\u306e\u8aad\u307f\u8fbc\u307f\nimport DeckGL, { FlyToInterpolator } from \"deck.gl\";\n\n\n\/\/\u79fb\u52d5\u5148\u306e\u7def\u5ea6\u7d4c\u5ea6\u3068\u30ba\u30fc\u30e0\u30ec\u30d9\u30eb\nconst latlng = {\n    japan: {\n        longitude: 138.7186086,\n        latitude: 35.3606422,\n        zoom: 8\n    },\n    america: {\n        longitude: -113.7784322,\n        latitude: 36.2377383,\n        zoom: 8\n    }\n};\n\n\n\n\/\/\u30dc\u30bf\u30f3\u30af\u30ea\u30c3\u30af\u6642\u306bviewState\u3092\u66f4\u65b0\u3059\u308b\nconst btnHandler = (e) =&gt; {\n    \/\/\u3069\u3061\u3089\u306e\u30dc\u30bf\u30f3\u304c\u62bc\u3055\u308c\u305f\u304b\u5224\u5225\u3059\u308b\n    const country = e.target.dataset.country;\n    \/\/\u79fb\u52d5\u5148\u306e\u7def\u5ea6\u7d4c\u5ea6\u3092\u542b\u3081\u3066viewState\u3092\u66f4\u65b0\u3059\u308b\n    setViewState((v) =&gt; {\n        return {\n            ...v, \/\/current viewState\n            ...latlng[country], \/\/\u79fb\u52d5\u5148\u306e\u7def\u5ea6\u7d4c\u5ea6\u3068\u30ba\u30fc\u30e0\u30ec\u30d9\u30eb\u3092viewState\u306b\u53cd\u6620\u3059\u308b\n            transitionDuration: 2000, \/\/\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u79d2\u6570\u3092\u8a2d\u5b9a\u3059\u308b\n            transitionInterpolator: new FlyToInterpolator() \/\/ \u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u306e\u30b9\u30bf\u30a4\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\n        };\n    });\n};\n\nreturn (\n    &lt;&gt;\n      &lt;div className=\"button-wrapper\"&gt;\n        &lt;button onClick={btnHandler} data-country=\"japan\"&gt;\n          \u65e5\u672c\n        &lt;\/button&gt;\n        &lt;button onClick={btnHandler} data-country=\"america\"&gt;\n          \u30a2\u30e1\u30ea\u30ab\n        &lt;\/button&gt;\n      &lt;\/div&gt;\n      &lt;DeckGL\/&gt;\n    &lt;\/&gt;\n)<\/pre><\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u3053\u306e\u8a18\u4e8b\u306fdeck.gl Advent Calen&hellip;<\/p>\n","protected":false},"author":1,"featured_media":7555,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[73],"tags":[],"class_list":["post-7551","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-deck-gl","has-post-thumbnail-archive"],"_links":{"self":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7551","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=7551"}],"version-history":[{"count":6,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7551\/revisions"}],"predecessor-version":[{"id":7816,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/posts\/7551\/revisions\/7816"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media\/7555"}],"wp:attachment":[{"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/media?parent=7551"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/categories?post=7551"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/gunmagisgeek.com\/blog\/wp-json\/wp\/v2\/tags?post=7551"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}