33 this->
bind(abuilder, janchor_point, fAnchorPoint);
34 this->
bind(abuilder, jscale , fScale);
35 this->
bind(abuilder, jrotation , fRotation);
36 this->
bind(abuilder, jskew , fSkew);
37 this->
bind(abuilder, jskew_axis , fSkewAxis);
45void TransformAdapter2D::onSync() {
50 auto skew_matrix = [](
float sk,
float sa) {
54 static constexpr float kMaxSkewAngle = 85;
67 * skew_matrix (fSkew, fSkewAxis)
73 return { fAnchorPoint.
x, fAnchorPoint.
y };
77 fAnchorPoint = { ap.
x(), ap.
y() };
82 return { fPosition.
x, fPosition.
y };
86 fPosition = {
p.x(),
p.y() };
91 return { fScale.
x, fScale.
y };
95 fScale = {
s.
x(),
s.
y() };
116 bool auto_orient)
const {
117 const auto* jrotation = &jtransform[
"r"];
120 jrotation = &jtransform[
"rz"];
135 if (adapter->isStatic()) {
136 if (!dispatched && adapter->totalMatrix().isIdentity()) {
142 fCurrentAnimatorScope->push_back(adapter);
152 this->
bind(abuilder, jtransform[
"a"], fAnchorPoint);
153 this->
bind(abuilder, jtransform[
"p"], fPosition);
154 this->
bind(abuilder, jtransform[
"s"], fScale);
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);
166void TransformAdapter3D::onSync() {
180 return static_cast<SkV3>(fOrientation) +
SkV3{ fRx, fRy, fRz };
203 if (adapter->isStatic()) {
205 if (adapter->totalMatrix() ==
SkM44()) {
211 fCurrentAnimatorScope->push_back(adapter);
#define SkDegreesToRadians(degrees)
static constexpr const T & SkTPin(const T &x, const T &lo, const T &hi)
static SkM44 Rotate(SkV3 axis, SkScalar radians)
static SkM44 Translate(SkScalar x, SkScalar y, SkScalar z=0)
static SkM44 Scale(SkScalar x, SkScalar y, SkScalar z=1)
static SkMatrix Scale(SkScalar sx, SkScalar sy)
static SkMatrix RotateDeg(SkScalar deg)
static SkMatrix RotateRad(SkScalar rad)
static SkMatrix Translate(SkScalar dx, SkScalar dy)
static const SkMatrix & I()
static SkMatrix Skew(SkScalar kx, SkScalar ky)
bool bindAutoOrientable(const AnimationBuilder &abuilder, const skjson::ObjectValue *jobject, SkV2 *v, float *orientation)
bool bind(const AnimationBuilder &, const skjson::ObjectValue *, T *)
void sk_sp< sksg::Transform > attachMatrix2D(const skjson::ObjectValue &, sk_sp< sksg::Transform >, bool auto_orient=false) const
bool dispatchTransformProperty(const sk_sp< TransformAdapter2D > &) const
sk_sp< sksg::Transform > attachMatrix3D(const skjson::ObjectValue &, sk_sp< sksg::Transform >, bool auto_orient=false) const
const sk_sp< sksg::Matrix< SkMatrix > > & node() const
static sk_sp< TransformAdapter2D > Make(Args &&... args)
SK_API sk_sp< SkDocument > Make(SkWStream *dst, const SkSerialProcs *=nullptr, std::function< void(const SkPicture *)> onEndPage=nullptr)
SK_API sk_sp< PrecompileColorFilter > Matrix()
constexpr float y() const
constexpr float x() const