Q: Adding Linear Gradient to fill Path area
See original GitHub issueHi! I tried to implement LinearGradient to fill out all area under Path line.
Wanted to get something like this:
Do you know how it could be implemented with react-native-skia
LinearGradient component?
I can’t get the needed behaviour… 😦
Issue Analytics
- State:
- Created a year ago
- Comments:11 (1 by maintainers)
Top Results From Across the Web
Can I apply a gradient along an SVG path? - Stack Overflow
Another way is to make two half circles and apply the opposite linear gradient to each's stroke, and make sure they are both...
Read more >radial-gradient() - CSS: Cascading Style Sheets | MDN
A radial gradient is specified by indicating the center of the gradient (where the 0% ellipse will be) and the size and shape...
Read more >Create gradients in Illustrator - Adobe Support
Apply gradient on one object. Select the other objects that you want to fill with same gradient. To do this, click the Selection...
Read more >How To Apply SVG Linear Gradients To A Fill Or Stroke
SVG linear gradients are easy to work with and fun too. They can be added as the fill of an SVG graphic or...
Read more >How to: Paint an Area with a Linear Gradient - WPF .NET ...
To create a horizontal linear gradient, change the StartPoint and EndPoint of the LinearGradientBrush to (0,0.5) and (1,0.5). In the following ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
This was implemented in #41 and is available now in versions above
0.3.0
So Skia creates SVG path with commands the same way as you would create an SVG path manually with flags like
M 0 100 L 100,100 z
and etc. So here looking to your screenshot imagine the first and last point of your path and think how to make that path looped.Then in the render method, we add another Path with fill near our current Path with stroke
This is how I solved the issue, maybe @mrousavy has a better solution?