pub struct Transform {
pub uuid: Uuid,
pub parent: Option<Uuid>,
pub position: Vec3,
pub rotation: f32,
pub scale: Vec2,
}Expand description
The transform of an object, containing its position, rotation, and scale.
Fields§
§uuid: UuidUnique identifier for this transform
parent: Option<Uuid>Optional parent transform UUID for hierarchical transforms
position: Vec33D position of the object (z is used for draw ordering)
rotation: f32Rotation of the object in degrees
scale: Vec2Uniform or nonuniform scale of the object
Implementations§
Source§impl Transform
impl Transform
Sourcepub fn new(position: Vec3) -> Self
pub fn new(position: Vec3) -> Self
Create a new transform at the given position. A random UUID is generated for identification.
Sourcepub const fn with_parent(self, parent: Uuid) -> Self
pub const fn with_parent(self, parent: Uuid) -> Self
Set the parent of this transform
Sourcepub const fn position(&self) -> PositionBuilder
pub const fn position(&self) -> PositionBuilder
Returns a builder for an animation that moves this object to a new position.
transform.position()
.to(Vec2::new(100.0, 200.0))
.over(5.s())
.ease(Ease::InOutCubic),Sourcepub const fn scale(&self) -> ScaleBuilder
pub const fn scale(&self) -> ScaleBuilder
Returns a builder for an animation that scales this object.
transform.scale()
.to(Vec2::new(2.0, 2.0))
.over(5.s())
.ease(Ease::InOutCubic),Sourcepub const fn rotation(&self) -> RotateBuilder
pub const fn rotation(&self) -> RotateBuilder
Returns a builder for an animation that rotates this object.
transform.rotation()
.to(360.0)
.over(5.s())
.ease(Ease::InOutCubic),Trait Implementations§
Source§impl<'de> Deserialize<'de> for Transform
impl<'de> Deserialize<'de> for Transform
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
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