Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Avoid desync between start and end (outer and inner) radial gradient circles #3112

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

geomaster
Copy link
Contributor

Due to the way _mdf (modified) flags are checked in SVGElementsRenderer.renderGradient(), it's possible that the fx and fy components of a radial gradient, defining its "inner" circle (used for highlights via .h and .a members of a gf shape element in the Lottie JSON), fall out of sync with cx and cy which define its outer circle.

In particular, the branch which sets fx/fy triggers only when the gradient end point changes, but then sets fx and fy based on a calculation that involves both the start and end points. Therefore, if the start point of a gradient ever changes without a corresponding change in the end point, the cx/cy value will be updated but not the fx/fy value, causing visual artifacts.

File exhibiting issue: radial-gradient-repro.json

Current rendering:
radial-gradient-repro-broken

After fix:
radial-gradient-repro-fixed

…ient circles

Due to the way `_mdf` (modified) flags are checked in
`SVGElementsRenderer.renderGradient()`, it's possible that the `fx` and
`fy` components of a radial gradient, defining its "inner" circle (used
for highlights via `.h` and `.a` members of a `gf` shape element in the
Lottie JSON), fall out of sync with `cx` and `cy` which define its outer
circle.

In particular, the branch which sets `fx`/`fy` triggers only when the
gradient end point changes, but then sets `fx` and `fy` based on a
calculation that involves both the start and end points. Therefore, if
the start point of a gradient ever changes without a corresponding
change in the end point, the `cx`/`cy` value will be updated but not
the `fx`/`fy` value, causing visual artifacts.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant