Rewrite interpolate() in terms of a more general add_weighted() function

Generalizing the procedure like this will allow us to re-use it for addition of
most types.
This commit is contained in:
Brian Birtles 2017-05-15 12:26:21 +09:00
parent 8366b4d4f9
commit 2f07b29296
7 changed files with 261 additions and 200 deletions

View file

@ -129,7 +129,8 @@ macro_rules! define_keyword_type {
impl Animatable for $name {
#[inline]
fn interpolate(&self, _other: &Self, _progress: f64) -> Result<Self, ()> {
fn add_weighted(&self, _other: &Self, _self_progress: f64, _other_progress: f64)
-> Result<Self, ()> {
Ok($name)
}
}