You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Radial gradient hightlight is supported in both iOS and web.
Describe the solution you'd like
Support highlight in Android.
Describe alternatives you've considered
Stacking arbitary number of circles and apply a mask. Not ideal.
Additional context
I have some suggestion on how to implement this on Android.
Concept
The image below is the concept of what 'hightlight' is in lottie. This feature is conventionally known as the focus or the focal point of a radial gradient instead. There are two parameters in lottie for this:
highlight length: a percentage of the distance between the gradient start and end
highlight angle: clockwise rotation about gradient start from the line joining the gradient start and end
Consider a point A lying on somewhere inside the circle defined by start and end in the lottie format. The colour stop at point A is the ratio of the distance between A and the focus to the project of A from the focal point to the circumference of the such circle. The figure below should give a good illustration, the ratio of $L:L'$ should be used to interpolate the colour at the location.
I created a sample kotlin project to show case the calculations shown above using min sdk 16 and java 17 like your repo setup.
For Android 12+, you can migrate your use of RadialGradient (here) to the new API and all will be fine.
For sdks below that, I created a custom BitmapShader to simulate the calculation and painted in onto a custom view on a JellyBean emulator. The goal is to show it can achieve the required render, so I did not optimise for performance. Below are some screenshots for your reference.
Android 4.2
Android 14
Housekeeping
both fill and stroke can use this feature. Your parser currently does not process those flags.
Is your feature request related to a problem? Please describe.
Radial gradient hightlight is supported in both iOS and web.
Describe the solution you'd like
Support highlight in Android.
Describe alternatives you've considered
Stacking arbitary number of circles and apply a mask. Not ideal.
Additional context
I have some suggestion on how to implement this on Android.
Concept
The image below is the concept of what 'hightlight' is in lottie. This feature is conventionally known as the
focus
or thefocal point
of a radial gradient instead. There are two parameters in lottie for this:highlight length
: a percentage of the distance between the gradient start and endhighlight angle
: clockwise rotation about gradient start from the line joining the gradient start and endConsider a point A lying on somewhere inside the circle defined by$L:L'$ should be used to interpolate the colour at the location.
start
andend
in the lottie format. The colour stop at point A is the ratio of the distance between A and the focus to the project of A from the focal point to the circumference of the such circle. The figure below should give a good illustration, the ratio ofImplementation suggestion
MyApplication.zip
I created a sample kotlin project to show case the calculations shown above using min sdk 16 and java 17 like your repo setup.
For Android 12+, you can migrate your use of RadialGradient (here) to the new API and all will be fine.
For sdks below that, I created a custom
BitmapShader
to simulate the calculation and painted in onto a custom view on a JellyBean emulator. The goal is to show it can achieve the required render, so I did not optimise for performance. Below are some screenshots for your reference.Android 4.2
Android 14
Housekeeping
The text was updated successfully, but these errors were encountered: