diff --git a/src/loaders/lottie/tvgLottieBuilder.cpp b/src/loaders/lottie/tvgLottieBuilder.cpp index 3f47099b..4ab6adef 100644 --- a/src/loaders/lottie/tvgLottieBuilder.cpp +++ b/src/loaders/lottie/tvgLottieBuilder.cpp @@ -980,7 +980,7 @@ void LottieBuilder::updateText(LottieLayer* layer, float frameNo) { auto text = static_cast(layer->children.first()); auto textGrouping = text->alignOption.grouping; - auto& doc = text->doc(frameNo); + auto& doc = text->doc(frameNo, exps); auto p = doc.text; if (!p || !text->font) return; diff --git a/src/loaders/lottie/tvgLottieProperty.h b/src/loaders/lottie/tvgLottieProperty.h index c3fb1b35..27c172a5 100644 --- a/src/loaders/lottie/tvgLottieProperty.h +++ b/src/loaders/lottie/tvgLottieProperty.h @@ -325,8 +325,15 @@ struct LottieGenericProperty : LottieProperty return (*frames)[frames->count]; } - Value operator()(float frameNo) + Value operator()(float frameNo, LottieExpressions* exps = nullptr) { + //overriding with expressions + if (exps && exp) { + Value out{}; + frameNo = _loop(frames, frameNo, exp); + if (exps->result>(frameNo, out, exp)) return out; + } + if (!frames) return value; if (frames->count == 1 || frameNo <= frames->first().no) return frames->first().value; if (frameNo >= frames->last().no) return frames->last().value; @@ -336,16 +343,6 @@ struct LottieGenericProperty : LottieProperty return frame->interpolate(frame + 1, frameNo); } - Value operator()(float frameNo, LottieExpressions* exps) - { - if (exps && exp) { - Value out{}; - frameNo = _loop(frames, frameNo, exp); - if (exps->result>(frameNo, out, exp)) return out; - } - return operator()(frameNo); - } - void copy(const LottieGenericProperty& rhs, bool shallow = true) { if (rhs.frames) { @@ -448,8 +445,14 @@ struct LottiePathSet : LottieProperty return (*frames)[frames->count]; } - bool operator()(float frameNo, Array& cmds, Array& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset) + bool operator()(float frameNo, Array& cmds, Array& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset, LottieExpressions* exps = nullptr) { + //overriding with expressions + if (exps && exp) { + frameNo = _loop(frames, frameNo, exp); + if (exps->result(frameNo, cmds, pts, transform, roundness, offset, exp)) return true; + } + PathSet* path = nullptr; LottieScalarFrame* frame = nullptr; float t; @@ -523,16 +526,6 @@ struct LottiePathSet : LottieProperty return true; } - - bool operator()(float frameNo, Array& cmds, Array& pts, Matrix* transform, const LottieRoundnessModifier* roundness, const LottieOffsetModifier* offset, LottieExpressions* exps) - { - if (exps && exp) { - frameNo = _loop(frames, frameNo, exp); - if (exps->result(frameNo, cmds, pts, transform, roundness, offset, exp)) return true; - } - return operator()(frameNo, cmds, pts, transform, roundness, offset); - } - void prepare() {} }; @@ -613,8 +606,9 @@ struct LottieColorStop : LottieProperty return (*frames)[frames->count]; } - Result operator()(float frameNo, Fill* fill, LottieExpressions* exps) + Result operator()(float frameNo, Fill* fill, LottieExpressions* exps = nullptr) { + //overriding with expressions if (exps && exp) { frameNo = _loop(frames, frameNo, exp); if (exps->result(frameNo, fill, exp)) return Result::Success; @@ -754,8 +748,11 @@ struct LottieTextDoc : LottieProperty return (*frames)[frames->count]; } - TextDocument& operator()(float frameNo) + TextDocument& operator()(float frameNo, LottieExpressions* exps = nullptr) { + //overriding with expressions + if (exps && exp) TVGERR("LOTTIE", "Not support TextDocument expressions?"); + if (!frames) return value; if (frames->count == 1 || frameNo <= frames->first().no) return frames->first().value; if (frameNo >= frames->last().no) return frames->last().value;