Flutter Engine
The Flutter Engine
animation.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef FLUTTER_IMPELLER_SCENE_ANIMATION_ANIMATION_H_
6#define FLUTTER_IMPELLER_SCENE_ANIMATION_ANIMATION_H_
7
8#include <memory>
9#include <string>
10#include <vector>
11
12#include "flutter/fml/hash_combine.h"
15#include "impeller/scene/importer/scene_flatbuffers.h"
16
17namespace impeller {
18namespace scene {
19
20class Node;
21
22class Animation final {
23 public:
24 static std::shared_ptr<Animation> MakeFromFlatbuffer(
25 const fb::Animation& animation,
26 const std::vector<std::shared_ptr<Node>>& scene_nodes);
27
28 enum class Property {
29 kTranslation,
30 kRotation,
31 kScale,
32 };
33
34 struct BindKey {
35 std::string node_name;
37
38 struct Hash {
39 std::size_t operator()(const BindKey& o) const {
41 }
42 };
43
44 struct Equal {
45 bool operator()(const BindKey& lhs, const BindKey& rhs) const {
46 return lhs.node_name == rhs.node_name && lhs.property == rhs.property;
47 }
48 };
49 };
50
51 struct Channel {
53 std::unique_ptr<PropertyResolver> resolver;
54 };
56
57 const std::string& GetName() const;
58
59 const std::vector<Channel>& GetChannels() const;
60
61 SecondsF GetEndTime() const;
62
63 private:
64 Animation();
65
66 std::string name_;
67 std::vector<Channel> channels_;
68 SecondsF end_time_;
69
70 Animation(const Animation&) = delete;
71
72 Animation& operator=(const Animation&) = delete;
73};
74
75} // namespace scene
76} // namespace impeller
77
78#endif // FLUTTER_IMPELLER_SCENE_ANIMATION_ANIMATION_H_
SecondsF GetEndTime() const
Definition: animation.cc:120
const std::vector< Channel > & GetChannels() const
Definition: animation.cc:116
static std::shared_ptr< Animation > MakeFromFlatbuffer(const fb::Animation &animation, const std::vector< std::shared_ptr< Node > > &scene_nodes)
Definition: animation.cc:19
const std::string & GetName() const
Definition: animation.cc:112
Definition: dart.idl:29
constexpr std::size_t HashCombine()
Definition: hash_combine.h:25
std::chrono::duration< float > SecondsF
Definition: timing.h:13
bool operator()(const BindKey &lhs, const BindKey &rhs) const
Definition: animation.h:45
std::size_t operator()(const BindKey &o) const
Definition: animation.h:39
std::unique_ptr< PropertyResolver > resolver
Definition: animation.h:53