[GSoC 2020] Improvements for Lottie Exporter Plugin

May be out of topic, but check at https://wiki.synfig.org/Scale_Layer for its “philosophy”

3 Likes

@rodolforg , Thank you for this detailed explanation :smiley: I was able to implement the scaling using this and in addition got to know about how to calculate the skew angles as well.

2 Likes

Weekly Report - July 27th - August 2nd

  • How was the last week? What did you accomplish?
    Fixed issues arising out of bone_link convert method.
    Added support for dot product convert method.
  • What is the #1 thing slowing you down?
    Finding the method to calculate scale.
  • What do you want to have done by the end of next week?
    Add some more convert methods and start work on shade layer.

– Saurabh(saurabh22)

3 Likes

@rodolforg , I seem to have run into a problem and need your help in figuring out if I have made the correct calculations for this file. test.sif (28.2 KB)

The base transformation for this matrix, with scale (0.933,0.846) and rotation 0°:
M =

0.933    0
  0     0.846

After the bone transformation, it becomes:

1.595    0
0       0.846

^ this is obtained after multiplying first row with local_length_scale which is 1.709 here.

The linear transformation matrices are:
scale: S =

sx  0    =  0.933     0
0   sy   =    0     0.846

rotation: R =

cos(theta)  -sin(theta) = cos(0)   -sin(0)
sin(theta)   cos(theta) = sin(0)    cos(0)

Now M = R*S
Calculating the scale now using magnitude of the columns of this matrix M :

1.595    0
0       0.846

Therefore
sx = square-root(1.595² + 0²) = 1.595
sy = square-root(0² + 0.846²) = 0.846

Converting them to pixels using 1u = 60px :
sx = 1.595 * 60 = 95.72
sy = 0.846 * 60 = 50.76

This scale value that I get is different from the scale value obtained in the Synfig. In Synfig the scale comes to (95.72,53.56).

Can you please point out where I am going wrong in this particular case. I have attached the .sif file in the beginning.

1 Like

Your test file has a skew angle.
But I couldn’t find your values ((95.72,53.56)) in the test file as it is. Where is this scale set?

@saurabh22 could you post the screenshot of the final value, that you showed me

1 Like

@rodolforg ,
Here is the screenshot where the scale comes out to be (95.72,53.56). They are the last two values in the Transformation panel.

I didn’t get you here, does Skew Angle affect scale as well?

1 Like

It changes the rotation matrix (Y-axis).

2 Likes

In this case, how will it affect the theta that is present in the rotation matrix?
I took it as 0 degree(base value angle) and did not include a skew angle in it(misjudging theta that you showed in the matrix as base_value angle only).
Can you tell me what the matrix will look like with theta in terms of base_value angle and skew angle.

1 Like

As far as I could see, it adds the skew angle to rotation angle for the second (row or column) only. The other row/column (the x-axis) uses the rotation angle only.

I say row or column for two reasons:

  • I don’t remember, and
  • I don’t understand clearly XD I think the implementation is a little confuse.
1 Like

@rodolforg , I added the skew angle to the rotation angle for the second column and it gives the correct result now. Thanks for the help :smiley:

2 Likes

@saurabh22
Suppose you have a bone with angle A.

screenshot_008

To scale any object in direction of the bone you can do the following:

  1. Apply rotation -A to align bone with X axis.
  2. Scale along X axis.
  3. Apply rotation A to restore original orientation of bone and object.

I have illustrated this approach in this video:

Please note that origin of rotation and scale should be exactly at origin of a bone.

1 Like

Weekly Report - August 3rd - August 9th

  • How was the last week? What did you accomplish?
    Added support for range product convert method.
    Added support for reciprocal product convert method.
    There were some issues with offset in bone_link, those have been fixed.
    Wrote the code for Shade layer export, waiting for the merge of Blur Layer PR as it needs the structure of the code written in that PR.
  • What is the #1 thing slowing you down?
    Shade layer export for multiple shade layers on one layer. It seems only single shade layer is supported. Issue on Lottie-web
  • What do you want to have done by the end of next week?
    Submit the PR for shade layer and start work on either adding animation to addition deletion of bline points/exporting outlines without variable widths.
    Also planning on starting documentation for the past few weeks.

– Saurabh(saurabh22)

3 Likes

I vote for " exporting outlines without variable widths". :slight_smile:
Keep up the good work!

2 Likes

Weekly Report - August 10th - August 16th

  • How was the last week? What did you accomplish?
    Submitted the PR for Shade Layer and fixed some minor issues in it.
    Added documentation for Shade Layer and Convert methods done in the past few weeks.

  • What is the #1 thing slowing you down?
    Was a bit busy with some college stuff which is why I could not do what I had mentioned for this week. Apologies for that.

  • What do you want to have done by the end of next week?
    Exporting outlines without variable widths.

– Saurabh(saurabh22)

3 Likes

Also, please do not forget about this issue :slight_smile: -

2 Likes

Working on it side-by-side, had a good chat with @AnishG regarding the issues in the PR. Looks like a confusing problem with incorrect offset, working on a fix for it alongside :smiley:

2 Likes

Weekly Report - August 17th - August 23rd

  • How was the last week? What did you accomplish?
    Completed Export for Outlines without variable widths.
    Completed Support for Vector length convert method.
  • What is the #1 thing slowing you down?
    Rotation of bone about a point continues to evade me, All other parameters are working fine but anchoring is not correct, that is why there is a slight offset when bones are rotated. A workaround is to not convert the transformation parameter to bone_link and instead convert the offset to bone_link but that is a very hacky way. Will continue trying to find a solution for the transformation.
  • What do you want to have done by the end of next week?
    Get PRs merged and find a solution for the bone_problem if possible.
    Complete the requirements for final GSoC solution

– Saurabh(saurabh22)

3 Likes