[skottie] Surface composition markers in CK
Change-Id: Ie53c81f4dbe981327469d8a9990d27f8a41d8b4c Reviewed-on: https://skia-review.googlesource.com/c/173983 Reviewed-by: Kevin Lubick <kjlubick@google.com> Commit-Queue: Florin Malita <fmalita@chromium.org>
This commit is contained in:
parent
4fbdb12348
commit
6ba8c7ea84
@ -169,6 +169,7 @@ public:
|
|||||||
static sk_sp<ManagedAnimation> Make(const std::string& json) {
|
static sk_sp<ManagedAnimation> Make(const std::string& json) {
|
||||||
auto mgr = skstd::make_unique<skottie_utils::CustomPropertyManager>();
|
auto mgr = skstd::make_unique<skottie_utils::CustomPropertyManager>();
|
||||||
auto animation = skottie::Animation::Builder()
|
auto animation = skottie::Animation::Builder()
|
||||||
|
.setMarkerObserver(mgr->getMarkerObserver())
|
||||||
.setPropertyObserver(mgr->getPropertyObserver())
|
.setPropertyObserver(mgr->getPropertyObserver())
|
||||||
.make(json.c_str(), json.size());
|
.make(json.c_str(), json.size());
|
||||||
|
|
||||||
@ -220,6 +221,18 @@ public:
|
|||||||
return fPropMgr->setOpacity(key, o);
|
return fPropMgr->setOpacity(key, o);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
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:
|
private:
|
||||||
ManagedAnimation(sk_sp<skottie::Animation> animation,
|
ManagedAnimation(sk_sp<skottie::Animation> animation,
|
||||||
std::unique_ptr<skottie_utils::CustomPropertyManager> propMgr)
|
std::unique_ptr<skottie_utils::CustomPropertyManager> propMgr)
|
||||||
@ -977,6 +990,7 @@ EMSCRIPTEN_BINDINGS(Skia) {
|
|||||||
(&ManagedAnimation::render), allow_raw_pointers())
|
(&ManagedAnimation::render), allow_raw_pointers())
|
||||||
.function("setColor" , &ManagedAnimation::setColor)
|
.function("setColor" , &ManagedAnimation::setColor)
|
||||||
.function("setOpacity", &ManagedAnimation::setOpacity)
|
.function("setOpacity", &ManagedAnimation::setOpacity)
|
||||||
|
.function("getMarkers", &ManagedAnimation::getMarkers)
|
||||||
.function("getColorProps" , &ManagedAnimation::getColorProps)
|
.function("getColorProps" , &ManagedAnimation::getColorProps)
|
||||||
.function("getOpacityProps", &ManagedAnimation::getOpacityProps);
|
.function("getOpacityProps", &ManagedAnimation::getOpacityProps);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user