Last active
January 25, 2018 08:32
-
-
Save aindong/584a156c3a4c2b566e1f2b160b9a6957 to your computer and use it in GitHub Desktop.
Google Map Polyline animation
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
let gpsPath = [] | |
let step = 0 | |
let stepIncrement = 1 | |
let numSteps = locations.length - 1 | |
let timePerStep = 300 | |
let interval = setInterval(() => { | |
step += stepIncrement | |
if (step >= numSteps) { | |
clearInterval(interval) | |
} else { | |
let latLng = { | |
lat: locations[step].lat, | |
lng: locations[step].lng | |
} | |
gpsPath.push(latLng) | |
center = latLng | |
} | |
}, timePerStep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment