mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-08 05:33:36 +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)
|
static jerry_value_t _buildTrimpath(LottieTrimpath* trimpath, float frameNo)
|
||||||
{
|
{
|
||||||
jerry_value_t obj = jerry_object();
|
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_object_set_sz(obj, "start", start);
|
||||||
jerry_value_free(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_object_set_sz(obj, "end", end);
|
||||||
jerry_value_free(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_object_set_sz(obj, EXP_OFFSET, offset);
|
||||||
jerry_value_free(offset);
|
jerry_value_free(offset);
|
||||||
|
|
||||||
|
|
|
@ -259,8 +259,9 @@ struct LottieGenericProperty : LottieProperty
|
||||||
//Property has an either keyframes or single value.
|
//Property has an either keyframes or single value.
|
||||||
Array<LottieScalarFrame<T>>* frames = nullptr;
|
Array<LottieScalarFrame<T>>* frames = nullptr;
|
||||||
T value;
|
T value;
|
||||||
|
T curValue;
|
||||||
|
|
||||||
LottieGenericProperty(T v) : value(v) {}
|
LottieGenericProperty(T v) : value(v), curValue(v) {}
|
||||||
LottieGenericProperty() {}
|
LottieGenericProperty() {}
|
||||||
|
|
||||||
LottieGenericProperty(const LottieGenericProperty<T>& rhs)
|
LottieGenericProperty(const LottieGenericProperty<T>& rhs)
|
||||||
|
@ -330,11 +331,11 @@ struct LottieGenericProperty : LottieProperty
|
||||||
T operator()(float frameNo, LottieExpressions* exps)
|
T operator()(float frameNo, LottieExpressions* exps)
|
||||||
{
|
{
|
||||||
if (exps && exp) {
|
if (exps && exp) {
|
||||||
T out{};
|
|
||||||
frameNo = _loop(frames, frameNo, exp);
|
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)
|
void copy(const LottieGenericProperty<T>& rhs, bool shallow = true)
|
||||||
|
|
Loading…
Add table
Reference in a new issue