Skip to content

Commit

Permalink
Added lerping for all variants of Val (#127)
Browse files Browse the repository at this point in the history
  • Loading branch information
SenneDeVocht authored Dec 10, 2024
1 parent 6607f9c commit b99332f
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/lens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -298,6 +298,10 @@ fn lerp_val(start: &Val, end: &Val, ratio: f32) -> Val {
Val::Percent((end - start).mul_add(ratio, *start))
}
(Val::Px(start), Val::Px(end)) => Val::Px((end - start).mul_add(ratio, *start)),
(Val::Vw(start), Val::Vw(end)) => Val::Vw((end - start).mul_add(ratio, *start)),
(Val::Vh(start), Val::Vh(end)) => Val::Vh((end - start).mul_add(ratio, *start)),
(Val::VMin(start), Val::VMin(end)) => Val::VMin((end - start).mul_add(ratio, *start)),
(Val::VMax(start), Val::VMax(end)) => Val::VMax((end - start).mul_add(ratio, *start)),
_ => *start,
}
}
Expand Down

0 comments on commit b99332f

Please sign in to comment.