Skip to content

Gradient angle not correct #294

@jonbrooks

Description

@jonbrooks

We are seeing linear gradients with 90 degree angles being exported as gradients with 133 degree angle instead:

The gradient according to Figma is:
Screenshot 2023-11-29 at 11 42 15 AM

and the css according to Figma shows 90 degrees:
Screenshot 2023-11-29 at 11 46 40 AM

But the exported json is:

      "violet": {
        "description": "my gradient",
        "type": "custom-gradient",
        "value": {
          "gradientType": "linear",
          "rotation": 133.3367478296384,
          "stops": [
            {
              "position": 0,
              "color": "#000000ff"
            },
            {
              "position": 1,
              "color": "#ffffffff"
            }
          ]
        }
      },

In this code we see 315 is being added to the result (and this is not part of the linked SO thread on calculating the rotation). Removing this addition of 315 results in the correct result of 90 degrees for the exported angle. Is there a reason 315 is being added here?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions