Closed ricokahler closed 4 years ago
I just noticed my branch includes some isValidColor
stuff. I don't know how that got in there but ignore it in the diff for now.
Merging #523 into version-4-0-release will decrease coverage by
0.94%
. The diff coverage is89.65%
.
@@ Coverage Diff @@
## version-4-0-release #523 +/- ##
=======================================================
- Coverage 99.88% 98.94% -0.95%
=======================================================
Files 87 91 +4
Lines 857 944 +87
Branches 325 344 +19
=======================================================
+ Hits 856 934 +78
- Misses 1 6 +5
- Partials 0 4 +4
Flag | Coverage Δ | |
---|---|---|
#unittests | 98.94% <89.65%> (-0.95%) |
:arrow_down: |
Impacted Files | Coverage Δ | |
---|---|---|
src/internalHelpers/_parseTimingFunction.js | 57.89% <57.89%> (ø) |
|
src/color/getScale.js | 94.44% <94.44%> (ø) |
|
src/color/isValidColor.js | 100.00% <100.00%> (ø) |
|
src/internalHelpers/_normalizeColorStopArray.js | 100.00% <100.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update 4024710...b578950. Read the comment docs.
So I've sat on this for a while and I just don't like this approach. Since there's no easy way to create a timing function, I would advise to not ship eased gradients in v4.
This PR is still a work in progress but I wanted to pause here for feedback. For the most part, this PR is as planned from #441 but instead of changing the cubic bezier functions to number array's, I opted to parse them via regex since that's how colors are read anyway.
Currently, this PR just adds a few functions that will eventually power eased gradients. The main one is
getScale
which will eventually be imported in linearGradient and radialGradient to enable eased gradients via the color stop array (with no breaking API change).getScale
accepts color stops with timing functions in between them. Refer to the tests for usage.TODO:
linearGradient
andradialGradient
PolishedError
with new error messages added to the docs.mix
doesn't mix transparent and non-transparent colors. This restriction should be removed if we want to ease black with transparentScreenshots (for
getScale
)Here's one with an eased gradient 👇
Anyway, at this point I think you can see where I'm going with this, and to be honest, I'm not sure I like these changes. It's a lot of code for a relatively niche feature and I'm wondering if you can think of a more simple way to get this done.
Let me know what you think!
cc @bhough