In principle, it looks right to me. However, if this is your code verbatim, you immediately overwrite the color. Therefore, I assume that you get the blue polyline from the very beginning. Try setting a timer to see the transition:
setTimeout(function () {
myRoutePath.setOptions({strokeColor: 'blue'});
}, 3000);
source
share