| Flutter Impeller |

Classes | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
impeller::scene::TimelineResolver Class Reference

`#include <property_resolver.h>`

Inheritance diagram for impeller::scene::TimelineResolver:

## Classes
struct | TimelineKey

## Public Member Functions
virtual | ~TimelineResolver ()
SecondsF | GetEndTime ()
Public Member Functions inherited from impeller::scene::PropertyResolver
virtual | ~PropertyResolver ()
virtual void | Apply (AnimationTransforms &target, SecondsF time, Scalar weight)=0
| Resolve and apply the property value to a target node. This operation is additive; a given node property may be amended by many different PropertyResolvers prior to rendering. For example, an AnimationPlayer may blend multiple Animations together by applying several AnimationClips. More...

## Protected Member Functions
TimelineKey | GetTimelineKey (SecondsF time)

## Protected Attributes
std::vector< Scalar > | times_

## Additional Inherited Members
Static Public Member Functions inherited from impeller::scene::PropertyResolver
static std::unique_ptr< TranslationTimelineResolver > | MakeTranslationTimeline (std::vector< Scalar > times, std::vector< Vector3 > values)
static std::unique_ptr< RotationTimelineResolver > | MakeRotationTimeline (std::vector< Scalar > times, std::vector< Quaternion > values)
static std::unique_ptr< ScaleTimelineResolver > | MakeScaleTimeline (std::vector< Scalar > times, std::vector< Vector3 > values)

## Detailed Description

Definition at line 57 of file property_resolver.h.

## Constructor & Destructor Documentation

## ◆ ~TimelineResolver()

impeller::scene::TimelineResolver::~TimelineResolver | ( |  | ) |
| virtual default

## Member Function Documentation

## ◆ GetEndTime()

SecondsF impeller::scene::TimelineResolver::GetEndTime | ( |  | ) |
| virtual

Implements impeller::scene::PropertyResolver.

Definition at line 55 of file property_resolver.cc.

55 {
56 if (times_.empty()) {
57 return SecondsF::zero();
58 }
59 return SecondsF(times_.back());
60 }

References times_.

## ◆ GetTimelineKey()

TimelineResolver::TimelineKey impeller::scene::TimelineResolver::GetTimelineKey | ( | SecondsF | time | ) |
| protected

Definition at line 62 of file property_resolver.cc.

62 {
63 if (times_.size() <= 1 || time.count() <= times_.front()) {
64 return {.index = 0, .lerp = 1};
65 }
66 if (time.count() >= times_.back()) {
67 return {.index = times_.size() - 1, .lerp = 1};
68 }
69 auto it = std::lower_bound(times_.begin(), times_.end(), time.count());
70 size_t index = std::distance(times_.begin(), it);
71
72 Scalar previous_time = *(it - 1);
73 Scalar next_time = *it;
74 return {.index = index,
75 .lerp = (time.count() - previous_time) / (next_time - previous_time)};
76 }

References impeller::saturated::distance, impeller::scene::TimelineResolver::TimelineKey::index, and times_.

Referenced by impeller::scene::TranslationTimelineResolver::Apply(), impeller::scene::RotationTimelineResolver::Apply(), and impeller::scene::ScaleTimelineResolver::Apply().

## Member Data Documentation

## ◆ times_

std::vector<Scalar> impeller::scene::TimelineResolver::times_
| protected

Definition at line 74 of file property_resolver.h.

Referenced by GetEndTime(), and GetTimelineKey().

The documentation for this class was generated from the following files:

- impeller/scene/animation/property_resolver.h
- impeller/scene/animation/property_resolver.cc

impeller::Scalar
float Scalar
Definition: scalar.h:18
impeller::scene::TimelineResolver::times_
std::vector< Scalar > times_
Definition: property_resolver.h:74
impeller::saturated::distance
SI distance
Definition: saturated_math.h:57
impeller::SecondsF
std::chrono::duration< float > SecondsF
Definition: timing.h:13