Flutter Engine
The Flutter Engine
Classes | Public Types | Public Member Functions | Static Public Member Functions | List of all members
skottie::internal::TextAnimator Class Referencefinal

#include <TextAnimator.h>

Inheritance diagram for skottie::internal::TextAnimator:
SkNVRefCnt< TextAnimator >

Classes

struct  AnimatedProps
 
struct  AnimatedPropsModulator
 
struct  DomainMaps
 
struct  DomainSpan
 
struct  ResolvedProps
 

Public Types

using ModulatorBuffer = std::vector< AnimatedPropsModulator >
 
using DomainMap = std::vector< DomainSpan >
 

Public Member Functions

void modulateProps (const DomainMaps &, ModulatorBuffer &) const
 
bool hasBlur () const
 
bool requiresAnchorPoint () const
 
bool requiresLineAdjustments () const
 
- Public Member Functions inherited from SkNVRefCnt< TextAnimator >
 SkNVRefCnt ()
 
 ~SkNVRefCnt ()
 
bool unique () const
 
void ref () const
 
void unref () const
 
void deref () const
 
bool refCntGreaterThan (int32_t threadIsolatedTestCnt) const
 

Static Public Member Functions

static sk_sp< TextAnimatorMake (const skjson::ObjectValue *, const AnimationBuilder *, AnimatablePropertyContainer *acontainer)
 

Detailed Description

Definition at line 29 of file TextAnimator.h.

Member Typedef Documentation

◆ DomainMap

Definition at line 82 of file TextAnimator.h.

◆ ModulatorBuffer

Definition at line 69 of file TextAnimator.h.

Member Function Documentation

◆ hasBlur()

bool skottie::internal::TextAnimator::hasBlur ( ) const
inline

Definition at line 92 of file TextAnimator.h.

92{ return fHasBlur; }

◆ Make()

sk_sp< TextAnimator > skottie::internal::TextAnimator::Make ( const skjson::ObjectValue janimator,
const AnimationBuilder abuilder,
AnimatablePropertyContainer acontainer 
)
static

Definition at line 67 of file TextAnimator.cpp.

69 {
70 if (!janimator) {
71 return nullptr;
72 }
73
74 const skjson::ObjectValue* jprops = (*janimator)["a"];
75 if (!jprops) {
76 return nullptr;
77 }
78
79 std::vector<sk_sp<RangeSelector>> selectors;
80
81 // Depending on compat mode and whether more than one selector is present,
82 // BM exports either an array or a single object.
83 if (const skjson::ArrayValue* jselectors = (*janimator)["s"]) {
84 selectors.reserve(jselectors->size());
85 for (const skjson::ObjectValue* jselector : *jselectors) {
86 if (auto sel = RangeSelector::Make(*jselector, abuilder, acontainer)) {
87 selectors.push_back(std::move(sel));
88 }
89 }
90 } else {
91 if (auto sel = RangeSelector::Make((*janimator)["s"], abuilder, acontainer)) {
92 selectors.reserve(1);
93 selectors.push_back(std::move(sel));
94 }
95 }
96
98 new TextAnimator(std::move(selectors), *jprops, abuilder, acontainer));
99}
static sk_sp< RangeSelector > Make(const skjson::ObjectValue *, const AnimationBuilder *, AnimatablePropertyContainer *)

◆ modulateProps()

void skottie::internal::TextAnimator::modulateProps ( const DomainMaps maps,
ModulatorBuffer buf 
) const

Definition at line 101 of file TextAnimator.cpp.

101 {
102 // No selectors -> full coverage.
103 const auto initial_coverage = fSelectors.empty() ? 1.f : 0.f;
104
105 // Coverage is scoped per animator.
106 for (auto& mod : buf) {
107 mod.coverage = initial_coverage;
108 }
109
110 // Accumulate selector coverage.
111 for (const auto& selector : fSelectors) {
112 selector->modulateCoverage(maps, buf);
113 }
114
115 // Modulate animated props.
116 for (auto& mod : buf) {
117 mod.props = this->modulateProps(mod.props, mod.coverage);
118 }
119}
void modulateProps(const DomainMaps &, ModulatorBuffer &) const

◆ requiresAnchorPoint()

bool skottie::internal::TextAnimator::requiresAnchorPoint ( ) const
inline

Definition at line 94 of file TextAnimator.h.

94{ return fRequiresAnchorPoint; }

◆ requiresLineAdjustments()

bool skottie::internal::TextAnimator::requiresLineAdjustments ( ) const
inline

Definition at line 95 of file TextAnimator.h.

95{ return fRequiresLineAdjustments; }

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