2019-01-03 19:27:27 +00:00
|
|
|
/*
|
|
|
|
* Copyright 2019 Google LLC
|
|
|
|
*
|
|
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
|
|
* found in the LICENSE file.
|
|
|
|
*/
|
|
|
|
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "include/core/SkCanvas.h"
|
|
|
|
#include "include/core/SkImage.h"
|
|
|
|
#include "include/core/SkString.h"
|
|
|
|
#include "include/core/SkTypes.h"
|
|
|
|
#include "modules/skottie/include/Skottie.h"
|
2019-07-22 17:48:10 +00:00
|
|
|
#include "modules/sksg/include/SkSGInvalidationController.h"
|
2019-01-03 19:27:27 +00:00
|
|
|
|
|
|
|
#include <string>
|
2019-02-28 15:06:18 +00:00
|
|
|
#include <vector>
|
2019-01-03 19:27:27 +00:00
|
|
|
|
|
|
|
#include <emscripten.h>
|
|
|
|
#include <emscripten/bind.h>
|
2020-03-26 13:27:48 +00:00
|
|
|
#include "modules/canvaskit/WasmCommon.h"
|
2019-01-03 19:27:27 +00:00
|
|
|
|
|
|
|
#if SK_INCLUDE_MANAGED_SKOTTIE
|
2019-04-23 17:05:21 +00:00
|
|
|
#include "modules/skottie/include/SkottieProperty.h"
|
|
|
|
#include "modules/skottie/utils/SkottieUtils.h"
|
2019-11-26 13:58:26 +00:00
|
|
|
#include "modules/skresources/include/SkResources.h"
|
2019-01-03 19:27:27 +00:00
|
|
|
#endif // SK_INCLUDE_MANAGED_SKOTTIE
|
|
|
|
|
|
|
|
using namespace emscripten;
|
|
|
|
|
|
|
|
#if SK_INCLUDE_MANAGED_SKOTTIE
|
|
|
|
namespace {
|
|
|
|
|
2021-02-09 21:43:30 +00:00
|
|
|
// WebTrack wraps a JS object that has a 'seek' method.
|
|
|
|
// Playback logic is kept there.
|
|
|
|
class WebTrack final : public skresources::ExternalTrackAsset {
|
|
|
|
public:
|
|
|
|
explicit WebTrack(emscripten::val player) : fPlayer(std::move(player)) {}
|
|
|
|
|
|
|
|
private:
|
|
|
|
void seek(float t) override {
|
|
|
|
fPlayer.call<void>("seek", val(t));
|
|
|
|
}
|
|
|
|
|
|
|
|
const emscripten::val fPlayer;
|
|
|
|
};
|
|
|
|
|
2019-02-28 15:06:18 +00:00
|
|
|
class SkottieAssetProvider : public skottie::ResourceProvider {
|
|
|
|
public:
|
|
|
|
~SkottieAssetProvider() override = default;
|
|
|
|
|
2019-02-28 22:48:31 +00:00
|
|
|
// Tried using a map, but that gave strange errors like
|
|
|
|
// https://emscripten.org/docs/porting/guidelines/function_pointer_issues.html
|
|
|
|
// Not entirely sure why, but perhaps the iterator in the map was
|
|
|
|
// confusing enscripten.
|
|
|
|
using AssetVec = std::vector<std::pair<SkString, sk_sp<SkData>>>;
|
2019-02-28 15:06:18 +00:00
|
|
|
|
2021-02-09 21:43:30 +00:00
|
|
|
static sk_sp<SkottieAssetProvider> Make(AssetVec assets, emscripten::val soundMap) {
|
2021-02-17 16:52:10 +00:00
|
|
|
return sk_sp<SkottieAssetProvider>(new SkottieAssetProvider(std::move(assets),
|
|
|
|
std::move(soundMap)));
|
2019-02-28 15:06:18 +00:00
|
|
|
}
|
|
|
|
|
2019-03-01 14:19:45 +00:00
|
|
|
sk_sp<skottie::ImageAsset> loadImageAsset(const char[] /* path */,
|
2019-07-16 22:22:45 +00:00
|
|
|
const char name[],
|
|
|
|
const char[] /* id */) const override {
|
|
|
|
// For CK/Skottie we ignore paths & IDs, and identify images based solely on name.
|
2019-03-01 14:19:45 +00:00
|
|
|
if (auto data = this->findAsset(name)) {
|
2019-11-26 13:58:26 +00:00
|
|
|
return skresources::MultiFrameImageAsset::Make(std::move(data));
|
2019-02-28 15:06:18 +00:00
|
|
|
}
|
2019-02-28 22:48:31 +00:00
|
|
|
|
2019-02-28 15:06:18 +00:00
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2021-02-09 21:43:30 +00:00
|
|
|
sk_sp<skresources::ExternalTrackAsset> loadAudioAsset(const char[] /* path */,
|
2021-02-10 20:49:48 +00:00
|
|
|
const char[] /* name */,
|
|
|
|
const char id[]) override {
|
|
|
|
emscripten::val player = this->findSoundAsset(id);
|
2021-02-09 21:43:30 +00:00
|
|
|
if (player.as<bool>()) {
|
|
|
|
return sk_make_sp<WebTrack>(std::move(player));
|
|
|
|
}
|
|
|
|
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2019-03-01 14:19:45 +00:00
|
|
|
sk_sp<SkData> loadFont(const char name[], const char[] /* url */) const override {
|
|
|
|
// Same as images paths, we ignore font URLs.
|
2019-02-28 22:48:31 +00:00
|
|
|
return this->findAsset(name);
|
2019-02-28 21:05:09 +00:00
|
|
|
}
|
|
|
|
|
2020-05-07 02:20:14 +00:00
|
|
|
sk_sp<SkData> load(const char[]/*path*/, const char name[]) const override {
|
|
|
|
// Ignore paths.
|
|
|
|
return this->findAsset(name);
|
|
|
|
}
|
|
|
|
|
2019-02-28 15:06:18 +00:00
|
|
|
private:
|
2021-02-09 21:43:30 +00:00
|
|
|
explicit SkottieAssetProvider(AssetVec assets, emscripten::val soundMap)
|
|
|
|
: fAssets(std::move(assets))
|
|
|
|
, fSoundMap(std::move(soundMap)) {}
|
2019-02-28 15:06:18 +00:00
|
|
|
|
2019-02-28 22:48:31 +00:00
|
|
|
sk_sp<SkData> findAsset(const char name[]) const {
|
|
|
|
for (const auto& asset : fAssets) {
|
|
|
|
if (asset.first.equals(name)) {
|
|
|
|
return asset.second;
|
|
|
|
}
|
|
|
|
}
|
2019-02-28 15:06:18 +00:00
|
|
|
|
2019-02-28 22:48:31 +00:00
|
|
|
SkDebugf("Could not find %s\n", name);
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
2021-02-09 21:43:30 +00:00
|
|
|
emscripten::val findSoundAsset(const char name[]) const {
|
|
|
|
if (fSoundMap.as<bool>() && fSoundMap.hasOwnProperty("getPlayer")) {
|
|
|
|
emscripten::val player = fSoundMap.call<emscripten::val>("getPlayer", val(name));
|
|
|
|
if (player.as<bool>() && player.hasOwnProperty("seek")) {
|
|
|
|
return player;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return emscripten::val::null();
|
|
|
|
}
|
|
|
|
|
2019-02-28 22:48:31 +00:00
|
|
|
const AssetVec fAssets;
|
2021-02-09 21:43:30 +00:00
|
|
|
const emscripten::val fSoundMap;
|
2019-02-28 15:06:18 +00:00
|
|
|
};
|
|
|
|
|
2021-02-17 16:52:10 +00:00
|
|
|
// Wraps a JS object with 'onError' and 'onWarning' methods.
|
|
|
|
class JSLogger final : public skottie::Logger {
|
|
|
|
public:
|
|
|
|
static sk_sp<JSLogger> Make(emscripten::val logger) {
|
|
|
|
return logger.as<bool>()
|
|
|
|
&& logger.hasOwnProperty(kWrnFunc)
|
|
|
|
&& logger.hasOwnProperty(kErrFunc)
|
|
|
|
? sk_sp<JSLogger>(new JSLogger(std::move(logger)))
|
|
|
|
: nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
explicit JSLogger(emscripten::val logger) : fLogger(std::move(logger)) {}
|
|
|
|
|
|
|
|
void log(Level lvl, const char msg[], const char* json) override {
|
|
|
|
const auto* func = lvl == Level::kError ? kErrFunc : kWrnFunc;
|
|
|
|
fLogger.call<void>(func, std::string(msg), std::string(json));
|
|
|
|
}
|
|
|
|
|
|
|
|
static constexpr char kWrnFunc[] = "onWarning",
|
|
|
|
kErrFunc[] = "onError";
|
|
|
|
|
|
|
|
const emscripten::val fLogger;
|
|
|
|
};
|
|
|
|
|
2019-01-03 19:27:27 +00:00
|
|
|
class ManagedAnimation final : public SkRefCnt {
|
|
|
|
public:
|
2019-10-18 17:13:40 +00:00
|
|
|
static sk_sp<ManagedAnimation> Make(const std::string& json,
|
2020-08-20 18:51:41 +00:00
|
|
|
sk_sp<skottie::ResourceProvider> rp,
|
2021-02-17 16:52:10 +00:00
|
|
|
std::string prop_prefix,
|
|
|
|
emscripten::val logger) {
|
2020-08-20 18:51:41 +00:00
|
|
|
auto mgr = std::make_unique<skottie_utils::CustomPropertyManager>(
|
|
|
|
skottie_utils::CustomPropertyManager::Mode::kCollapseProperties,
|
|
|
|
prop_prefix.empty() ? nullptr : prop_prefix.c_str());
|
2020-05-07 02:20:14 +00:00
|
|
|
static constexpr char kInterceptPrefix[] = "__";
|
|
|
|
auto pinterceptor =
|
|
|
|
sk_make_sp<skottie_utils::ExternalAnimationPrecompInterceptor>(rp, kInterceptPrefix);
|
2019-01-03 19:27:27 +00:00
|
|
|
auto animation = skottie::Animation::Builder()
|
|
|
|
.setMarkerObserver(mgr->getMarkerObserver())
|
|
|
|
.setPropertyObserver(mgr->getPropertyObserver())
|
2020-05-07 02:20:14 +00:00
|
|
|
.setResourceProvider(std::move(rp))
|
|
|
|
.setPrecompInterceptor(std::move(pinterceptor))
|
2021-02-17 16:52:10 +00:00
|
|
|
.setLogger(JSLogger::Make(std::move(logger)))
|
2019-01-03 19:27:27 +00:00
|
|
|
.make(json.c_str(), json.size());
|
|
|
|
|
|
|
|
return animation
|
|
|
|
? sk_sp<ManagedAnimation>(new ManagedAnimation(std::move(animation), std::move(mgr)))
|
|
|
|
: nullptr;
|
|
|
|
}
|
|
|
|
|
2019-02-28 15:06:18 +00:00
|
|
|
~ManagedAnimation() override = default;
|
|
|
|
|
2019-01-03 19:27:27 +00:00
|
|
|
// skottie::Animation API
|
2020-09-03 14:02:10 +00:00
|
|
|
void render(SkCanvas* canvas, const SkRect* dst) const { fAnimation->render(canvas, dst); }
|
2019-07-22 17:48:10 +00:00
|
|
|
// Returns a damage rect.
|
|
|
|
SkRect seek(SkScalar t) {
|
|
|
|
sksg::InvalidationController ic;
|
|
|
|
fAnimation->seek(t, &ic);
|
|
|
|
return ic.bounds();
|
|
|
|
}
|
2019-10-22 13:45:51 +00:00
|
|
|
// Returns a damage rect.
|
|
|
|
SkRect seekFrame(double t) {
|
|
|
|
sksg::InvalidationController ic;
|
|
|
|
fAnimation->seekFrame(t, &ic);
|
|
|
|
return ic.bounds();
|
|
|
|
}
|
|
|
|
double duration() const { return fAnimation->duration(); }
|
|
|
|
double fps() const { return fAnimation->fps(); }
|
|
|
|
const SkSize& size() const { return fAnimation->size(); }
|
2019-01-03 19:27:27 +00:00
|
|
|
std::string version() const { return std::string(fAnimation->version().c_str()); }
|
|
|
|
|
|
|
|
// CustomPropertyManager API
|
|
|
|
JSArray getColorProps() const {
|
|
|
|
JSArray props = emscripten::val::array();
|
|
|
|
|
|
|
|
for (const auto& cp : fPropMgr->getColorProps()) {
|
|
|
|
JSObject prop = emscripten::val::object();
|
|
|
|
prop.set("key", cp);
|
|
|
|
prop.set("value", fPropMgr->getColor(cp));
|
|
|
|
props.call<void>("push", prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
return props;
|
|
|
|
}
|
|
|
|
|
|
|
|
JSArray getOpacityProps() const {
|
|
|
|
JSArray props = emscripten::val::array();
|
|
|
|
|
|
|
|
for (const auto& op : fPropMgr->getOpacityProps()) {
|
|
|
|
JSObject prop = emscripten::val::object();
|
|
|
|
prop.set("key", op);
|
|
|
|
prop.set("value", fPropMgr->getOpacity(op));
|
|
|
|
props.call<void>("push", prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
return props;
|
|
|
|
}
|
|
|
|
|
2021-03-10 15:33:18 +00:00
|
|
|
JSArray getTextProps() const {
|
|
|
|
JSArray props = emscripten::val::array();
|
|
|
|
|
|
|
|
for (const auto& key : fPropMgr->getTextProps()) {
|
|
|
|
const auto txt = fPropMgr->getText(key);
|
|
|
|
JSObject txt_val = emscripten::val::object();
|
|
|
|
txt_val.set("text", txt.fText.c_str());
|
|
|
|
txt_val.set("size", txt.fTextSize);
|
|
|
|
|
|
|
|
JSObject prop = emscripten::val::object();
|
|
|
|
prop.set("key", key);
|
|
|
|
prop.set("value", std::move(txt_val));
|
|
|
|
|
|
|
|
props.call<void>("push", prop);
|
|
|
|
}
|
|
|
|
|
|
|
|
return props;
|
|
|
|
}
|
|
|
|
|
2019-03-29 14:39:52 +00:00
|
|
|
bool setColor(const std::string& key, SkColor c) {
|
|
|
|
return fPropMgr->setColor(key, c);
|
2019-01-03 19:27:27 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bool setOpacity(const std::string& key, float o) {
|
|
|
|
return fPropMgr->setOpacity(key, o);
|
|
|
|
}
|
|
|
|
|
2021-03-10 15:33:18 +00:00
|
|
|
bool setText(const std::string& key, std::string text, float size) {
|
|
|
|
// preserve all other text fields
|
|
|
|
auto t = fPropMgr->getText(key);
|
|
|
|
|
|
|
|
t.fText = SkString(text);
|
|
|
|
t.fTextSize = size;
|
|
|
|
|
|
|
|
return fPropMgr->setText(key, t);
|
|
|
|
}
|
|
|
|
|
2019-01-03 19:27:27 +00:00
|
|
|
JSArray getMarkers() const {
|
|
|
|
JSArray markers = emscripten::val::array();
|
|
|
|
for (const auto& m : fPropMgr->markers()) {
|
|
|
|
JSObject marker = emscripten::val::object();
|
|
|
|
marker.set("name", m.name);
|
|
|
|
marker.set("t0" , m.t0);
|
|
|
|
marker.set("t1" , m.t1);
|
|
|
|
markers.call<void>("push", marker);
|
|
|
|
}
|
|
|
|
return markers;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
ManagedAnimation(sk_sp<skottie::Animation> animation,
|
|
|
|
std::unique_ptr<skottie_utils::CustomPropertyManager> propMgr)
|
|
|
|
: fAnimation(std::move(animation))
|
2021-02-17 16:52:10 +00:00
|
|
|
, fPropMgr(std::move(propMgr))
|
|
|
|
{}
|
2019-01-03 19:27:27 +00:00
|
|
|
|
2021-02-17 16:52:10 +00:00
|
|
|
const sk_sp<skottie::Animation> fAnimation;
|
|
|
|
const std::unique_ptr<skottie_utils::CustomPropertyManager> fPropMgr;
|
2019-01-03 19:27:27 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
} // anonymous ns
|
|
|
|
#endif // SK_INCLUDE_MANAGED_SKOTTIE
|
|
|
|
|
|
|
|
EMSCRIPTEN_BINDINGS(Skottie) {
|
|
|
|
// Animation things (may eventually go in own library)
|
|
|
|
class_<skottie::Animation>("Animation")
|
|
|
|
.smart_ptr<sk_sp<skottie::Animation>>("sk_sp<Animation>")
|
|
|
|
.function("version", optional_override([](skottie::Animation& self)->std::string {
|
|
|
|
return std::string(self.version().c_str());
|
|
|
|
}))
|
2021-02-02 13:18:11 +00:00
|
|
|
.function("_size", optional_override([](skottie::Animation& self,
|
2021-05-26 17:40:22 +00:00
|
|
|
WASMPointerF32 oPtr)->void {
|
2021-02-02 13:18:11 +00:00
|
|
|
SkSize* output = reinterpret_cast<SkSize*>(oPtr);
|
|
|
|
*output = self.size();
|
|
|
|
}))
|
2019-01-03 19:27:27 +00:00
|
|
|
.function("duration", &skottie::Animation::duration)
|
2019-10-22 13:45:51 +00:00
|
|
|
.function("fps" , &skottie::Animation::fps)
|
2019-07-22 16:05:41 +00:00
|
|
|
.function("seek", optional_override([](skottie::Animation& self, SkScalar t)->void {
|
|
|
|
self.seek(t);
|
|
|
|
}))
|
2019-10-22 13:45:51 +00:00
|
|
|
.function("seekFrame", optional_override([](skottie::Animation& self, double t)->void {
|
|
|
|
self.seekFrame(t);
|
|
|
|
}))
|
2020-09-03 14:02:10 +00:00
|
|
|
.function("_render", optional_override([](skottie::Animation& self, SkCanvas* canvas,
|
2021-05-26 17:40:22 +00:00
|
|
|
WASMPointerF32 fPtr)->void {
|
2020-09-03 14:02:10 +00:00
|
|
|
const SkRect* dst = reinterpret_cast<const SkRect*>(fPtr);
|
|
|
|
self.render(canvas, dst);
|
2019-01-03 19:27:27 +00:00
|
|
|
}), allow_raw_pointers());
|
|
|
|
|
|
|
|
function("MakeAnimation", optional_override([](std::string json)->sk_sp<skottie::Animation> {
|
|
|
|
return skottie::Animation::Make(json.c_str(), json.length());
|
|
|
|
}));
|
|
|
|
constant("skottie", true);
|
|
|
|
|
|
|
|
#if SK_INCLUDE_MANAGED_SKOTTIE
|
|
|
|
class_<ManagedAnimation>("ManagedAnimation")
|
|
|
|
.smart_ptr<sk_sp<ManagedAnimation>>("sk_sp<ManagedAnimation>")
|
|
|
|
.function("version" , &ManagedAnimation::version)
|
2021-02-02 13:18:11 +00:00
|
|
|
.function("_size", optional_override([](ManagedAnimation& self,
|
2021-05-26 17:40:22 +00:00
|
|
|
WASMPointerF32 oPtr)->void {
|
2021-02-02 13:18:11 +00:00
|
|
|
SkSize* output = reinterpret_cast<SkSize*>(oPtr);
|
|
|
|
*output = self.size();
|
|
|
|
}))
|
2019-01-03 19:27:27 +00:00
|
|
|
.function("duration" , &ManagedAnimation::duration)
|
2019-10-22 13:45:51 +00:00
|
|
|
.function("fps" , &ManagedAnimation::fps)
|
2020-09-03 14:02:10 +00:00
|
|
|
.function("_render", optional_override([](ManagedAnimation& self, SkCanvas* canvas,
|
2021-05-26 17:40:22 +00:00
|
|
|
WASMPointerF32 fPtr)->void {
|
2020-09-03 14:02:10 +00:00
|
|
|
const SkRect* dst = reinterpret_cast<const SkRect*>(fPtr);
|
|
|
|
self.render(canvas, dst);
|
|
|
|
}), allow_raw_pointers())
|
|
|
|
.function("_seek", optional_override([](ManagedAnimation& self, SkScalar t,
|
2021-05-26 17:40:22 +00:00
|
|
|
WASMPointerF32 fPtr) {
|
2020-09-03 14:02:10 +00:00
|
|
|
SkRect* damageRect = reinterpret_cast<SkRect*>(fPtr);
|
|
|
|
damageRect[0] = self.seek(t);
|
|
|
|
}))
|
|
|
|
.function("_seekFrame", optional_override([](ManagedAnimation& self, double frame,
|
2021-05-26 17:40:22 +00:00
|
|
|
WASMPointerF32 fPtr) {
|
2020-09-03 14:02:10 +00:00
|
|
|
SkRect* damageRect = reinterpret_cast<SkRect*>(fPtr);
|
|
|
|
damageRect[0] = self.seekFrame(frame);
|
|
|
|
}))
|
2019-10-22 13:45:51 +00:00
|
|
|
.function("seekFrame" , &ManagedAnimation::seekFrame)
|
2021-05-26 17:40:22 +00:00
|
|
|
.function("_setColor" , optional_override([](ManagedAnimation& self, const std::string& key, WASMPointerF32 cPtr) {
|
2020-05-04 20:46:17 +00:00
|
|
|
float* fourFloats = reinterpret_cast<float*>(cPtr);
|
|
|
|
SkColor4f color = { fourFloats[0], fourFloats[1], fourFloats[2], fourFloats[3] };
|
2021-03-10 15:33:18 +00:00
|
|
|
return self.setColor(key, color.toSkColor());
|
2020-03-26 13:27:48 +00:00
|
|
|
}))
|
2019-01-03 19:27:27 +00:00
|
|
|
.function("setOpacity", &ManagedAnimation::setOpacity)
|
|
|
|
.function("getMarkers", &ManagedAnimation::getMarkers)
|
|
|
|
.function("getColorProps" , &ManagedAnimation::getColorProps)
|
2021-03-10 15:33:18 +00:00
|
|
|
.function("getOpacityProps", &ManagedAnimation::getOpacityProps)
|
|
|
|
.function("getTextProps" , &ManagedAnimation::getTextProps)
|
|
|
|
.function("setText" , &ManagedAnimation::setText);
|
2019-01-03 19:27:27 +00:00
|
|
|
|
2019-02-28 15:06:18 +00:00
|
|
|
function("_MakeManagedAnimation", optional_override([](std::string json,
|
2019-02-28 22:48:31 +00:00
|
|
|
size_t assetCount,
|
2021-05-26 17:40:22 +00:00
|
|
|
WASMPointerU32 nptr,
|
|
|
|
WASMPointerU32 dptr,
|
|
|
|
WASMPointerU32 sptr,
|
2021-02-09 21:43:30 +00:00
|
|
|
std::string prop_prefix,
|
2021-02-17 16:52:10 +00:00
|
|
|
emscripten::val soundMap,
|
|
|
|
emscripten::val logger)
|
2019-02-28 15:06:18 +00:00
|
|
|
->sk_sp<ManagedAnimation> {
|
2019-02-28 22:48:31 +00:00
|
|
|
const auto assetNames = reinterpret_cast<char** >(nptr);
|
|
|
|
const auto assetDatas = reinterpret_cast<uint8_t**>(dptr);
|
|
|
|
const auto assetSizes = reinterpret_cast<size_t* >(sptr);
|
|
|
|
|
|
|
|
SkottieAssetProvider::AssetVec assets;
|
|
|
|
assets.reserve(assetCount);
|
2019-02-28 15:06:18 +00:00
|
|
|
|
2019-02-28 22:48:31 +00:00
|
|
|
for (size_t i = 0; i < assetCount; i++) {
|
|
|
|
auto name = SkString(assetNames[i]);
|
|
|
|
auto bytes = SkData::MakeFromMalloc(assetDatas[i], assetSizes[i]);
|
|
|
|
assets.push_back(std::make_pair(std::move(name), std::move(bytes)));
|
2019-02-28 21:05:09 +00:00
|
|
|
}
|
|
|
|
|
2019-10-18 17:13:40 +00:00
|
|
|
return ManagedAnimation::Make(json,
|
2020-08-20 18:51:41 +00:00
|
|
|
skresources::DataURIResourceProviderProxy::Make(
|
2021-02-17 16:52:10 +00:00
|
|
|
SkottieAssetProvider::Make(std::move(assets),
|
|
|
|
std::move(soundMap))),
|
|
|
|
prop_prefix, std::move(logger));
|
2019-02-28 15:06:18 +00:00
|
|
|
}));
|
2019-01-03 19:27:27 +00:00
|
|
|
constant("managed_skottie", true);
|
|
|
|
#endif // SK_INCLUDE_MANAGED_SKOTTIE
|
|
|
|
}
|