Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Member Functions | List of all members
skottie::internal::TransformAdapter3D Class Reference

#include <Transform.h>

Inheritance diagram for skottie::internal::TransformAdapter3D:
skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > > skottie::internal::AnimatablePropertyContainer skottie::internal::Animator SkRefCnt SkRefCntBase skottie::internal::CameraAdaper

Public Member Functions

 TransformAdapter3D (const skjson::ObjectValue &, const AnimationBuilder &)
 
 ~TransformAdapter3D () override
 
virtual SkM44 totalMatrix () const
 
- Public Member Functions inherited from skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > >
const sk_sp< sksg::Matrix< SkM44 > > & node () const
 
- Public Member Functions inherited from skottie::internal::AnimatablePropertyContainer
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

SkV3 anchor_point () const
 
SkV3 position () const
 
SkV3 rotation () const
 
- Protected Member Functions inherited from skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > >
 DiscardableAdapterBase ()
 
 DiscardableAdapterBase (sk_sp< sksg::Matrix< SkM44 > > node)
 
- Protected Member Functions inherited from skottie::internal::AnimatablePropertyContainer
void shrink_to_fit ()
 
void attachDiscardableAdapter (sk_sp< AnimatablePropertyContainer >)
 
- Protected Member Functions inherited from skottie::internal::Animator
 Animator ()=default
 

Private Member Functions

void onSync () final
 

Additional Inherited Members

- Public Types inherited from skottie::internal::Animator
using StateChanged = bool
 
- Static Public Member Functions inherited from skottie::internal::DiscardableAdapterBase< TransformAdapter3D, sksg::Matrix< SkM44 > >
static sk_sp< TransformAdapter3DMake (Args &&... args)
 

Detailed Description

Definition at line 78 of file Transform.h.

Constructor & Destructor Documentation

◆ TransformAdapter3D()

skottie::internal::TransformAdapter3D::TransformAdapter3D ( const skjson::ObjectValue jtransform,
const AnimationBuilder abuilder 
)

Definition at line 148 of file Transform.cpp.

150 : INHERITED(sksg::Matrix<SkM44>::Make(SkM44())) {
151
152 this->bind(abuilder, jtransform["a"], fAnchorPoint);
153 this->bind(abuilder, jtransform["p"], fPosition);
154 this->bind(abuilder, jtransform["s"], fScale);
155
156 // Axis-wise rotation and orientation are mapped to the same rotation property (3D rotation).
157 // The difference is in how they get interpolated (scalar/decomposed vs. vector).
158 this->bind(abuilder, jtransform["rx"], fRx);
159 this->bind(abuilder, jtransform["ry"], fRy);
160 this->bind(abuilder, jtransform["rz"], fRz);
161 this->bind(abuilder, jtransform["or"], fOrientation);
162}
Definition SkM44.h:150
bool bind(const AnimationBuilder &, const skjson::ObjectValue *, T *)

◆ ~TransformAdapter3D()

skottie::internal::TransformAdapter3D::~TransformAdapter3D ( )
overridedefault

Member Function Documentation

◆ anchor_point()

SkV3 skottie::internal::TransformAdapter3D::anchor_point ( ) const
protected

Definition at line 170 of file Transform.cpp.

170 {
171 return fAnchorPoint;
172}

◆ onSync()

void skottie::internal::TransformAdapter3D::onSync ( )
finalprivatevirtual

Implements skottie::internal::AnimatablePropertyContainer.

Definition at line 166 of file Transform.cpp.

166 {
167 this->node()->setMatrix(this->totalMatrix());
168}

◆ position()

SkV3 skottie::internal::TransformAdapter3D::position ( ) const
protected

Definition at line 174 of file Transform.cpp.

174 {
175 return fPosition;
176}

◆ rotation()

SkV3 skottie::internal::TransformAdapter3D::rotation ( ) const
protected

Definition at line 178 of file Transform.cpp.

178 {
179 // orientation and axis-wise rotation map onto the same property.
180 return static_cast<SkV3>(fOrientation) + SkV3{ fRx, fRy, fRz };
181}
Definition SkM44.h:56

◆ totalMatrix()

SkM44 skottie::internal::TransformAdapter3D::totalMatrix ( ) const
virtual

Reimplemented in skottie::internal::CameraAdaper.

Definition at line 183 of file Transform.cpp.

183 {
184 const auto anchor_point = this->anchor_point(),
185 position = this->position(),
186 scale = static_cast<SkV3>(fScale),
187 rotation = this->rotation();
188
193 * SkM44::Scale(scale.x / 100, scale.y / 100, scale.z / 100)
195}
#define SkDegreesToRadians(degrees)
Definition SkScalar.h:77
static SkM44 Rotate(SkV3 axis, SkScalar radians)
Definition SkM44.h:239
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
Definition SkM44.h:225
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
Definition SkM44.h:232
const Scalar scale
float y
Definition SkM44.h:57
float z
Definition SkM44.h:57
float x
Definition SkM44.h:57

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