jlmakes / rematrix

Matrix transformations made easy.
https://rematrix.now.sh/
MIT License
430 stars 13 forks source link

Linearly interpolating between two matrixes #19

Open MarcGuiselin opened 2 years ago

MarcGuiselin commented 2 years ago

Animating transforms requires computing intermediary states at arbitrary intervals between two transforms.

I propose the addition of a interpolate(from, to, progress)

MarcGuiselin commented 2 years ago

There are several ways to linearly interpolate between two transformation matrixes. However, in order to match the behavior of browsers (and produce no weird deformations), the matrix must be decomposed into scale, skew, translation, perspective and quaternion rotation. This is called polar decomposition. Then we can linearly interpolate between those and compose a new matrix... no small feat.

See:

jlmakes commented 1 year ago

This sounds freaking awesome @MarcGuiselin, I appreciate the feature request and resources.