mirror of
https://github.com/bitcoinj/bitcoinj.git
synced 2025-03-10 09:20:04 +01:00
EasingInterpolator: use switch expression
This commit is contained in:
parent
9e9d3afd6a
commit
7a30041578
1 changed files with 8 additions and 14 deletions
|
@ -98,19 +98,13 @@ public abstract class EasingInterpolator extends Interpolator {
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
protected final double curve(final double v) {
|
protected final double curve(final double v) {
|
||||||
switch (easingMode.get()) {
|
return switch (easingMode.get()) {
|
||||||
case EASE_IN:
|
case EASE_IN -> baseCurve(v);
|
||||||
return baseCurve(v);
|
case EASE_OUT -> 1 - baseCurve(1 - v);
|
||||||
case EASE_OUT:
|
case EASE_BOTH -> (v <= 0.5)
|
||||||
return 1 - baseCurve(1 - v);
|
? baseCurve(2 * v) / 2
|
||||||
case EASE_BOTH:
|
: (2 - baseCurve(2 * (1 - v))) / 2;
|
||||||
if (v <= 0.5) {
|
default -> baseCurve(v);
|
||||||
return baseCurve(2 * v) / 2;
|
};
|
||||||
} else {
|
|
||||||
return (2 - baseCurve(2 * (1 - v))) / 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
return baseCurve(v);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue