pub struct Transform {
pub tx: f64,
pub ty: f64,
pub sx: f64,
pub sy: f64,
pub rotate_deg: f64,
pub anchor_x: f64,
pub anchor_y: f64,
}Expand description
A cheap per-node visual transform (§8.4 animation): translation, uniform/non-uniform scale, and
rotation about a unit anchor (0.0..1.0 within the node’s bounds; default center). Distinct
from the layout frame — animating a Transform never triggers relayout, so it is the vehicle
for movement/scaling animation. Each backend composes it onto the node’s laid-out frame via its
native transform channel (CALayer/GskTransform/RenderTransform/NODE_TRANSFORM/…).
Fields§
§tx: f64§ty: f64§sx: f64§sy: f64§rotate_deg: f64§anchor_x: f64Anchor for scale/rotation as a unit fraction of the node’s bounds (0.5,0.5 = center).
anchor_y: f64Implementations§
Source§impl Transform
impl Transform
pub const IDENTITY: Transform
pub const fn translate(tx: f64, ty: f64) -> Transform
pub const fn scale(sx: f64, sy: f64) -> Transform
pub const fn rotate(deg: f64) -> Transform
Sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Whether this transform has no visual effect — backends skip applying it.
Trait Implementations§
impl Copy for Transform
impl StructuralPartialEq for Transform
Auto Trait Implementations§
impl Freeze for Transform
impl RefUnwindSafe for Transform
impl Send for Transform
impl Sync for Transform
impl Unpin for Transform
impl UnsafeUnpin for Transform
impl UnwindSafe for Transform
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more