Skip to main content
Question

Calculate Gradient Transform for SVG linear gradient

  • October 18, 2022
  • 2 replies
  • 869 views

Brian_Alfaro1

Does anyone know how to calculate the x1 x2 y1 y2 of a svg from figma gradientTransform information.

Example

gradientTransform:[
   0:[
      0:-0.8554036021232605
      1:-0.6393925547599792
      2:1.231164574623108
   ],
   1:[
      0:0.9316599369049072
      1:-1.2464098930358887
      2:0.7044920921325684
   ]
]

How would it translate to a LinearGradient when I export the svg from figma it calculates it as this. Not sure how to get those values myself. Any help would be appreciated

<linearGradient x1="111.5" y1="105" x2="12.5" y2="31" />
This topic has been closed for comments

2 replies

BennoDev
  • 8 replies
  • June 23, 2023

Have you already figured it out?


BennoDev
  • 8 replies
  • July 12, 2023

this one worked for me 🙂

github.com

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