Skip to main content
Solved

Dashed strokes

  • July 18, 2021
  • 1 reply
  • 787 views

Antoine_Zurcher

Hi,

I want to have dashed strokes around rectangles but I can’t find a way. I apparently cannot change stroke type from SOLID to DASH:

const outline = figma.createRectangle();
    outline.x = xmin - 3 - radius;
    outline.y = ymin - 3;
    outline.resize(xmax - xmin + 6 + radius, ymax - ymin + 6);
    outline.cornerRadius = 5;
    const fills_outline = clone(outline.fills);
    fills_outline[0].opacity = 0;
    outline.fills = fills_outline;
    const stroke_outline: SolidPaint = {
        type: "SOLID",
        color: red
    }
    outline.strokes = [stroke_outline];
    outline.strokeWeight = 2;
    outline.strokeAlign = "CENTER";

Thanks,
Antoine

Best answer by ntfromchicago

“DASH” does not exist. I think you want to set the dashPattern of the rectangle instead. Note this is a readonly array, so you’ll need to follow the instructions for editing properties. Hope that helps!

View original

ntfromchicago

“DASH” does not exist. I think you want to set the dashPattern of the rectangle instead. Note this is a readonly array, so you’ll need to follow the instructions for editing properties. Hope that helps!


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings