I am trying to figure out manually, the point
p at which the layer will be present at a given time
t. Consider I have a
star layer and it’s origin is animated from
(0, 0) to
(60, 0). The interpolation type is
linear. So according to the
Synfig code, the
out-tangent both will be equal to
60. But these needs to be scaled by a factor of 3.
So finally, to calculate the
hermite curve, we need 4 control points(link).
So, for the hermite curve of
P0 = 0
P1 = 60/3 = 20
P2 = 60/3 = 20
P3 = 60
Hence the curve will be written as:
P(t) = (1 - t)3 * 0 + 3(1 - t)2t * 20 + 3(1-t)t2 * 20 + t3 * 60
where 0 < t < 1
Let us take
t = 0.5:
P(0.5) = 22.5
This is the answer we get after evaluating the curve. But intuitively and also the value at t = 0.5 in
Synfig UI is
Could anyone explain where am I wrong here, or where am I making the mistake. I have been stuck on this for quite a while. Any help would be much appreciated!
I am attaching the
.sif file here: star_check.sif (2.8 KB)
One more view regarding the above:
When the interpolation type is
linear or when the interpolation is
TCB but it is on the first waypoint(link), does Synfig still use the hermite curve to evaluate the expression?
I could not find anything else than hermite curve being used… Am I missing somewhere to look?
@blackwarthog pointed, that Synfig uses Hermite curve, described here - https://www.cubic.org/docs/hermite.htm
The formula is:
x = ( 2*t*t*t - 3*t*t + 1 )*p0
+ ( t*t*t - 2*t*t + t )*p1
+ ( t*t*t - t*t )*p2
+ (-2*t*t*t + 3*t*t )*p3
p3 - spline points;
p2 - tangents.
t = 1/2:
x = ( 2/8 - 3/4 + 1 )*p0
+ ( 1/8 - 2/4 + 1/2)*p1
+ ( 1/8 - 1/4 )*p2
+ (-2/8 + 3/4 )*p3
p0 = 0, p1 = 20, p2 = 20, p3 = 60:
x = ( 2/8 - 3/4 + 1 )*0
+ ( 1/8 - 2/4 + 1/2)*20
+ ( 1/8 - 1/4 )*20
+ (-2/8 + 3/4 )*60
x = 20*8 - 20/8 + 60/2 = 30
Thanks a lot @blackwarthog and @KonstantinDmitriev!
Now things are getting much clear than before. I guess now interpolation in the
lottie-exporter will be much more similar to that of
Synfig's actual interpolation. As I was using bezier curves before.