/* * Copyright 2018 Google Inc. * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #ifndef SkottieProperty_DEFINED #define SkottieProperty_DEFINED #include "include/core/SkColor.h" #include "include/core/SkPoint.h" #include "include/core/SkRefCnt.h" #include class SkMatrix; namespace sksg { class Color; class OpacityEffect; } // namespace sksg namespace skottie { using ColorPropertyValue = SkColor; using OpacityPropertyValue = float; struct TransformPropertyValue { SkPoint fAnchorPoint, fPosition; SkVector fScale; SkScalar fRotation, fSkew, fSkewAxis; bool operator==(const TransformPropertyValue& other) const; bool operator!=(const TransformPropertyValue& other) const; }; namespace internal { class AnimationBuilder; } /** * Property handles are adapters between user-facing AE model/values * and the internal scene-graph representation. */ template class SK_API PropertyHandle final { public: explicit PropertyHandle(sk_sp node) : fNode(std::move(node)) {} ~PropertyHandle(); ValueT get() const; void set(const ValueT&); private: const sk_sp fNode; }; class TransformAdapter2D; using ColorPropertyHandle = PropertyHandle; using OpacityPropertyHandle = PropertyHandle; using TransformPropertyHandle = PropertyHandle; /** * A PropertyObserver can be used to track and manipulate certain properties of "interesting" * Lottie nodes. * * When registered with an animation builder, PropertyObserver receives notifications for * various properties of layer and shape nodes. The |node_name| argument corresponds to the * name ("nm") node property. */ class SK_API PropertyObserver : public SkRefCnt { public: template using LazyHandle = std::function()>; virtual void onColorProperty (const char node_name[], const LazyHandle&); virtual void onOpacityProperty (const char node_name[], const LazyHandle&); virtual void onTransformProperty(const char node_name[], const LazyHandle&); }; } // namespace skottie #endif // SkottieProperty_DEFINED