Skip to main content

Transform

Transform is the low-level matrix-transform wrapper.

It applies a raw 4x4 transform matrix to one child. This is useful when you already have matrix math from another part of the system and want to feed that matrix directly into the widget tree.

Most app authors should not reach for Transform first. If you want common presentation effects such as opacity, translation, scale, or rotation, Composite is usually easier to read and easier to animate.

Example

use fission::core::ui::{Text, Transform};

let matrix = [
1.0, 0.0, 0.0, 12.0,
0.0, 1.0, 0.0, 0.0,
0.0, 0.0, 1.0, 0.0,
0.0, 0.0, 0.0, 1.0,
];

let node = Transform::new(
Text::new("Translated visually").into_node(),
matrix,
)
.into_node();

Field table

FieldTypeMeaningNotes / default behavior
idOption<NodeId>Stable node identity.Defaults to None.
transform[f32; 16]Raw 4x4 transform matrix.Defaults to the identity matrix.
childBox<Node>The transformed child.Required. Default uses an empty spacer child.

Behavior and advice

Transform forwards the same layout constraints to its child and applies the matrix as a visual transform. Like Composite, it does not relayout siblings around the transformed result.

That makes it appropriate for advanced rendering flows, but also easier to misuse than higher-level helpers. If the transformation is really part of layout rather than presentation, change the layout tree instead.

Specific advice

Prefer Composite unless you already need raw matrix control. Matrix-heavy code is harder for teammates to scan, so it is worth paying that complexity cost only when it buys something real.

Composite, Clip, and Container.