pub enum Transform {
Affine2D(Affine2D),
Mat4(Mat4),
}Expand description
Unified transform that can represent 2D or 3D transformations
Variants§
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn scale(sx: f32, sy: f32) -> Self
pub fn scale(sx: f32, sy: f32) -> Self
Create a 2D scale around the origin (0, 0)
Note: This scales around the top-left corner. For centered scaling,
use scale_centered() instead.
Sourcepub fn scale_centered(sx: f32, sy: f32, center_x: f32, center_y: f32) -> Self
pub fn scale_centered(sx: f32, sy: f32, center_x: f32, center_y: f32) -> Self
Create a 2D scale centered around a specific point
This creates a transform that:
- Translates the center point to the origin
- Applies the scale
- Translates back
This results in scaling that appears to grow/shrink from the center point.
Sourcepub fn rotate(angle: f32) -> Self
pub fn rotate(angle: f32) -> Self
Create a 2D rotation around the origin (0, 0)
Note: This rotates around the top-left corner. For centered rotation,
use rotate_centered() instead.
Sourcepub fn rotate_centered(angle: f32, center_x: f32, center_y: f32) -> Self
pub fn rotate_centered(angle: f32, center_x: f32, center_y: f32) -> Self
Create a 2D rotation centered around a specific point
This creates a transform that:
- Translates the center point to the origin
- Applies the rotation
- Translates back
Sourcepub fn translate_3d(x: f32, y: f32, z: f32) -> Self
pub fn translate_3d(x: f32, y: f32, z: f32) -> Self
Create a 3D translation
Trait Implementations§
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