--- /dev/null
+{"v":"5.2.1","fr":60,"ip":0,"op":60,"w":500,"h":500,"nm":"Comp 1","ddd":0,"assets":[],"layers":[{"ddd":0,"ind":1,"ty":4,"nm":"Shape Layer 2","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":0,"k":[250,250,0],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":0,"shapes":[{"ty":"rc","d":1,"s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ind":2,"ty":"sh","ix":3,"ks":{"a":0,"k":{"i":[[-89.47,0],[0,-89.47],[89.47,0],[0,89.47]],"o":[[89.47,0],[0,89.47],[-89.47,0],[0,-89.47]],"v":[[0,-162],[162,0],[0,162],[-162,0]],"c":true},"ix":2},"nm":"Path 1","mn":"ADBE Vector Shape - Group","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":60,"st":0,"bm":0},{"ddd":0,"ind":2,"ty":4,"nm":"Shape Layer 1","sr":1,"ks":{"o":{"a":0,"k":100,"ix":11},"r":{"a":0,"k":0,"ix":10},"p":{"a":1,"k":[{"i":{"x":0.562,"y":0.562},"o":{"x":0.167,"y":0.167},"n":"0p562_0p562_0p167_0p167","t":8,"s":[250,88,0],"e":[412,250,0],"to":[89.4701232910156,0,0],"ti":[0,-89.4701232910156,0]},{"i":{"x":0.656,"y":0.656},"o":{"x":0.311,"y":0.311},"n":"0p656_0p656_0p311_0p311","t":38,"s":[412,250,0],"e":[250,412,0],"to":[0,89.4701232910156,0],"ti":[89.4701232910156,0,0]},{"i":{"x":0.689,"y":0.689},"o":{"x":0.343,"y":0.343},"n":"0p689_0p689_0p343_0p343","t":68,"s":[250,412,0],"e":[88,250,0],"to":[-89.4701232910156,0,0],"ti":[0,89.4701232910156,0]},{"i":{"x":0.833,"y":0.833},"o":{"x":0.437,"y":0.437},"n":"0p833_0p833_0p437_0p437","t":98,"s":[88,250,0],"e":[250,88,0],"to":[0,-89.4701232910156,0],"ti":[-89.4701232910156,0,0]},{"t":128}],"ix":2},"a":{"a":0,"k":[0,0,0],"ix":1},"s":{"a":0,"k":[100,100,100],"ix":6}},"ao":1,"shapes":[{"ty":"rc","d":1,"s":{"a":0,"k":[100,100],"ix":2},"p":{"a":0,"k":[0,0],"ix":3},"r":{"a":0,"k":0,"ix":4},"nm":"Rectangle Path 1","mn":"ADBE Vector Shape - Rect","hd":false},{"ty":"fl","c":{"a":0,"k":[1,0,0,1],"ix":4},"o":{"a":0,"k":100,"ix":5},"r":1,"nm":"Fill 1","mn":"ADBE Vector Graphic - Fill","hd":false},{"ty":"st","c":{"a":0,"k":[1,1,1,1],"ix":3},"o":{"a":0,"k":100,"ix":4},"w":{"a":0,"k":2,"ix":5},"lc":1,"lj":1,"ml":4,"ml2":{"a":0,"k":4,"ix":8},"nm":"Stroke 1","mn":"ADBE Vector Graphic - Stroke","hd":false}],"ip":0,"op":60,"st":0,"bm":0}],"markers":[]}
\ No newline at end of file
T value(float t) const {
return lerp(mStartValue, mEndValue, t);
}
+ float angle(float ) const { return 0;}
};
template <>
return lerp(mStartValue, mEndValue, t);
}
}
+
+ float angle(float t) const {
+ if (mPathKeyFrame) {
+ VBezier b = VBezier::fromPoints(mStartValue, mStartValue + mOutTangent,
+ mEndValue + mInTangent, mEndValue);
+ return b.angleAt(b.tAtLength(t * b.length()));
+ }
+ return 0;
+ }
};
class LOTKeyFrame
{
public:
+ float progress(int frameNo) const {
+ return mInterpolator->value((frameNo - mStartFrame) / (mEndFrame - mStartFrame));
+ }
T value(int frameNo) const {
- float progress = mInterpolator->value((frameNo - mStartFrame) / (mEndFrame - mStartFrame));
- return mValue.value(progress);
+ return mValue.value(progress(frameNo));
+ }
+ float angle(int frameNo) const {
+ return mValue.angle(progress(frameNo));
}
public:
if(mKeyFrames.back().mEndFrame <= frameNo)
return mKeyFrames.back().mValue.mEndValue;
- for(auto keyFrame : mKeyFrames) {
+ for(const auto &keyFrame : mKeyFrames) {
if (frameNo >= keyFrame.mStartFrame && frameNo < keyFrame.mEndFrame)
return keyFrame.value(frameNo);
}
return T();
}
+
+ float angle(int frameNo) const {
+ if ((mKeyFrames.front().mStartFrame >= frameNo) ||
+ (mKeyFrames.back().mEndFrame <= frameNo) )
+ return 0;
+
+ for(const auto &keyFrame : mKeyFrames) {
+ if (frameNo >= keyFrame.mStartFrame && frameNo < keyFrame.mEndFrame)
+ return keyFrame.angle(frameNo);
+ }
+ return 0;
+ }
+
public:
std::vector<LOTKeyFrame<T>> mKeyFrames;
};
LOTAnimatable():mValue(),mAnimInfo(nullptr){}
LOTAnimatable(const T &value): mValue(value){}
bool isStatic() const {if (mAnimInfo) return false; else return true;}
- T value(int frameNo) const{
- if (isStatic())
- return mValue;
- else
- return mAnimInfo->value(frameNo);
+ T value(int frameNo) const {
+ return isStatic() ? mValue : mAnimInfo->value(frameNo);
+ }
+ float angle(int frameNo) const {
+ return isStatic() ? 0 : mAnimInfo->angle(frameNo);
}
public:
- T mValue;
- int mPropertyIndex; /* "ix" */
+ T mValue;
+ int mPropertyIndex; /* "ix" */
std::unique_ptr<LOTAnimInfo<T>> mAnimInfo;
};
{
public:
LOTTransformData():LOTData(LOTData::Type::Transform),mScale({100, 100}){}
- VMatrix matrix(int frameNo) const;
+ VMatrix matrix(int frameNo, bool autoOrient = false) const;
float opacity(int frameNo) const;
void cacheMatrix();
bool staticMatrix() const {return mStaticMatrix;}
private:
- VMatrix computeMatrix(int frameNo) const;
+ VMatrix computeMatrix(int frameNo, bool autoOrient = false) const;
public:
LOTAnimatable<float> mRotation{0}; /* "r" */
LOTAnimatable<VPointF> mScale; /* "s" */