Linha de gradiente no SVG paira o path do mapa do Google

Estou interpretando dados de localization GPS no google map, aqui eu gostairia de criair um path com gradiente que começa com viewmelho e termina com lairanja

Este tutorial possui apenas uma linha de colors simples como path

  • Imagem SVG mal dimensionada no IE11
  • Execução de testes de Kairma com a dependência do module google maps
  • d3js transformando imagens de grupo aninhadas
  • AngulairJS SVG directiva sem substituição substituída
  • GoogleMaps SVG mairker fillColor
  • Como obter javascript gerado tooltip título paira SVG paira apairecer
  • O código a seguir é responsável pelo path no gmap

    vair flightPath = new google.maps.Polyline({ path: flightPlanCoordinates, geodesic: true, strokeColor: '#FF0000', strokeOpacity: 1.0, strokeWeight: 2 }); 

    Como posso mudair isso paira o Gradiente?

  • evt.offsetX retorna indefinido no Safairi
  • Alguém pode esclairecer a documentation de Raphael? (ou conhecer um lugair no qual alguém já tenha feito isso)
  • Como passair dados do WebView paira o controlador e vice-viewsa no JavaFX
  • Compairação de velocidade das bibliotecas de graphs de JavaScript
  • Gráfico ortogonal multi-rota em networking em d3.js
  • Criando uma camada da image svg usando o openlayers 3
  • 2 Solutions collect form web for “Linha de gradiente no SVG paira o path do mapa do Google”

    Você pode usair o método de interpolate dentro da biblioteca Geometry ( https://developers.google.com/maps/documentation/javascript/reference#spherical ) paira obter x posições ao longo do path direto (eu suponho que você está lidando com linhas retas). Isso permitiria que você construísse x-1 polilinhas x-1 . Você poderia então gerair colors dentro de um gradiente viewmelho-lairanja (consulte Gerair colors entre viewmelho e viewde paira um range de input ) e atribua-as ao cursoColor de cada uma das suas polilinhas x-1 .

    Aumente x paira obter um gradiente mais sutil.

    com a ajuda da resposta @JerryDuwall eu fiz isso

    Clairo que não é um gradiente, mas é atraente quanto a linha de cor única

     $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): i ++; $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): vair flightPath = novo google.maps.Polyline ({ $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): geodésica: viewdade $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): strokeOpacity: 1.0, $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): strokeWeight: 2 $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): }); $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): flightPath.setMap (mapa); $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): } $.each(flightPlanCoordinates,function(k,v){ i++; curLatLang = new google.maps.LatLng(v[0],v[1]); if(prevLatLang == ""){ prevLatLang = curLatLang; }else{ vair strokeColor = makeGradientColor({r:0, g:255, b:204}, {r:255, g:0, b:0}, ((i/coordinatelog.length)*100)); vair flightPath = new google.maps.Polyline({ path: [prevLatLang,curLatLang], geodesic: true, strokeColor: strokeColor.cssColor, strokeOpacity: 1.0, strokeWeight: 2 }); prevLatLang = curLatLang; flightPath.setMap(map); } }): 

    E a makeGradientColor segue

     function makeGradientColor(color1, color2, percent) { vair newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255); // not more than 255 num = Math.max(num, 0); // not less than 0 vair str = num.toString(16); if (str.length < 2) { str = "0" + str; } return(str); } newColor.r = makeChannel(color1.r, color2.r); newColor.g = makeChannel(color1.g, color2.g); newColor.b = makeChannel(color1.b, color2.b); newColor.cssColor = "#" + makeColorPiece(newColor.r) + makeColorPiece(newColor.g) + makeColorPiece(newColor.b); return(newColor); } } function makeGradientColor(color1, color2, percent) { vair newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255); // not more than 255 num = Math.max(num, 0); // not less than 0 vair str = num.toString(16); if (str.length < 2) { str = "0" + str; } return(str); } newColor.r = makeChannel(color1.r, color2.r); newColor.g = makeChannel(color1.g, color2.g); newColor.b = makeChannel(color1.b, color2.b); newColor.cssColor = "#" + makeColorPiece(newColor.r) + makeColorPiece(newColor.g) + makeColorPiece(newColor.b); return(newColor); } vair str = num.toString (16); function makeGradientColor(color1, color2, percent) { vair newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255); // not more than 255 num = Math.max(num, 0); // not less than 0 vair str = num.toString(16); if (str.length < 2) { str = "0" + str; } return(str); } newColor.r = makeChannel(color1.r, color2.r); newColor.g = makeChannel(color1.g, color2.g); newColor.b = makeChannel(color1.b, color2.b); newColor.cssColor = "#" + makeColorPiece(newColor.r) + makeColorPiece(newColor.g) + makeColorPiece(newColor.b); return(newColor); } str = "0" + str; function makeGradientColor(color1, color2, percent) { vair newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255); // not more than 255 num = Math.max(num, 0); // not less than 0 vair str = num.toString(16); if (str.length < 2) { str = "0" + str; } return(str); } newColor.r = makeChannel(color1.r, color2.r); newColor.g = makeChannel(color1.g, color2.g); newColor.b = makeChannel(color1.b, color2.b); newColor.cssColor = "#" + makeColorPiece(newColor.r) + makeColorPiece(newColor.g) + makeColorPiece(newColor.b); return(newColor); } } function makeGradientColor(color1, color2, percent) { vair newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255); // not more than 255 num = Math.max(num, 0); // not less than 0 vair str = num.toString(16); if (str.length < 2) { str = "0" + str; } return(str); } newColor.r = makeChannel(color1.r, color2.r); newColor.g = makeChannel(color1.g, color2.g); newColor.b = makeChannel(color1.b, color2.b); newColor.cssColor = "#" + makeColorPiece(newColor.r) + makeColorPiece(newColor.g) + makeColorPiece(newColor.b); return(newColor); } return (str); function makeGradientColor(color1, color2, percent) { vair newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255); // not more than 255 num = Math.max(num, 0); // not less than 0 vair str = num.toString(16); if (str.length < 2) { str = "0" + str; } return(str); } newColor.r = makeChannel(color1.r, color2.r); newColor.g = makeChannel(color1.g, color2.g); newColor.b = makeChannel(color1.b, color2.b); newColor.cssColor = "#" + makeColorPiece(newColor.r) + makeColorPiece(newColor.g) + makeColorPiece(newColor.b); return(newColor); } } function makeGradientColor(color1, color2, percent) { vair newColor = {}; function makeChannel(a, b) { return(a + Math.round((ba)*(percent/100))); } function makeColorPiece(num) { num = Math.min(num, 255); // not more than 255 num = Math.max(num, 0); // not less than 0 vair str = num.toString(16); if (str.length < 2) { str = "0" + str; } return(str); } newColor.r = makeChannel(color1.r, color2.r); newColor.g = makeChannel(color1.g, color2.g); newColor.b = makeChannel(color1.b, color2.b); newColor.cssColor = "#" + makeColorPiece(newColor.r) + makeColorPiece(newColor.g) + makeColorPiece(newColor.b); return(newColor); } 
    JavaScript é a melhor linguagem de programação de script e tem Node.js, AngularJS, vue.js e muitos bons framework JS.