mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-09 14:13:43 +00:00
loader/lottie: Add radial gradient support
This allows for the creation of basic radial gradients, without support for focal points.
This commit is contained in:
parent
d7c70c5371
commit
8f4f3d6f1b
2 changed files with 9 additions and 1 deletions
1
src/examples/images/waves.json
Normal file
1
src/examples/images/waves.json
Normal file
File diff suppressed because one or more lines are too long
|
@ -49,7 +49,14 @@ Fill* LottieGradient::fill(int32_t frameNo)
|
||||||
//Radial Gradient
|
//Radial Gradient
|
||||||
if (id == 2) {
|
if (id == 2) {
|
||||||
fill = RadialGradient::gen().release();
|
fill = RadialGradient::gen().release();
|
||||||
TVGLOG("LOTTIE", "TODO: Missing Radial Gradient!");
|
auto sx = start(frameNo).x;
|
||||||
|
auto sy = start(frameNo).y;
|
||||||
|
auto w = fabsf(end(frameNo).x - sx);
|
||||||
|
auto h = fabsf(end(frameNo).y - sy);
|
||||||
|
auto radius = (w > h) ? (w + 0.375f * h) : (h + 0.375f * w);
|
||||||
|
static_cast<RadialGradient*>(fill)->radial(sx, sy, radius);
|
||||||
|
|
||||||
|
//TODO: focal support?
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!fill) return nullptr;
|
if (!fill) return nullptr;
|
||||||
|
|
Loading…
Add table
Reference in a new issue