mirror of
https://github.com/thorvg/thorvg.git
synced 2025-06-07 21:23:32 +00:00
lottie/expressions: minor updates
- added toComp() initial ver. - added mn property for effects issue: https://github.com/thorvg/thorvg/issues/2233
This commit is contained in:
parent
d0f33a1bc5
commit
5c27fefef8
3 changed files with 7 additions and 7 deletions
|
@ -175,9 +175,8 @@ static unsigned long _idByName(jerry_value_t args)
|
|||
|
||||
static jerry_value_t _toComp(const jerry_call_info_t* info, const jerry_value_t args[], const jerry_length_t argsCnt)
|
||||
{
|
||||
TVGLOG("LOTTIE", "toComp is not supported in expressions!");
|
||||
|
||||
return jerry_undefined();
|
||||
auto layer = static_cast<LottieLayer*>(jerry_object_get_native_ptr(info->function, nullptr));
|
||||
return _point2d(_point2d(args[0]) * layer->cache.matrix);
|
||||
}
|
||||
|
||||
|
||||
|
@ -469,8 +468,6 @@ static jerry_value_t _addsub(const jerry_value_t args[], float addsub)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
static jerry_value_t _muldiv(const jerry_value_t arg1, float arg2)
|
||||
{
|
||||
//1d
|
||||
|
@ -637,7 +634,7 @@ static jerry_value_t _content(const jerry_call_info_t* info, const jerry_value_t
|
|||
switch (target->type) {
|
||||
case LottieObject::Group: return _buildGroup(static_cast<LottieGroup*>(target), data->frameNo);
|
||||
case LottieObject::Path: {
|
||||
jerry_value_t obj = jerry_object();
|
||||
auto obj = jerry_object();
|
||||
jerry_object_set_native_ptr(obj, nullptr, &static_cast<LottiePath*>(target)->pathset);
|
||||
jerry_object_set_sz(obj, "path", obj);
|
||||
return obj;
|
||||
|
@ -690,6 +687,7 @@ static jerry_value_t _nearestKey(const jerry_call_info_t* info, const jerry_valu
|
|||
return obj;
|
||||
}
|
||||
|
||||
|
||||
static jerry_value_t _property(const jerry_call_info_t* info, const jerry_value_t args[], const jerry_length_t argsCnt)
|
||||
{
|
||||
auto data = static_cast<ExpContent*>(jerry_object_get_native_ptr(info->function, &freeCb));
|
||||
|
|
|
@ -88,6 +88,7 @@ struct LottieEffect
|
|||
virtual ~LottieEffect() {}
|
||||
|
||||
unsigned long nm; //encoded by djb2
|
||||
unsigned long mn; //encoded by djb2
|
||||
int16_t ix;
|
||||
Type type;
|
||||
bool enable = false;
|
||||
|
@ -1007,7 +1008,7 @@ struct LottieLayer : LottieGroup
|
|||
LottieEffect* effectById(unsigned long id)
|
||||
{
|
||||
ARRAY_FOREACH(p, effects) {
|
||||
if (id == (*p)->nm) return *p;
|
||||
if (id == (*p)->nm || id == (*p)->mn) return *p;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
|
|
@ -1416,6 +1416,7 @@ void LottieParser::parseEffects(LottieLayer* layer)
|
|||
else invalid = false;
|
||||
}
|
||||
else if (effect && KEY_AS("nm")) effect->nm = djb2Encode(getString());
|
||||
else if (effect && KEY_AS("mn")) effect->mn = djb2Encode(getString());
|
||||
else if (effect && KEY_AS("ix")) effect->ix = getInt();
|
||||
else if (effect && KEY_AS("en")) effect->enable = getInt();
|
||||
else if (effect && KEY_AS("ef")) parseEffect(effect);
|
||||
|
|
Loading…
Add table
Reference in a new issue