Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More rendering #19

Merged
merged 8 commits into from
Aug 28, 2024
Merged

More rendering #19

merged 8 commits into from
Aug 28, 2024

Conversation

mbasaglia
Copy link
Member

No description provided.

@mbasaglia
Copy link
Member Author

@fmalita I've added some elements from https://github.com/lottie-animation-community/docs/blob/main/Lottie_Rendering_Model.md regarding the stacking context. I'm not entirely sure the wording is correct though.

docs/specs/helpers.md Outdated Show resolved Hide resolved
Comment on lines 58 to 59
Assuming a transform matrix with the following layout, with the labels equivalent to the
[CSS matrix transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know you mentioned there is a reason for using transposed notation, and there is no "right" answer, but it does read a bit weird to me mostly because I'm so used to the row-major approach. It also diverges from the other common specs and literature:

https://en.wikipedia.org/wiki/Transformation_matrix#Affine_transformations
https://drafts.csswg.org/css-transforms/#MatrixDefined
https://www.w3.org/TR/SVG11/coords.html#EstablishingANewUserSpace

We should be able to stick to the same convention, and just invert the defined order or operations, no?

$$CTM = Translate(position) \times Rotate(rotation) \times Skew(sa, sk) \times Scale(scale) \times Translate(-anchor)$$

(FWIW, LottieAndroid and Skottie use this aproach while LottieWeb seems to use the transposed convention)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is what I mentioned in the call, I used the transposed version to have left multiplication

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"left multiplication" - you mean when mapping a point/vector (row vector vs column vector)

$$V' = \begin{pmatrix}x & y & 0 & 1\end{pmatrix} \times T$$

vs

$$V' = T \times \begin{pmatrix} x \\ y \\ 0 \\ 1 \end{pmatrix}$$

?

I don't think either of them is inherently superior, but there is an argument for the latter: consistency with other specs, especially since we are referencing them explicitly. I would find it confusing to read the CSS spec and then have to transpose everything and reverse the order when dealing with Lottie.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's more for composition, if the order of operations is Rotation then Translation, with left multiplication you can do RotMat x TransMat, otherwise you need to do TransMat x RotMat

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've kept the left multiplied version but added a note on the right multiplied matrix as well

docs/specs/helpers.md Outdated Show resolved Hide resolved
docs/specs/helpers.md Outdated Show resolved Hide resolved
Comment on lines 58 to 59
Assuming a transform matrix with the following layout, with the labels equivalent to the
[CSS matrix transform](https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/matrix):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"left multiplication" - you mean when mapping a point/vector (row vector vs column vector)

$$V' = \begin{pmatrix}x & y & 0 & 1\end{pmatrix} \times T$$

vs

$$V' = T \times \begin{pmatrix} x \\ y \\ 0 \\ 1 \end{pmatrix}$$

?

I don't think either of them is inherently superior, but there is an argument for the latter: consistency with other specs, especially since we are referencing them explicitly. I would find it confusing to read the CSS spec and then have to transpose everything and reverse the order when dealing with Lottie.

docs/specs/glossary.md Show resolved Hide resolved
@mbasaglia mbasaglia added this to the 1.0 milestone Aug 20, 2024
@mbasaglia mbasaglia marked this pull request as ready for review August 27, 2024 12:26
@mbasaglia mbasaglia requested a review from Aidosmf August 27, 2024 16:10
@mbasaglia mbasaglia linked an issue Aug 27, 2024 that may be closed by this pull request
@mbasaglia mbasaglia merged commit 011aa98 into lottie:main Aug 28, 2024
3 checks passed
b-wils pushed a commit to b-wils/lottie-spec that referenced this pull request Nov 25, 2024
* Transforms and coordiates

* Auto-link glossary items

* Add wording related to the render stack

* Fix build

* 3x3 Matrices

* Explain transforms a bit better

* Mention untransformed (0, 0)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Drawing coordinates and Transform
4 participants