Rabbit-R1/switch port/java/sources/androidx/compose/animation/AndroidFlingSpline.java
2024-05-21 17:08:36 -04:00

113 lines
5.9 KiB
Java

package androidx.compose.animation;
import kotlin.Metadata;
/* compiled from: SplineBasedDecay.kt */
@Metadata(d1 = {"\u00000\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u0014\n\u0002\b\u0002\n\u0002\u0010\u0006\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0002\b\u0003\\u0002\u0018\u00002\u00020\u0001:\u0001\u0010B\u0007\b\u0002¢\u0006\u0002\u0010\u0002J\u0016\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\u000b2\u0006\u0010\f\u001a\u00020\u000bJ\u000e\u0010\r\u001a\u00020\u000e2\u0006\u0010\u000f\u001a\u00020\u000bR\u000e\u0010\u0003\u001a\u00020\u0004X\u0082T¢\u0006\u0002\n\u0000R\u000e\u0010\u0005\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000R\u000e\u0010\u0007\u001a\u00020\u0006X\u0082\u0004¢\u0006\u0002\n\u0000¨\u0006\u0011"}, d2 = {"Landroidx/compose/animation/AndroidFlingSpline;", "", "()V", "NbSamples", "", "SplinePositions", "", "SplineTimes", "deceleration", "", "velocity", "", "friction", "flingPosition", "Landroidx/compose/animation/AndroidFlingSpline$FlingResult;", "time", "FlingResult", "animation_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class AndroidFlingSpline {
public static final AndroidFlingSpline INSTANCE = new AndroidFlingSpline();
private static final int NbSamples = 100;
private static final float[] SplinePositions;
private static final float[] SplineTimes;
private AndroidFlingSpline() {
}
static {
float[] fArr = new float[101];
SplinePositions = fArr;
float[] fArr2 = new float[101];
SplineTimes = fArr2;
SplineBasedDecayKt.computeSplineInfo(fArr, fArr2, 100);
}
public final FlingResult flingPosition(float time) {
float f;
float f2;
float f3 = 100;
int i = (int) (f3 * time);
if (i < 100) {
float f4 = i / f3;
int i2 = i + 1;
float f5 = i2 / f3;
float[] fArr = SplinePositions;
float f6 = fArr[i];
f2 = (fArr[i2] - f6) / (f5 - f4);
f = f6 + ((time - f4) * f2);
} else {
f = 1.0f;
f2 = 0.0f;
}
return new FlingResult(f, f2);
}
public final double deceleration(float velocity, float friction) {
return Math.log((Math.abs(velocity) * 0.35f) / friction);
}
/* compiled from: SplineBasedDecay.kt */
@Metadata(d1 = {"\u0000&\n\u0002\u0018\u0002\n\u0002\u0010\u0000\n\u0000\n\u0002\u0010\u0007\n\u0002\b\t\n\u0002\u0010\u000b\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0010\u000e\n\u0000\b\u0087\b\u0018\u00002\u00020\u0001B\u0015\u0012\u0006\u0010\u0002\u001a\u00020\u0003\u0012\u0006\u0010\u0004\u001a\u00020\u0003¢\u0006\u0002\u0010\u0005J\t\u0010\t\u001a\u00020\u0003HÆ\u0003J\t\u0010\n\u001a\u00020\u0003HÆ\u0003J\u001d\u0010\u000b\u001a\u00020\u00002\b\b\u0002\u0010\u0002\u001a\u00020\u00032\b\b\u0002\u0010\u0004\u001a\u00020\u0003HÆ\u0001J\u0013\u0010\f\u001a\u00020\r2\b\u0010\u000e\u001a\u0004\u0018\u00010\u0001HÖ\u0003J\t\u0010\u000f\u001a\u00020\u0010HÖ\u0001J\t\u0010\u0011\u001a\u00020\u0012HÖ\u0001R\u0011\u0010\u0002\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\u0006\u0010\u0007R\u0011\u0010\u0004\u001a\u00020\u0003¢\u0006\b\n\u0000\u001a\u0004\b\b\u0010\u0007¨\u0006\u0013"}, d2 = {"Landroidx/compose/animation/AndroidFlingSpline$FlingResult;", "", "distanceCoefficient", "", "velocityCoefficient", "(FF)V", "getDistanceCoefficient", "()F", "getVelocityCoefficient", "component1", "component2", "copy", "equals", "", "other", "hashCode", "", "toString", "", "animation_release"}, k = 1, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public static final /* data */ class FlingResult {
public static final int $stable = 0;
private final float distanceCoefficient;
private final float velocityCoefficient;
public static /* synthetic */ FlingResult copy$default(FlingResult flingResult, float f, float f2, int i, Object obj) {
if ((i & 1) != 0) {
f = flingResult.distanceCoefficient;
}
if ((i & 2) != 0) {
f2 = flingResult.velocityCoefficient;
}
return flingResult.copy(f, f2);
}
/* renamed from: component1, reason: from getter */
public final float getDistanceCoefficient() {
return this.distanceCoefficient;
}
/* renamed from: component2, reason: from getter */
public final float getVelocityCoefficient() {
return this.velocityCoefficient;
}
public final FlingResult copy(float distanceCoefficient, float velocityCoefficient) {
return new FlingResult(distanceCoefficient, velocityCoefficient);
}
public boolean equals(Object other) {
if (this == other) {
return true;
}
if (!(other instanceof FlingResult)) {
return false;
}
FlingResult flingResult = (FlingResult) other;
return Float.compare(this.distanceCoefficient, flingResult.distanceCoefficient) == 0 && Float.compare(this.velocityCoefficient, flingResult.velocityCoefficient) == 0;
}
public final float getDistanceCoefficient() {
return this.distanceCoefficient;
}
public final float getVelocityCoefficient() {
return this.velocityCoefficient;
}
public int hashCode() {
return (Float.hashCode(this.distanceCoefficient) * 31) + Float.hashCode(this.velocityCoefficient);
}
public String toString() {
return "FlingResult(distanceCoefficient=" + this.distanceCoefficient + ", velocityCoefficient=" + this.velocityCoefficient + ')';
}
public FlingResult(float f, float f2) {
this.distanceCoefficient = f;
this.velocityCoefficient = f2;
}
}
}