Fixed an issue where the interpolation property did not work for the animation element when using Lottie animation files

This commit is contained in:
Leon Styhre 2023-09-28 18:38:11 +02:00
parent 7d32aac99d
commit c988170641

View file

@ -343,6 +343,22 @@ void LottieAnimComponent::applyTheme(const std::shared_ptr<ThemeData>& theme,
mIterationCount *= 2; mIterationCount *= 2;
} }
if (elem->has("interpolation")) {
const std::string& interpolation {elem->get<std::string>("interpolation")};
if (interpolation == "linear") {
mTexture->setLinearMagnify(true);
}
else if (interpolation == "nearest") {
mTexture->setLinearMagnify(false);
}
else {
mTexture->setLinearMagnify(false);
LOG(LogWarning) << "LottieAnimComponent: Invalid theme configuration, property "
"\"interpolation\" for element \""
<< element.substr(10) << "\" defined as \"" << interpolation << "\"";
}
}
if (elem->has("cornerRadius")) if (elem->has("cornerRadius"))
mCornerRadius = mCornerRadius =
glm::clamp(elem->get<float>("cornerRadius"), 0.0f, 0.5f) * mRenderer->getScreenWidth(); glm::clamp(elem->get<float>("cornerRadius"), 0.0f, 0.5f) * mRenderer->getScreenWidth();