mirror of
https://github.com/danbulant/cushy
synced 2026-05-27 05:42:43 +00:00
28 lines
817 B
Text
28 lines
817 B
Text
---
|
|
source: gooey-macros/src/animation.rs
|
|
expression: unparse(ok)
|
|
---
|
|
impl ::gooey::animation::LinearInterpolate for Enum {
|
|
/**# Panics
|
|
Panics if the the enum variants are overflown (this can only happen on percentages outside 0..1 range).*/
|
|
fn lerp(&self, __target: &Self, __percent: f32) -> Self {
|
|
fn variant_to_index(__v: &Enum) -> usize {
|
|
match __v {
|
|
Enum::A => 0usize,
|
|
Enum::B => 1usize,
|
|
}
|
|
}
|
|
let __self = variant_to_index(&self);
|
|
let __target = variant_to_index(&self);
|
|
match ::gooey::animation::LinearInterpolate::lerp(
|
|
&__self,
|
|
&__target,
|
|
__percent,
|
|
) {
|
|
0usize => Enum::A,
|
|
1usize => Enum::B,
|
|
_ => Enum::B,
|
|
}
|
|
}
|
|
}
|
|
|