MCPcopy Create free account
hub / github.com/Samsung/rlottie / parseKeyFrame

Method parseKeyFrame

src/lottie/lottieparser.cpp:1995–2078  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1993 */
1994template <typename T, typename Tag>
1995void LottieParserImpl::parseKeyFrame(model::KeyFrames<T, Tag> &obj)
1996{
1997 struct ParsedField {
1998 std::string interpolatorKey;
1999 bool interpolator{false};
2000 bool value{false};
2001 bool hold{false};
2002 bool noEndValue{true};
2003 };
2004
2005 EnterObject();
2006 ParsedField parsed;
2007 typename model::KeyFrames<T, Tag>::Frame keyframe;
2008 VPointF inTangent;
2009 VPointF outTangent;
2010
2011 while (const char *key = NextObjectKey()) {
2012 if (0 == strcmp(key, "i")) {
2013 parsed.interpolator = true;
2014 inTangent = parseInperpolatorPoint();
2015 } else if (0 == strcmp(key, "o")) {
2016 outTangent = parseInperpolatorPoint();
2017 } else if (0 == strcmp(key, "t")) {
2018 keyframe.start_ = GetDouble();
2019 } else if (0 == strcmp(key, "s")) {
2020 parsed.value = true;
2021 getValue(keyframe.value_.start_);
2022 continue;
2023 } else if (0 == strcmp(key, "e")) {
2024 parsed.noEndValue = false;
2025 getValue(keyframe.value_.end_);
2026 continue;
2027 } else if (0 == strcmp(key, "n")) {
2028 if (PeekType() == kStringType) {
2029 parsed.interpolatorKey = GetString();
2030 } else {
2031 RAPIDJSON_ASSERT(PeekType() == kArrayType);
2032 EnterArray();
2033 while (NextArrayValue()) {
2034 RAPIDJSON_ASSERT(PeekType() == kStringType);
2035 if (parsed.interpolatorKey.empty()) {
2036 parsed.interpolatorKey = GetString();
2037 } else {
2038 // skip rest of the string
2039 GetString();
2040 }
2041 }
2042 }
2043 continue;
2044 } else if (parseKeyFrameValue(key, keyframe.value_)) {
2045 continue;
2046 } else if (0 == strcmp(key, "h")) {
2047 parsed.hold = GetInt();
2048 continue;
2049 } else {
2050#ifdef DEBUG_PARSER
2051 vDebug << "key frame property skipped = " << key;
2052#endif

Callers

nothing calls this directly

Calls 4

GetDoubleFunction · 0.85
GetIntFunction · 0.85
GetStringFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected