Flutter Engine
The Flutter Engine
Public Member Functions | Protected Member Functions | Friends | List of all members
skottie::internal::AnimatablePropertyContainer Class Referenceabstract

#include <Animator.h>

Inheritance diagram for skottie::internal::AnimatablePropertyContainer:
skottie::internal::Animator SkRefCnt SkRefCntBase skottie::internal::DiscardableAdapterBase< OpacityAdapter, sksg::OpacityEffect > skottie::internal::DiscardableAdapterBase< TransformAdapter2D, sksg::Matrix< SkMatrix > > skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > > skottie::internal::DiscardableAdapterBase< AdapterT, T > skottie::internal::MaskShaderEffectBase skottie::internal::TextAdapter skottie::internal::OpacityAdapter skottie::internal::TransformAdapter2D skottie::internal::TransformAdapter3D skottie::internal::CameraAdaper

Public Member Functions

template<typename T >
bool bind (const AnimationBuilder &, const skjson::ObjectValue *, T *)
 
template<typename T >
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jobject, T &v)
 
bool bindAutoOrientable (const AnimationBuilder &abuilder, const skjson::ObjectValue *jobject, SkV2 *v, float *orientation)
 
bool isStatic () const
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, ScalarValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, ShapeValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, TextValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, Vec2Value *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, VectorValue *v)
 
template<>
bool bind (const AnimationBuilder &abuilder, const skjson::ObjectValue *jprop, ColorValue *v)
 
- Public Member Functions inherited from skottie::internal::Animator
StateChanged seek (float t)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Protected Member Functions

virtual void onSync ()=0
 
void shrink_to_fit ()
 
void attachDiscardableAdapter (sk_sp< AnimatablePropertyContainer >)
 
- Protected Member Functions inherited from skottie::internal::Animator
 Animator ()=default
 
virtual StateChanged onSeek (float t)=0
 

Friends

class skottie::SlotManager
 

Additional Inherited Members

- Public Types inherited from skottie::internal::Animator
using StateChanged = bool
 

Detailed Description

Definition at line 47 of file Animator.h.

Member Function Documentation

◆ attachDiscardableAdapter()

void skottie::internal::AnimatablePropertyContainer::attachDiscardableAdapter ( sk_sp< AnimatablePropertyContainer child)
protected

Definition at line 36 of file Animator.cpp.

37 {
38 if (!child) {
39 return;
40 }
41
42 if (child->isStatic()) {
43 child->seek(0);
44 return;
45 }
46
47 fAnimators.push_back(std::move(child));
48}

◆ bind() [1/8]

template<typename T >
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder ,
const skjson::ObjectValue ,
T  
)

◆ bind() [2/8]

template<typename T >
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder abuilder,
const skjson::ObjectValue jobject,
T v 
)
inline

Definition at line 56 of file Animator.h.

56 {
57 return this->bind<T>(abuilder, jobject, &v);
58 }

◆ bind() [3/8]

template<>
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder abuilder,
const skjson::ObjectValue jprop,
ColorValue v 
)

Definition at line 317 of file VectorKeyframeAnimator.cpp.

319 {
320 if (const auto* sid = ParseSlotID(jprop)) {
321 fHasSlotID = true;
322 abuilder.fSlotManager->trackColorValue(SkString(sid->begin()), v, sk_ref_sp(this));
323 }
324 return this->bind(abuilder, jprop, static_cast<VectorValue*>(v));
325}
sk_sp< T > sk_ref_sp(T *obj)
Definition: SkRefCnt.h:381
bool bind(const AnimationBuilder &, const skjson::ObjectValue *, T *)
const skjson::StringValue * ParseSlotID(const skjson::ObjectValue *jobj)

◆ bind() [4/8]

template<>
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder abuilder,
const skjson::ObjectValue jprop,
ScalarValue v 
)

Definition at line 119 of file ScalarKeyframeAnimator.cpp.

121 {
122 if (const auto* sid = ParseSlotID(jprop)) {
123 fHasSlotID = true;
124 abuilder.fSlotManager->trackScalarValue(SkString(sid->begin()), v, sk_ref_sp(this));
125 }
126 ScalarAnimatorBuilder builder(v);
127
128 return this->bindImpl(abuilder, jprop, builder);
129}

◆ bind() [5/8]

template<>
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder abuilder,
const skjson::ObjectValue jprop,
ShapeValue v 
)

Definition at line 180 of file ShapeKeyframeAnimator.cpp.

182 {
183 VectorAnimatorBuilder builder(v, parse_encoding_len, parse_encoding_data);
184
185 return this->bindImpl(abuilder, jprop, builder);
186}
static bool parse_encoding_data(const skjson::Value &jv, size_t data_len, float data[])
static bool parse_encoding_len(const skjson::Value &jv, size_t *len)

◆ bind() [6/8]

template<>
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder abuilder,
const skjson::ObjectValue jprop,
TextValue v 
)

Definition at line 137 of file TextKeyframeAnimator.cpp.

139 {
140 TextAnimatorBuilder builder(v);
141 return this->bindImpl(abuilder, jprop, builder);
142}

◆ bind() [7/8]

template<>
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder abuilder,
const skjson::ObjectValue jprop,
Vec2Value v 
)

Definition at line 295 of file Vec2KeyframeAnimator.cpp.

297 {
298 return this->bindAutoOrientable(abuilder, jprop, v, nullptr);
299}
bool bindAutoOrientable(const AnimationBuilder &abuilder, const skjson::ObjectValue *jobject, SkV2 *v, float *orientation)

◆ bind() [8/8]

template<>
bool skottie::internal::AnimatablePropertyContainer::bind ( const AnimationBuilder abuilder,
const skjson::ObjectValue jprop,
VectorValue v 
)

Definition at line 281 of file VectorKeyframeAnimator.cpp.

283 {
284 if (!jprop) {
285 return false;
286 }
287
288 if (!ParseDefault<bool>((*jprop)["s"], false)) {
289 // Regular (static or keyframed) vector value.
290 VectorAnimatorBuilder builder(
291 v,
292 // Len parser.
293 [](const skjson::Value& jv, size_t* len) -> bool {
294 if (const skjson::ArrayValue* ja = jv) {
295 *len = ja->size();
296 return true;
297 }
298 return false;
299 },
300 // Data parser.
301 [](const skjson::Value& jv, size_t len, float* data) {
302 return parse_array(jv, data, len);
303 });
304
305 return this->bindImpl(abuilder, jprop, builder);
306 }
307
308 // Separate-dimensions vector value: each component is animated independently.
309 *v = { 0, 0, 0 };
310 bool boundX = this->bind(abuilder, (*jprop)["x"], v->data() + 0);
311 bool boundY = this->bind(abuilder, (*jprop)["y"], v->data() + 1);
312 bool boundZ = this->bind(abuilder, (*jprop)["z"], v->data() + 2);
313 return boundX || boundY || boundZ;
314}
static const char * ja
Definition: fontmgr.cpp:72
static bool parse_array(const skjson::ArrayValue *ja, float *a, size_t count)
std::shared_ptr< const fml::Mapping > data
Definition: texture_gles.cc:63

◆ bindAutoOrientable()

bool skottie::internal::AnimatablePropertyContainer::bindAutoOrientable ( const AnimationBuilder abuilder,
const skjson::ObjectValue jobject,
SkV2 v,
float *  orientation 
)

Definition at line 270 of file Vec2KeyframeAnimator.cpp.

272 {
273 if (!jprop) {
274 return false;
275 }
276
277 if (const auto* sid = ParseSlotID(jprop)) {
278 fHasSlotID = true;
279 abuilder.fSlotManager->trackVec2Value(SkString(sid->begin()), v, sk_ref_sp(this));
280 }
281
282 if (!ParseDefault<bool>((*jprop)["s"], false)) {
283 // Regular (static or keyframed) 2D value.
284 Vec2AnimatorBuilder builder(v, orientation);
285 return this->bindImpl(abuilder, jprop, builder);
286 }
287
288 // Separate-dimensions vector value: each component is animated independently.
289 bool boundX = this->bind(abuilder, (*jprop)["x"], &v->x);
290 bool boundY = this->bind(abuilder, (*jprop)["y"], &v->y);
291 return boundX || boundY;
292}
float x
Definition: SkM44.h:20
float y
Definition: SkM44.h:20

◆ isStatic()

bool skottie::internal::AnimatablePropertyContainer::isStatic ( ) const
inline

Definition at line 66 of file Animator.h.

66{ return fAnimators.empty() && !fHasSlotID; }

◆ onSync()

virtual void skottie::internal::AnimatablePropertyContainer::onSync ( )
protectedpure virtual

◆ shrink_to_fit()

void skottie::internal::AnimatablePropertyContainer::shrink_to_fit ( )
protected

Definition at line 50 of file Animator.cpp.

50 {
51 fAnimators.shrink_to_fit();
52}

Friends And Related Function Documentation

◆ skottie::SlotManager

friend class skottie::SlotManager
friend

Definition at line 69 of file Animator.h.


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