animation: write a const Animation::new()
This commit is contained in:
@@ -53,7 +53,14 @@ impl<S: Surface> AnimationActor for AnimatedSurface<S> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl Animation {
|
impl Animation {
|
||||||
pub fn from(self, from: u8) -> Self {
|
pub const fn new() -> Self {
|
||||||
|
Self {
|
||||||
|
from: None,
|
||||||
|
to: None,
|
||||||
|
duration: Duration::from_ticks(0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pub const fn from(self, from: u8) -> Self {
|
||||||
Self {
|
Self {
|
||||||
from: Some(from),
|
from: Some(from),
|
||||||
to: self.to,
|
to: self.to,
|
||||||
@@ -61,7 +68,7 @@ impl Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn to(self, to: u8) -> Self {
|
pub const fn to(self, to: u8) -> Self {
|
||||||
Self {
|
Self {
|
||||||
from: self.from,
|
from: self.from,
|
||||||
to: Some(to),
|
to: Some(to),
|
||||||
@@ -69,7 +76,7 @@ impl Animation {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn duration(self, duration: Duration) -> Self {
|
pub const fn duration(self, duration: Duration) -> Self {
|
||||||
Self {
|
Self {
|
||||||
from: self.from,
|
from: self.from,
|
||||||
to: self.to,
|
to: self.to,
|
||||||
|
|||||||
Reference in New Issue
Block a user