lottie: handle trim path edge cases

According to the definition of trim path elements,
the begin and end values are specified as percentages
in the range of 0-100% (this is also confirmed by AE,
where it's not possible to exceed this range).
Added clamping to align with spec.
This commit is contained in:
Mira Grudzinska 2024-08-28 16:47:57 +02:00 committed by Hermet Park
parent dc386ba280
commit bd87d136a5

View file

@ -141,7 +141,9 @@ void LottieImage::prepare()
void LottieTrimpath::segment(float frameNo, float& start, float& end, LottieExpressions* exps)
{
start = this->start(frameNo, exps) * 0.01f;
mathClamp(start, 0.0f, 1.0f);
end = this->end(frameNo, exps) * 0.01f;
mathClamp(end, 0.0f, 1.0f);
auto o = fmodf(this->offset(frameNo, exps), 360.0f) / 360.0f; //0 ~ 1