1022f74375
Extend composition layers to support referencing external .json animations ("$"<PATH> syntax). This is a custom extension (not supported in BM/Lottie). Also make skottie::Animation ref-counted, to facilitate sharing. TBR= Change-Id: I062d031e5868d759f3930dea9b261f9b3ec81684 Reviewed-on: https://skia-review.googlesource.com/109806 Reviewed-by: Florin Malita <fmalita@chromium.org> Commit-Queue: Florin Malita <fmalita@chromium.org>
43 lines
1.1 KiB
C++
43 lines
1.1 KiB
C++
/*
|
|
* Copyright 2017 Google Inc.
|
|
*
|
|
* Use of this source code is governed by a BSD-style license that can be
|
|
* found in the LICENSE file.
|
|
*/
|
|
|
|
#ifndef SkottieSlide_DEFINED
|
|
#define SkottieSlide_DEFINED
|
|
|
|
#include "Slide.h"
|
|
|
|
namespace skottie { class Animation; }
|
|
namespace sksg { class Scene; }
|
|
|
|
class SkottieSlide : public Slide {
|
|
public:
|
|
SkottieSlide(const SkString& name, const SkString& path);
|
|
~SkottieSlide() override = default;
|
|
|
|
void load(SkScalar winWidth, SkScalar winHeight) override;
|
|
void unload() override;
|
|
|
|
SkISize getDimensions() const override;
|
|
|
|
void draw(SkCanvas*) override;
|
|
bool animate(const SkAnimTimer&) override;
|
|
|
|
bool onChar(SkUnichar) override;
|
|
bool onMouse(SkScalar x, SkScalar y, sk_app::Window::InputState, uint32_t modifiers) override;
|
|
|
|
private:
|
|
SkString fPath;
|
|
sk_sp<skottie::Animation> fAnimation;
|
|
SkSize fWinSize = SkSize::MakeEmpty();
|
|
SkMSec fTimeBase = 0;
|
|
bool fShowAnimationInval = false;
|
|
|
|
typedef Slide INHERITED;
|
|
};
|
|
|
|
#endif // SkottieSlide_DEFINED
|