Transform Builder
Transform Builder is used to set declarative Transform2D for views. It affects view itself and its child views' drawing and hit testing, but doesn't change position and size calculated by Taffy layout.
Basic Writing
After importing TransformBuilder, all views implementing View can call .transform(...).
Current signature is:
TransformProp supports two writing styles:
Dynamic Transform
Closure version will recalculate transform when dependencies update.
rotate_at_degrees(degrees, cx, cy) and scale_at(sx, sy, cx, cy) can express effect similar to transform-origin. Flor currently doesn't have separate .origin(...) builder.
Transform2D Common Constructors
Chain combination uses then_* methods:
Combination order is first apply current matrix, then apply new matrix. That is, above example will first translate, then rotate, finally scale.
Not CSS transform String
.transform(...) receives Transform2D, not string. Currently doesn't have these builder methods:
Corresponding writing should change to:
Mechanism Explanation
.transform(...) will create a reactive updater. During initialization will immediately calculate Transform2D once, and call current view's ViewId::set_transform(transform); afterwards when signal depended by closure updates, will write new transform again and request redraw.
Runtime transform is stored in VIEW_STORAGE.transform. Layout refresh phase will calculate accumulated transform, drawing phase will push_transform, hit testing will use inverse matrix to convert window coordinates back to view local coordinates.
If matrix is non-invertible, for example scale to 0.0, hit testing cannot convert window coordinates back to local coordinates, this view branch will be skipped. In animation don't scale interactive views to non-invertible matrix.

