Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
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"
13#include "flutter/fml/macros.h"
19#include "impeller/scene/importer/scene_flatbuffers.h"
20
21namespace impeller {
22namespace scene {
23
24class Node;
25
26class Animation final {
27 public:
28 static std::shared_ptr<Animation> MakeFromFlatbuffer(
29 const fb::Animation& animation,
30 const std::vector<std::shared_ptr<Node>>& scene_nodes);
31
32 enum class Property {
35 kScale,
36 };
37
38 struct BindKey {
39 std::string node_name;
41
42 struct Hash {
43 std::size_t operator()(const BindKey& o) const {
45 }
46 };
47
48 struct Equal {
49 bool operator()(const BindKey& lhs, const BindKey& rhs) const {
50 return lhs.node_name == rhs.node_name && lhs.property == rhs.property;
51 }
52 };
53 };
54
55 struct Channel {
57 std::unique_ptr<PropertyResolver> resolver;
58 };
60
61 const std::string& GetName() const;
62
63 const std::vector<Channel>& GetChannels() const;
64
65 SecondsF GetEndTime() const;
66
67 private:
68 Animation();
69
70 std::string name_;
71 std::vector<Channel> channels_;
72 SecondsF end_time_;
73
74 Animation(const Animation&) = delete;
75
76 Animation& operator=(const Animation&) = delete;
77};
78
79} // namespace scene
80} // namespace impeller
81
82#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()
std::chrono::duration< float > SecondsF
Definition timing.h:13
bool operator()(const BindKey &lhs, const BindKey &rhs) const
Definition animation.h:49
std::size_t operator()(const BindKey &o) const
Definition animation.h:43
std::unique_ptr< PropertyResolver > resolver
Definition animation.h:57