From 6705977abd384be326ad490e9425ba6bd1b54262 Mon Sep 17 00:00:00 2001 From: JunsuChoi Date: Wed, 2 Oct 2019 15:21:33 +0900 Subject: [PATCH] Example : Enhancement dynamic property demo Change json sample and add more cases. --- example/demo.cpp | 56 ++++++++++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 8 deletions(-) diff --git a/example/demo.cpp b/example/demo.cpp index 3509362..623f73e 100644 --- a/example/demo.cpp +++ b/example/demo.cpp @@ -34,35 +34,75 @@ onExitCb(void *data, void */*extra*/) int main(void) { - EvasApp *app = new EvasApp(800, 800); + EvasApp *app = new EvasApp(900, 300); app->setup(); std::string filePath = DEMO_DIR; - filePath +="circuit.json"; + filePath +="done.json"; + /* Fill Color */ LottieView *view = new LottieView(app->evas()); view->setFilePath(filePath.c_str()); if (view->player()) { - view->player()->setValue("**", + view->player()->setValue("Shape Layer 1.Ellipse 1.Fill 1", [](const rlottie::FrameInfo& info) { - if (info.curFrame() < 15 ) - return rlottie::Color(0, 1, 0); + if (info.curFrame() < 60 ) + return rlottie::Color(0, 0, 1); else { return rlottie::Color(1, 0, 0); } }); } view->setPos(0, 0); - view->setSize(800, 800); + view->setSize(300, 300); view->show(); -// view->setMinProgress(0.5); -// view->setMaxProgress(0.0); view->play(); view->loop(true); view->setRepeatMode(LottieView::RepeatMode::Reverse); + + /* Stroke Opacity */ + view = new LottieView(app->evas()); + view->setFilePath(filePath.c_str()); + if (view->player()) { + view->player()->setValue("Shape Layer 2.Shape 1.Stroke 1", + [](const rlottie::FrameInfo& info) { + if (info.curFrame() < 60 ) + return 20; + else { + return 100; + } + }); + } + view->setPos(300, 0); + view->setSize(300, 300); + view->show(); + view->play(); + view->loop(true); + view->setRepeatMode(LottieView::RepeatMode::Reverse); + + /* Stroke Width and Globstar path (All Content) */ + view = new LottieView(app->evas()); + view->setFilePath(filePath.c_str()); + if (view->player()) { + view->player()->setValue("**", + [](const rlottie::FrameInfo& info) { + if (info.curFrame() < 60 ) + return 1.0; + else { + return 5.0; + } + }); + } + view->setPos(600, 0); + view->setSize(300, 300); + view->show(); + view->play(); + view->loop(true); + view->setRepeatMode(LottieView::RepeatMode::Reverse); app->addExitCb(onExitCb, view); app->run(); + delete app; return 0; } -- 2.7.4