Created
January 21, 2020 05:10
-
-
Save garethpaul/7816c451e67bdd9a055907f4c993d980 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
// Setup a line animation for the power to run through e.g. like a strobe.. | |
var animationStep = 30; | |
function enableLineAnimation(layerId) { | |
var step = 0; | |
let dashArraySeq = [ | |
[0, 4, 3], | |
[1, 4, 2], | |
[2, 4, 1], | |
[3, 4, 0], | |
[0, 1, 3, 3], | |
[0, 2, 3, 2], | |
[0, 3, 3, 1] | |
]; | |
setInterval(() => { | |
step = (step + 1) % dashArraySeq.length; | |
map.setPaintProperty(layerId, 'line-dasharray', dashArraySeq[step]); | |
}, animationStep); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment