fix(paint): orient linear gradients to the css angle convention - #225
Merged
Merged
Conversation
LeadcodeDev
force-pushed
the
fix/spring-step-response
branch
from
September 21, 2026 23:39
4c92d97 to
42a83b8
Compare
LeadcodeDev
force-pushed
the
fix/gradient-angle
branch
from
September 21, 2026 23:39
5e08139 to
8294064
Compare
53 tasks
LeadcodeDev
force-pushed
the
fix/spring-step-response
branch
from
September 22, 2026 06:09
5a808bd to
d414df5
Compare
LeadcodeDev
force-pushed
the
fix/gradient-angle
branch
from
September 22, 2026 06:09
4878d51 to
126c5df
Compare
LeadcodeDev
force-pushed
the
fix/spring-step-response
branch
from
September 22, 2026 08:33
d414df5 to
bdc887f
Compare
LeadcodeDev
force-pushed
the
fix/gradient-angle
branch
from
September 22, 2026 08:33
126c5df to
0aeadf7
Compare
LeadcodeDev
force-pushed
the
fix/spring-step-response
branch
from
September 22, 2026 08:43
bdc887f to
1cde354
Compare
LeadcodeDev
force-pushed
the
fix/gradient-angle
branch
from
September 22, 2026 08:43
0aeadf7 to
bb3f26f
Compare
LeadcodeDev
changed the base branch from
fix/spring-step-response
to
chantier/audit-2026-09
September 22, 2026 08:52
LeadcodeDev
force-pushed
the
fix/gradient-angle
branch
from
September 22, 2026 08:58
bb3f26f to
de64f06
Compare
For `angle_deg = 180` (the default, CSS "to bottom"): rad = 0, sin_a = 0, cos_a = -1, so p0 = (cx, cy + h/2) = bottom edge and p1 = top edge. Skia places `colors[0]` at p0, so the first stop lands at the *bottom* where CSS puts it at the top. Same 180-degree offset at every angle (90 -> first stop on the right, CSS says left). The repo's own skill doc contradicts the rendered result: `.claude/skills/rustmotion/rules/glassmorphism.md:114` prescribes `"gradient-border": { "colors": ["#FFFFFF50", "#FFFFFF08"], "width": 1.5, "angle": 180 }` and describes it at line 118 as "la lumière qui accroche le haut de la carte" — but this function puts the bright stop at the bottom. `paint_gradient_border` (line 1375) shares the function, so both `background` gradients and `gradient-border` are affected. Note the engine also carries a second, incompatible convention for `Fill::Gradient` in rustmotion-components/src/shape.rs:78 (angle 0 = left-to-right, math convention).
Refs #220
LeadcodeDev
force-pushed
the
fix/gradient-angle
branch
from
September 22, 2026 09:04
de64f06 to
1fbf918
Compare
LeadcodeDev
added a commit
that referenced
this pull request
Sep 22, 2026
For `angle_deg = 180` (the default, CSS "to bottom"): rad = 0, sin_a = 0, cos_a = -1, so p0 = (cx, cy + h/2) = bottom edge and p1 = top edge. Skia places `colors[0]` at p0, so the first stop lands at the *bottom* where CSS puts it at the top. Same 180-degree offset at every angle (90 -> first stop on the right, CSS says left). The repo's own skill doc contradicts the rendered result: `.claude/skills/rustmotion/rules/glassmorphism.md:114` prescribes `"gradient-border": { "colors": ["#FFFFFF50", "#FFFFFF08"], "width": 1.5, "angle": 180 }` and describes it at line 118 as "la lumière qui accroche le haut de la carte" — but this function puts the bright stop at the bottom. `paint_gradient_border` (line 1375) shares the function, so both `background` gradients and `gradient-border` are affected. Note the engine also carries a second, incompatible convention for `Fill::Gradient` in rustmotion-components/src/shape.rs:78 (angle 0 = left-to-right, math convention).
Refs #220
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Severity Medium, category correctness. Location:
crates/rustmotion-core/src/engine/paint_pass.rs:1262Impact
For
angle_deg = 180(the default, CSS "to bottom"): rad = 0, sin_a = 0, cos_a = -1, so p0 = (cx, cy + h/2) = bottom edge and p1 = top edge. Skia placescolors[0]at p0, so the first stop lands at the bottom where CSS puts it at the top. Same 180-degree offset at every angle (90 -> first stop on the right, CSS says left). The repo's own skill doc contradicts the rendered result:.claude/skills/rustmotion/rules/glassmorphism.md:114prescribes"gradient-border": { "colors": ["#FFFFFF50", "#FFFFFF08"], "width": 1.5, "angle": 180 }and describes it at line 118 as "la lumière qui accroche le haut de la carte" — but this function puts the bright stop at the bottom.paint_gradient_border(line 1375) shares the function, so bothbackgroundgradients andgradient-borderare affected. Note the engine also carries a second, incompatible convention forFill::Gradientin rustmotion-components/src/shape.rs:78 (angle 0 = left-to-right, math convention).Fix
Drop the
- 180.0offset (uselet rad = angle_deg.to_radians();with the existing sign handling re-derived, or swap p0/p1) so thatangle: 180puts the first stop at the top, and add a pixel test assertinglinear-gradient(180deg, white, black)is white at the top. Decide whether shape.rs'sFill::Gradientshould be aligned onto the same convention.Evidence the audit read
Part of the September 2026 audit remediation chantier. Refs #220 (RM-10).