Z
Z
zlodiak2018-08-06 15:00:24
JavaScript
zlodiak, 2018-08-06 15:00:24

How to draw multiple stroke?

Please help me outline the area of ​​the polygon. The difficulty is that the stroke should consist of 3 parts: a thick red line and a thin white line on both sides of it.
JSFIDDLE
My attempt is here:

ymaps.ready(init);

var myMap,
    currCoords = [55.76, 37.64];
    
const polygonMocks = [
  [55.75, 37.50],
  [55.80, 37.60],
  [55.75, 37.70],
  [55.70, 37.70],
  [55.70, 37.50]
]; 

function init(){     
    myMap = new ymaps.Map("map", {
        center: currCoords,
        zoom: 18
    });
    
    const p =  new ymaps.Polygon([polygonMocks], {
      hintContent: "Многоугольник"
    }, {
      fill: false,
      strokeColor: ['#fff', '#f00', '#fff'],
      strokeWidth: [2, 10, 2],
      outline: true
    });    
    
    myMap.geoObjects.add(p);
};

Answer the question

In order to leave comments, you need to log in

1 answer(s)
0
0xD34F, 2018-08-06
@zlodiak

thick red line and on both sides of it along a thin white line

In reality, these will be two lines - a thick white one, and a thinner red one, lying in the middle of the white one. Like so .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question