Skip to main content
Question

Error in importing SVG with gradient using the Plugin API


Hi

I have the following SVG that I am trying to import into Figma using the Plugin API figma.createNodeFromSvg().

<svg width="100%" height="100%" viewBox="0 0 30 31" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M21.6663 10.802L12.2212 20.247L7.5 15.5245" stroke="url(#paint0_linear_1066_80462)" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
<defs>
<linearGradient id="paint0_linear_1066_80462" x1="7.5" y1="14.928" x2="13.9761" y2="14.8028" gradientUnits="userSpaceOnUse">
<stop stop-color="#D6733A"/>
<stop offset="0.5" stop-color="#EDA043"/>
<stop offset="1" stop-color="#F5C145"/>
</linearGradient>
</defs>
</svg>

I get the following error on the Figma Developer Tools console while importing

figma_app.min.js.br:16 Uncaught Error: "failed to invert transform" in addGradientPaint (FGSvgParser.cpp)
    at _reportError (compiled_wasm.js.br:2:107233)
    at _Support_reportError (compiled_wasm.js.br:2:155044)
    at wasm-function[947] (compiled_wasm.wasm.br:0x1c399)
    at wasm-function[11533] (compiled_wasm.wasm.br:0x93f971)
    at wasm-function[11534] (compiled_wasm.wasm.br:0x940537)
    at wasm-function[3740] (compiled_wasm.wasm.br:0x20e91c)
    at wasm-function[4833] (compiled_wasm.wasm.br:0x3222bf)
    at wasm-function[5856] (compiled_wasm.wasm.br:0x404c19)
    at wasm-function[11525] (compiled_wasm.wasm.br:0x93c96b)
    at wasm-function[4833] (compiled_wasm.wasm.br:0x319f88)
    at wasm-function[2665] (compiled_wasm.wasm.br:0x11d97f)
    at wasm-function[27187] (compiled_wasm.wasm.br:0xddef07)
    at _PluginHelpers.createNodeFromSvgForPlugin (compiled_wasm.js.br:2:636242)
    at Number.cb (figma_app.min.js.br:1594:13008)
    at Number.<anonymous> (figma_app.min.js.br:1567:15668)
    at Number.<anonymous> (figma_app.min.js.br:1424:5300)
    at e.invokeCallback (figma_app.min.js.br:613:8620)
    at 70556 (jsvm-cpp.js.br:9:16134)
    at _emscripten_asm_const_int (jsvm-cpp.js.br:9:18079)
    at jsvm-cpp.wasm.br:0x59d8
    at jsvm-cpp.wasm.br:0x136e3
    at jsvm-cpp.wasm.br:0x152eb
    at jsvm-cpp.wasm.br:0x17216
    at jsvm-cpp.wasm.br:0x7b9d3
    at jsvm-cpp.wasm.br:0x137df
    at jsvm-cpp.wasm.br:0x152eb
    at jsvm-cpp.wasm.br:0x17216
    at jsvm-cpp.wasm.br:0x2a44c
    at jsvm-cpp.wasm.br:0x13819
    at jsvm-cpp.wasm.br:0x150d5
    at jsvm-cpp.wasm.br:0x1715e
    at jsvm-cpp.wasm.br:0x1709c
    at jsvm-cpp.wasm.br:0x1709c
    at jsvm-cpp.wasm.br:0x7b9d3
    at jsvm-cpp.wasm.br:0x137df
    at jsvm-cpp.wasm.br:0x152eb
    at jsvm-cpp.wasm.br:0x17216
    at jsvm-cpp.wasm.br:0x2a44c
    at jsvm-cpp.wasm.br:0x13819
    at jsvm-cpp.wasm.br:0x150d5
    at jsvm-cpp.wasm.br:0x1715e
    at jsvm-cpp.wasm.br:0x1709c
    at jsvm-cpp.wasm.br:0x1709c
    at jsvm-cpp.wasm.br:0x7b9d3
    at jsvm-cpp.wasm.br:0x137df
    at jsvm-cpp.wasm.br:0x152eb
    at jsvm-cpp.wasm.br:0x17216
    at jsvm-cpp.wasm.br:0x2a44c
    at jsvm-cpp.wasm.br:0x13819
    at jsvm-cpp.wasm.br:0x150d5
    at jsvm-cpp.wasm.br:0x1715e
    at jsvm-cpp.wasm.br:0x1709c
    at jsvm-cpp.wasm.br:0x1709c
    at jsvm-cpp.wasm.br:0x7b9d3
    at jsvm-cpp.wasm.br:0x137df
    at jsvm-cpp.wasm.br:0x152eb
    at jsvm-cpp.wasm.br:0x17216
    at jsvm-cpp.wasm.br:0x549a5
    at jsvm-cpp.wasm.br:0x6036
    at figma_app.min.js.br:613:8952

However, if I copy the SVG code and directly paste it into Figma, then it works fine. Can someone suggest what needs to be done to address this.

Regards
Vaibhav

This topic has been closed for replies.

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