Skip to content

fix: Use correct CSSDouble value for svg gradient interpolators#9012

Open
MatiPl01 wants to merge 4 commits intomainfrom
@matipl01/fix-svg-gradient-interpolator-configs
Open

fix: Use correct CSSDouble value for svg gradient interpolators#9012
MatiPl01 wants to merge 4 commits intomainfrom
@matipl01/fix-svg-gradient-interpolator-configs

Conversation

@MatiPl01
Copy link
Member

Summary

The old implementation used incorrect CSSLength and CSSKeyword types, which aren't valid as gradient-specific props are always numeric, even % should be convert to a number before being used. Since these values aren't px, we cannot use CSSLength and should treat % as normal double numbers, e.g. 50% -> 0.5 without interpolating them with parent's/component's dimensions taken into the consideration.

@MatiPl01 MatiPl01 self-assigned this Feb 25, 2026
keyframes: {
from: {
gradient: [
{ color: '#ff00cc', offset: '0%', opacity: 1 },
Copy link
Member Author

@MatiPl01 MatiPl01 Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I did some cleanup of unnecessary opacity values that only polluted examples.

Comment on lines -13 to -16
x1: true,
x2: true,
y1: true,
y2: true,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can simply convert all % to numbers instead of passing percentages, as percentages in C++ mean that we need a value relative to some dimensions of the current or the parent component.

@MatiPl01 MatiPl01 requested a review from wisniewskij February 25, 2026 20:39
Comment on lines +344 to +349
{"x1", value<CSSDouble>(0)},
{"x2", value<CSSDouble>(1)},
{"y1", value<CSSDouble>(0)},
{"y2", value<CSSDouble>(0)},
{"gradient", value<SVGStops>(SVGStops())},
{"gradientUnits", value<CSSIndex>(0)},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a harder case than we initially thought: xs and ys can be either relative or absolute depending on 'gradientUnits' value.

@wisniewskij
Copy link
Contributor

Also in the radial gradient examples there is still and example saying that you cannot interpolate between relative and absolute. We should look into that after we solve the rest of the issues.

@wisniewskij
Copy link
Contributor

Suddenly, the "Scanning beam" looks much different -- I might want to look into that later.

Base automatically changed from @matipl01/replace-svg-length-with-css-length to main February 27, 2026 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants