diff --git a/res/lottie/extensions/slot13.json b/res/lottie/extensions/slot13.json new file mode 100644 index 0000000..b8de066 --- /dev/null +++ b/res/lottie/extensions/slot13.json @@ -0,0 +1,527 @@ +{ + "v": "5.4.3", + "fr": 60, + "ip": 0, + "op": 100, + "w": 500, + "h": 500, + "nm": "ProgressCircle-lottie", + "ddd": 0, + "assets": [], + "slots": { + "slider_control": { + "p": { + "a": 1, + "k": [ + { + "i": { + "x": [ + 0.833 + ], + "y": [ + 0.833 + ] + }, + "o": { + "x": [ + 0.167 + ], + "y": [ + 0.167 + ] + }, + "n": [ + "0p833_0p833_0p167_0p167" + ], + "t": 0, + "s": [ + 0 + ], + "e": [ + 10 + ] + }, + { + "t": 100 + } + ] + } + } + }, + "layers": [ + { + "ddd": 0, + "ind": 1, + "ty": 3, + "nm": "Counter", + "sr": 1, + "ks": { + "o": { + "a": 0, + "k": 0, + "ix": 11 + }, + "r": { + "a": 0, + "k": 0, + "ix": 10 + }, + "p": { + "a": 0, + "k": [ + 250, + 250, + 0 + ], + "ix": 2 + }, + "a": { + "a": 0, + "k": [ + 0, + 0, + 0 + ], + "ix": 1 + }, + "s": { + "a": 0, + "k": [ + 117.183, + 117.183, + 100 + ], + "ix": 6 + } + }, + "ao": 0, + "ef": [ + { + "ty": 5, + "nm": "Slider Control", + "np": 3, + "mn": "ADBE Slider Control", + "ix": 1, + "en": 1, + "ef": [ + { + "ty": 0, + "nm": "Slider", + "mn": "ADBE Slider Control-0001", + "ix": 1, + "v": { + "a": 1, + "k": [ + { + "i": { + "x": [ + 0.833 + ], + "y": [ + 0.833 + ] + }, + "o": { + "x": [ + 0.167 + ], + "y": [ + 0.167 + ] + }, + "n": [ + "0p833_0p833_0p167_0p167" + ], + "t": 0, + "s": [ + 0 + ], + "e": [ + 100 + ] + }, + { + "t": 100 + } + ], + "ix": 1, + "sid": "slider_control" + } + } + ] + } + ], + "ip": 0, + "op": 100, + "st": 0, + "bm": 0 + }, + { + "ddd": 0, + "ind": 2, + "ty": 4, + "nm": "Shape Layer 2", + "sr": 1, + "ks": { + "o": { + "a": 0, + "k": 100, + "ix": 11 + }, + "r": { + "a": 0, + "k": 0, + "ix": 10 + }, + "p": { + "a": 0, + "k": [ + 202, + 194, + 0 + ], + "ix": 2 + }, + "a": { + "a": 0, + "k": [ + 0, + 0, + 0 + ], + "ix": 1 + }, + "s": { + "a": 0, + "k": [ + 126.352, + 126.352, + 100 + ], + "ix": 6 + } + }, + "ao": 0, + "shapes": [ + { + "ty": "gr", + "it": [ + { + "d": 1, + "ty": "el", + "s": { + "a": 0, + "k": [ + 342.324, + 342.324 + ], + "ix": 2 + }, + "p": { + "a": 0, + "k": [ + 0, + 0 + ], + "ix": 3 + }, + "nm": "Ellipse Path 1", + "mn": "ADBE Vector Shape - Ellipse", + "hd": false + }, + { + "ty": "st", + "c": { + "a": 0, + "k": [ + 1, + 0.4, + 0, + 1 + ], + "ix": 3 + }, + "o": { + "a": 0, + "k": 100, + "ix": 4 + }, + "w": { + "a": 0, + "k": 20, + "ix": 5 + }, + "lc": 1, + "lj": 1, + "ml": 4, + "ml2": { + "a": 0, + "k": 4, + "ix": 8 + }, + "bm": 0, + "nm": "Stroke 1", + "mn": "ADBE Vector Graphic - Stroke", + "hd": false + }, + { + "ty": "tr", + "p": { + "a": 0, + "k": [ + 38.162, + 44.162 + ], + "ix": 2 + }, + "a": { + "a": 0, + "k": [ + 0, + 0 + ], + "ix": 1 + }, + "s": { + "a": 0, + "k": [ + 100, + 100 + ], + "ix": 3 + }, + "r": { + "a": 0, + "k": 0, + "ix": 6 + }, + "o": { + "a": 0, + "k": 100, + "ix": 7 + }, + "sk": { + "a": 0, + "k": 0, + "ix": 4 + }, + "sa": { + "a": 0, + "k": 0, + "ix": 5 + }, + "nm": "Transform" + } + ], + "nm": "Ellipse 1", + "np": 3, + "cix": 2, + "bm": 0, + "ix": 1, + "mn": "ADBE Vector Group", + "hd": false + }, + { + "ty": "tm", + "s": { + "a": 0, + "k": 0, + "ix": 1 + }, + "e": { + "a": 0, + "k": 100, + "ix": 2, + "x": "var $bm_rt;\n$bm_rt = thisComp.layer('Counter').effect('Slider Control')('Slider');" + }, + "o": { + "a": 0, + "k": 0, + "ix": 3 + }, + "m": 1, + "ix": 2, + "nm": "Trim Paths 1", + "mn": "ADBE Vector Filter - Trim", + "hd": false + } + ], + "ip": 0, + "op": 100, + "st": 0, + "bm": 0 + }, + { + "ddd": 0, + "ind": 3, + "ty": 4, + "nm": "Shape Layer 1", + "sr": 1, + "ks": { + "o": { + "a": 0, + "k": 100, + "ix": 11 + }, + "r": { + "a": 0, + "k": 0, + "ix": 10 + }, + "p": { + "a": 0, + "k": [ + 202, + 194, + 0 + ], + "ix": 2 + }, + "a": { + "a": 0, + "k": [ + 0, + 0, + 0 + ], + "ix": 1 + }, + "s": { + "a": 0, + "k": [ + 126.352, + 126.352, + 100 + ], + "ix": 6 + } + }, + "ao": 0, + "shapes": [ + { + "ty": "gr", + "it": [ + { + "d": 1, + "ty": "el", + "s": { + "a": 0, + "k": [ + 342.324, + 342.324 + ], + "ix": 2 + }, + "p": { + "a": 0, + "k": [ + 0, + 0 + ], + "ix": 3 + }, + "nm": "Ellipse Path 1", + "mn": "ADBE Vector Shape - Ellipse", + "hd": false + }, + { + "ty": "st", + "c": { + "a": 0, + "k": [ + 0.2, + 0.2, + 0.2, + 1 + ], + "ix": 3 + }, + "o": { + "a": 0, + "k": 100, + "ix": 4 + }, + "w": { + "a": 0, + "k": 20, + "ix": 5 + }, + "lc": 1, + "lj": 1, + "ml": 4, + "ml2": { + "a": 0, + "k": 4, + "ix": 8 + }, + "bm": 0, + "nm": "Stroke 1", + "mn": "ADBE Vector Graphic - Stroke", + "hd": false + }, + { + "ty": "tr", + "p": { + "a": 0, + "k": [ + 38.162, + 44.162 + ], + "ix": 2 + }, + "a": { + "a": 0, + "k": [ + 0, + 0 + ], + "ix": 1 + }, + "s": { + "a": 0, + "k": [ + 100, + 100 + ], + "ix": 3 + }, + "r": { + "a": 0, + "k": 0, + "ix": 6 + }, + "o": { + "a": 0, + "k": 100, + "ix": 7 + }, + "sk": { + "a": 0, + "k": 0, + "ix": 4 + }, + "sa": { + "a": 0, + "k": 0, + "ix": 5 + }, + "nm": "Transform" + } + ], + "nm": "Ellipse 1", + "np": 3, + "cix": 2, + "bm": 0, + "ix": 1, + "mn": "ADBE Vector Group", + "hd": false + } + ], + "ip": 0, + "op": 100, + "st": 0, + "bm": 0 + } + ], + "markers": [] +} \ No newline at end of file diff --git a/src/LottieExtension.cpp b/src/LottieExtension.cpp index 5179447..c9a6c46 100644 --- a/src/LottieExtension.cpp +++ b/src/LottieExtension.cpp @@ -24,7 +24,7 @@ /* ThorVG Drawing Contents */ /************************************************************************/ -#define NUM_PER_ROW 4 +#define NUM_PER_ROW 5 #define NUM_PER_COL 4 struct UserExample : tvgexam::Example @@ -268,6 +268,21 @@ struct UserExample : tvgexam::Example slots.push_back(std::move(slot)); } + //slot (effect) + { + auto slot = std::unique_ptr(tvg::LottieAnimation::gen()); + auto picture = slot->picture(); + if (!tvgexam::verify(picture->load(EXAMPLE_DIR"/lottie/extensions/slot13.json"))) return false; + + const char* slotJson = R"({"slider_control":{"p":{"a":1,"ix":1,"k":[{"i":{"x":[0.833],"y":[0.833]},"o":{"x":[0.167],"y":[0.167]},"t":0,"s":[0],"e":[50]},{"t":100}]}}})"; + auto slotId = slot->gen(slotJson); + if (!tvgexam::verify(slot->apply(slotId))) return false; + + sizing(picture, 13); + canvas->add(picture); + slots.push_back(std::move(slot)); + } + //marker { marker = std::unique_ptr(tvg::LottieAnimation::gen()); @@ -275,7 +290,7 @@ struct UserExample : tvgexam::Example if (!tvgexam::verify(picture->load(EXAMPLE_DIR"/lottie/extensions/marker.json"))) return false; if (!tvgexam::verify(marker->segment("sectionC"))) return false; - sizing(picture, 13); + sizing(picture, 14); canvas->add(picture); } @@ -296,7 +311,7 @@ struct UserExample : tvgexam::Example if (!tvgexam::verify(picture->resolver(func, nullptr))) return false; if (!tvgexam::verify(picture->load(EXAMPLE_DIR"/lottie/extensions/resolver1.json"))) return false; - sizing(picture, 14); + sizing(picture, 15); canvas->add(picture); } @@ -317,7 +332,7 @@ struct UserExample : tvgexam::Example if (!tvgexam::verify(picture->resolver(func, nullptr))) return false; if (!tvgexam::verify(picture->load(EXAMPLE_DIR"/lottie/extensions/resolver2.json"))) return false; - sizing(picture, 15); + sizing(picture, 16); canvas->add(picture); }