// Copyright 2013 The Flutter Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef FLUTTER_IMPELLER_SCENE_ANIMATION_ANIMATION_H_ #define FLUTTER_IMPELLER_SCENE_ANIMATION_ANIMATION_H_ #include #include #include #include "flutter/fml/hash_combine.h" #include "impeller/base/timing.h" #include "impeller/scene/animation/property_resolver.h" #include "impeller/scene/importer/scene_flatbuffers.h" namespace impeller { namespace scene { class Node; class Animation final { public: static std::shared_ptr MakeFromFlatbuffer( const fb::Animation& animation, const std::vector>& scene_nodes); enum class Property { kTranslation, kRotation, kScale, }; struct BindKey { std::string node_name; Property property = Property::kTranslation; struct Hash { std::size_t operator()(const BindKey& o) const { return fml::HashCombine(o.node_name, o.property); } }; struct Equal { bool operator()(const BindKey& lhs, const BindKey& rhs) const { return lhs.node_name == rhs.node_name && lhs.property == rhs.property; } }; }; struct Channel { BindKey bind_target; std::unique_ptr resolver; }; ~Animation(); const std::string& GetName() const; const std::vector& GetChannels() const; SecondsF GetEndTime() const; private: Animation(); std::string name_; std::vector channels_; SecondsF end_time_; Animation(const Animation&) = delete; Animation& operator=(const Animation&) = delete; }; } // namespace scene } // namespace impeller #endif // FLUTTER_IMPELLER_SCENE_ANIMATION_ANIMATION_H_