mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
lottie: expressions++
@Issue: https://github.com/thorvg/thorvg/issues/2989
This commit is contained in:
parent
87ee4f3f34
commit
51a3d60ec4
2 changed files with 8 additions and 7 deletions
|
@ -231,13 +231,13 @@ static jerry_value_t _buildPolystar(LottiePolyStar* polystar, float frameNo)
|
|||
static jerry_value_t _buildTrimpath(LottieTrimpath* trimpath, float frameNo)
|
||||
{
|
||||
jerry_value_t obj = jerry_object();
|
||||
auto start = jerry_number(trimpath->start(frameNo));
|
||||
auto start = jerry_number(trimpath->start.curValue);
|
||||
jerry_object_set_sz(obj, "start", start);
|
||||
jerry_value_free(start);
|
||||
auto end = jerry_number(trimpath->end(frameNo));
|
||||
auto end = jerry_number(trimpath->end.curValue);
|
||||
jerry_object_set_sz(obj, "end", end);
|
||||
jerry_value_free(end);
|
||||
auto offset = jerry_number(trimpath->offset(frameNo));
|
||||
auto offset = jerry_number(trimpath->offset.curValue);
|
||||
jerry_object_set_sz(obj, EXP_OFFSET, offset);
|
||||
jerry_value_free(offset);
|
||||
|
||||
|
|
|
@ -259,8 +259,9 @@ struct LottieGenericProperty : LottieProperty
|
|||
//Property has an either keyframes or single value.
|
||||
Array<LottieScalarFrame<T>>* frames = nullptr;
|
||||
T value;
|
||||
T curValue;
|
||||
|
||||
LottieGenericProperty(T v) : value(v) {}
|
||||
LottieGenericProperty(T v) : value(v), curValue(v) {}
|
||||
LottieGenericProperty() {}
|
||||
|
||||
LottieGenericProperty(const LottieGenericProperty<T>& rhs)
|
||||
|
@ -330,11 +331,11 @@ struct LottieGenericProperty : LottieProperty
|
|||
T operator()(float frameNo, LottieExpressions* exps)
|
||||
{
|
||||
if (exps && exp) {
|
||||
T out{};
|
||||
frameNo = _loop(frames, frameNo, exp);
|
||||
if (exps->result<LottieGenericProperty<T>>(frameNo, out, exp)) return out;
|
||||
if (exps->result<LottieGenericProperty<T>>(frameNo, curValue, exp)) return curValue;
|
||||
}
|
||||
return operator()(frameNo);
|
||||
curValue = operator()(frameNo);
|
||||
return curValue;
|
||||
}
|
||||
|
||||
void copy(const LottieGenericProperty<T>& rhs, bool shallow = true)
|
||||
|
|
Loading…
Add table
Reference in a new issue