I encountered an animation using images (I keep telling the artists it's a vector format but they don't listen) that didn't work in Samsung Lottie. The problem was that the asset size given in the JSON doesn't match the actual asset size and the code doesn't account for it. The fix is simple:
void renderer::ImageLayer::updateContent()
{
if (!mLayerData->asset()) return;
if (flag() & DirtyFlagBit::Matrix) {
mPath.reset();
mPath.addRect(VRectF(0, 0, mLayerData->asset()->mWidth,
mLayerData->asset()->mHeight));
mPath.transform(combinedMatrix());
mRenderNode.mFlag |= VDrawable::DirtyState::Path;
mRenderNode.mPath = mPath;
mTexture.mMatrix = combinedMatrix();
// Account for size difference between asset and bitmap
--> mTexture.mMatrix.scale( mLayerData->asset()->mWidth / (float)mLayerData->asset()->bitmap().width(), mLayerData->asset()->mHeight / (float)mLayerData->asset()->bitmap().height() );
}
if (flag() & DirtyFlagBit::Alpha) {
mTexture.mAlpha = int(combinedAlpha() * 255);
}
}
Sorry for not doing a pull request but I'm not set up for it at the moment and it's against my company's rules anyway.
I encountered an animation using images (I keep telling the artists it's a vector format but they don't listen) that didn't work in Samsung Lottie. The problem was that the asset size given in the JSON doesn't match the actual asset size and the code doesn't account for it. The fix is simple:
Sorry for not doing a pull request but I'm not set up for it at the moment and it's against my company's rules anyway.
Test case is attached. example.zip