Support interpolating transform View property

Summary:
For Fabric LayoutAnimations, we need to support interpolating the Transform property (which really ends up just being interpolation of ScaleX, ScaleY, or ScaleXY transforms - not arbitrary matrices).

To support that, we need to be able to convert Transform back to folly::dynamic, and on the Java side we need to support accepting arbitrary matrices instead of transform maps of properties.

Changelog: [Internal] Fabric-only changes

Reviewed By: sammy-SC

Differential Revision: D21564590

fbshipit-source-id: b137f659b27e4b8fae83921a28ccf46035e18651
This commit is contained in:
Joshua Gross
2020-05-14 12:38:00 -07:00
committed by Facebook GitHub Bot
parent a7bbc858c5
commit eb12cb5bbc
4 changed files with 78 additions and 4 deletions
@@ -48,6 +48,17 @@ public class TransformHelper {
double[] helperMatrix = sHelperMatrix.get();
MatrixMathHelper.resetIdentityMatrix(result);
// If the transforms array is actually just the matrix itself,
// copy that directly. This is for Fabric LayoutAnimations support.
// All of the stuff this Java helper does is already done in C++ in Fabric, so we
// can just use that matrix directly.
if (transforms.getType(0) == ReadableType.Number && transforms.size() == 16) {
for (int i = 0; i < transforms.size(); i++) {
result[i] = transforms.getDouble(i);
}
return;
}
for (int transformIdx = 0, size = transforms.size(); transformIdx < size; transformIdx++) {
ReadableMap transform = transforms.getMap(transformIdx);
String transformType = transform.keySetIterator().nextKey();