Created
May 5, 2020 02:34
-
-
Save hkitago/6794301ccde2ffeb719d9479045b1999 to your computer and use it in GitHub Desktop.
Setting array between two coords. https://github.com/duncancumming/maps/blob/master/animatedPaths/1.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const posFrom = { 'lat': 35.799465, 'lng': 138.356991 } | |
const posTo = { 'lat': 35.801618, 'lng': 138.355843 } | |
const frame = 110 | |
let pathCoords = [] | |
for(let i = 0; i < frame; i++) { | |
pathCoords.push({ 'lat': (posFrom.lat + ((posTo.lat - posFrom.lat) / frame) * i) | |
, 'lng': (posFrom.lng + ((posTo.lng - posFrom.lng) / frame) * i) }) | |
} | |
/* | |
for (let i = 0; i < pathCoords.length; i++) { | |
setTimeout((pathCoords) => { | |
moveMarker(map, marker, pathCoords.lat, pathCoords.lng) | |
}, frame * i, pathCoords[i]) | |
} | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment