Open tjmusser opened 3 years ago
Hi and thanks for the reproducible example. I looked at this when you first posted it, but my work did not fully cover a solution at the time.
This will have to be on hold from my side until I get more time to look into this.
I've worked on this, to and from, a couple of times since this issue originally popped up. Most recently I also used ChatGPT as well as finding more recent discussions around the gradient handle positions and gradients overall, out on the internet. Even with intense prompting and chaining, I can't get ChatGPT to figure out what's going on, either.
Some things seem pretty simple to understand, such as how color positions work in strictly straight lines (0, 90 degrees etc.) but I can't seem to figure out the math when the handles are originating from outside a frame or having angles similar to what you've shown in your demo use case.
There is no obvious way that the Figma-provided output (in the Dev Mode, for example) is calculated, at least to my degree of competence.
With all that said, it seems the angle calculation is improved in this recent commit https://github.com/mikaelvesavuori/figmagic/commit/a97db337680a45eee4fc7ecbc4b57d619fae3a08
Describe the bug There's difference in the gradient that Figma outputs and the one that figmagic returns. Both in the
angle
of the gradient, and in thecolor stops
.You can see an example of this in the code pen I created.
https://codepen.io/tmusser-illumina/pen/jOBJdGb
Figma value
linear-gradient(61.68deg, #0045E6 -4.27%, #FDDD33 116.09%)
Figmagic value
linear-gradient(8.62deg, rgba(0, 69, 230, 1) 10%, rgba(253, 221, 51, 1) 100%)
To Reproduce Steps to reproduce the behavior:
Expected behavior I would expect the same gradient settings between Figma and Figmagic
Gradient angle in Figma
Additional context RGBA colors/values are fine.
Json from Files API for gradient in question
My FIgmagic settings