lottie/parser: support start and end opacity property in transform object.

the start and end opacity property only exists for repater's transform object.

Change-Id: I9bd7f59957ca4d90894bab5981c10c992508556c
This commit is contained in:
subhransu mohanty 2018-12-07 11:28:58 +09:00
parent d7ce9bab3c
commit b15ad1e093
3 changed files with 10 additions and 7 deletions

View File

@ -55,11 +55,6 @@ VMatrix LOTTransformData::matrix(int frameNo, bool autoOrient) const
return computeMatrix(frameNo, autoOrient);
}
float LOTTransformData::opacity(int frameNo) const
{
return mOpacity.value(frameNo) / 100.f;
}
void LOTTransformData::cacheMatrix()
{
mCachedMatrix = computeMatrix(0);

View File

@ -444,7 +444,9 @@ class LOTTransformData : public LOTData
public:
LOTTransformData():LOTData(LOTData::Type::Transform),mScale({100, 100}){}
VMatrix matrix(int frameNo, bool autoOrient = false) const;
float opacity(int frameNo) const;
float opacity(int frameNo) const { return mOpacity.value(frameNo)/100;}
float startOpacity(int frameNo) const { return mStartOpacity.value(frameNo)/100;}
float endOpacity(int frameNo) const { return mEndOpacity.value(frameNo)/100;}
void cacheMatrix();
bool staticMatrix() const {return mStaticMatrix;}
bool ddd() const {return m3D ? true : false;}
@ -461,6 +463,8 @@ public:
LOTAnimatable<float> mOpacity{100}; /* "o" */
LOTAnimatable<float> mSkew{0}; /* "sk" */
LOTAnimatable<float> mSkewAxis{0}; /* "sa" */
LOTAnimatable<float> mStartOpacity{100}; /* "so" */
LOTAnimatable<float> mEndOpacity{100}; /* "eo" */
bool mStaticMatrix{true};
bool mSeparate{false};
VMatrix mCachedMatrix;

View File

@ -1222,6 +1222,10 @@ std::shared_ptr<LOTTransformData> LottieParserImpl::parseTransformObject(bool dd
parseProperty(obj->mSkewAxis);
} else if (0 == strcmp(key, "o")) {
parseProperty(obj->mOpacity);
} else if (0 == strcmp(key, "so")) {
parseProperty(obj->mStartOpacity);
} else if (0 == strcmp(key, "eo")) {
parseProperty(obj->mEndOpacity);
} else if (0 == strcmp(key, "hd")) {
obj->mHidden = GetBool();
} else if (0 == strcmp(key, "rx")) {