Rabbit-R1/switch port/java/sources/androidx/compose/animation/SplineBasedDecayKt.java

78 lines
3.7 KiB
Java
Raw Normal View History

2024-05-21 21:08:36 +00:00
package androidx.compose.animation;
import androidx.compose.animation.core.DecayAnimationSpec;
import androidx.compose.animation.core.DecayAnimationSpecKt;
import androidx.compose.ui.unit.Density;
import androidx.exifinterface.media.ExifInterface;
import kotlin.Metadata;
import kotlin.jvm.internal.Intrinsics;
/* compiled from: SplineBasedDecay.kt */
@Metadata(d1 = {"\u0000,\n\u0000\n\u0002\u0010\u0007\n\u0002\b\u0005\n\u0002\u0010\u0002\n\u0000\n\u0002\u0010\u0014\n\u0002\b\u0002\n\u0002\u0010\b\n\u0000\n\u0002\u0018\u0002\n\u0002\b\u0002\n\u0002\u0018\u0002\n\u0000\u001a \u0010\u0006\u001a\u00020\u00072\u0006\u0010\b\u001a\u00020\t2\u0006\u0010\n\u001a\u00020\t2\u0006\u0010\u000b\u001a\u00020\fH\u0002\u001a\u001a\u0010\r\u001a\b\u0012\u0004\u0012\u0002H\u000f0\u000e\"\u0004\b\u0000\u0010\u000f2\u0006\u0010\u0010\u001a\u00020\u0011\"\u000e\u0010\u0000\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0002\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0003\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0004\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000\"\u000e\u0010\u0005\u001a\u00020\u0001X\u0082T¢\u0006\u0002\n\u0000¨\u0006\u0012"}, d2 = {"EndTension", "", "Inflection", "P1", "P2", "StartTension", "computeSplineInfo", "", "splinePositions", "", "splineTimes", "nbSamples", "", "splineBasedDecay", "Landroidx/compose/animation/core/DecayAnimationSpec;", ExifInterface.GPS_DIRECTION_TRUE, "density", "Landroidx/compose/ui/unit/Density;", "animation_release"}, k = 2, mv = {1, 8, 0}, xi = 48)
/* loaded from: classes.dex */
public final class SplineBasedDecayKt {
private static final float EndTension = 1.0f;
private static final float Inflection = 0.35f;
private static final float P1 = 0.175f;
private static final float P2 = 0.35000002f;
private static final float StartTension = 0.5f;
/* JADX INFO: Access modifiers changed from: private */
public static final void computeSplineInfo(float[] fArr, float[] fArr2, int i) {
float f;
float f2;
float f3;
float f4;
float f5;
float f6;
float f7;
float f8;
float f9 = 0.0f;
float f10 = 0.0f;
for (int i2 = 0; i2 < i; i2++) {
float f11 = i2 / i;
float f12 = 1.0f;
while (true) {
f = ((f12 - f9) / 2.0f) + f9;
f2 = 1.0f - f;
f3 = f * 3.0f * f2;
f4 = f * f * f;
float f13 = (((f2 * P1) + (f * P2)) * f3) + f4;
if (Math.abs(f13 - f11) < 1.0E-5d) {
break;
} else if (f13 > f11) {
f12 = f;
} else {
f9 = f;
}
}
float f14 = 0.5f;
fArr[i2] = (f3 * ((f2 * 0.5f) + f)) + f4;
float f15 = 1.0f;
while (true) {
f5 = ((f15 - f10) / 2.0f) + f10;
f6 = 1.0f - f5;
f7 = f5 * 3.0f * f6;
f8 = f5 * f5 * f5;
float f16 = (((f6 * f14) + f5) * f7) + f8;
if (Math.abs(f16 - f11) >= 1.0E-5d) {
if (f16 > f11) {
f15 = f5;
} else {
f10 = f5;
}
f14 = 0.5f;
}
}
fArr2[i2] = (f7 * ((f6 * P1) + (f5 * P2))) + f8;
}
fArr2[i] = 1.0f;
fArr[i] = 1.0f;
}
public static final <T> DecayAnimationSpec<T> splineBasedDecay(Density density) {
Intrinsics.checkNotNullParameter(density, "density");
return DecayAnimationSpecKt.generateDecayAnimationSpec(new SplineBasedFloatDecayAnimationSpec(density));
}
}