Created
October 25, 2016 21:01
-
-
Save tmcw/96356e828157090ebd243f4e99f65356 to your computer and use it in GitHub Desktop.
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
function animate() { | |
var counter = Math.floor(100 * (Date.now() - start) / duration) | |
if (counter > 100) return; // the plane is done. | |
if (destination.length < 3) { | |
map.getSource('airplane').setData(empty); | |
return; | |
} | |
map.getSource('airplane').setData({ | |
type: 'Feature', | |
geometry: { | |
type: 'Point', | |
coordinates: singleArcCoords[counter] | |
} | |
}); | |
requestAnimationFrame(animate); | |
}; | |
var steps = 100; | |
var duration = 10000; // 10 seconds | |
var start = Date.now(); | |
animate(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment