Change-Id: I8e5ce194f1795ca30ac8aad319ba25706a6023cf
#include "lottieview.h"
#include<iostream>
#include <stdio.h>
+#include <fstream>
+#include <sstream>
using namespace std;
static void
std::string filePath = DEMO_DIR;
filePath +="mask.json";
+ std::ifstream f;
+ f.open(filePath);
+ std::stringstream buf;
+ buf << f.rdbuf();
+ f.close();
+
LottieView *view = new LottieView(app->evas());
- view->setFilePath(filePath.c_str());
+ view->loadFromData(buf.str().data(), "test_key");
view->setPos(0, 0);
view->setSize(800, 800);
view->show();
mTotalFrame = mPlayer->totalFrame();
}
+void LottieView::loadFromData(const char *jsonData, const char *key)
+{
+ mPlayer->loadFromData(jsonData, key);
+ mFrameRate = mPlayer->frameRate();
+ mTotalFrame = mPlayer->totalFrame();
+}
+
void LottieView::setSize(int w, int h)
{
if (mRenderMode) {
void setSize(int w, int h);
void setPos(int x, int y);
void setFilePath(const char *filePath);
+ void loadFromData(const char *jsonData, const char *key);
void show();
void hide();
void loop(bool loop);