forked from flutter-team-archive/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathanimation.h
More file actions
77 lines (59 loc) · 1.71 KB
/
Copy pathanimation.h
File metadata and controls
77 lines (59 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// 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.
#pragma once
#include <memory>
#include <string>
#include <vector>
#include "flutter/fml/hash_combine.h"
#include "flutter/fml/macros.h"
#include "impeller/base/timing.h"
#include "impeller/geometry/quaternion.h"
#include "impeller/geometry/scalar.h"
#include "impeller/geometry/vector.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<Animation> MakeFromFlatbuffer(
const fb::Animation& animation,
const std::vector<std::shared_ptr<Node>>& 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<PropertyResolver> resolver;
};
~Animation();
const std::string& GetName() const;
const std::vector<Channel>& GetChannels() const;
SecondsF GetEndTime() const;
private:
Animation();
std::string name_;
std::vector<Channel> channels_;
SecondsF end_time_;
FML_DISALLOW_COPY_AND_ASSIGN(Animation);
};
} // namespace scene
} // namespace impeller