Rabbit-R1/original r1/java/sources/androidx/constraintlayout/motion/utils/VelocityMatrix.java
2024-05-21 17:08:36 -04:00

93 lines
3.2 KiB
Java

package androidx.constraintlayout.motion.utils;
import androidx.constraintlayout.motion.widget.KeyCycleOscillator;
import androidx.constraintlayout.motion.widget.SplineSet;
/* loaded from: classes.dex */
public class VelocityMatrix {
private static String TAG = "VelocityMatrix";
float mDRotate;
float mDScaleX;
float mDScaleY;
float mDTranslateX;
float mDTranslateY;
float mRotate;
public void clear() {
this.mDRotate = 0.0f;
this.mDTranslateY = 0.0f;
this.mDTranslateX = 0.0f;
this.mDScaleY = 0.0f;
this.mDScaleX = 0.0f;
}
public void setRotationVelocity(SplineSet splineSet, float f) {
if (splineSet != null) {
this.mDRotate = splineSet.getSlope(f);
this.mRotate = splineSet.get(f);
}
}
public void setTranslationVelocity(SplineSet splineSet, SplineSet splineSet2, float f) {
if (splineSet != null) {
this.mDTranslateX = splineSet.getSlope(f);
}
if (splineSet2 != null) {
this.mDTranslateY = splineSet2.getSlope(f);
}
}
public void setScaleVelocity(SplineSet splineSet, SplineSet splineSet2, float f) {
if (splineSet != null) {
this.mDScaleX = splineSet.getSlope(f);
}
if (splineSet2 != null) {
this.mDScaleY = splineSet2.getSlope(f);
}
}
public void setRotationVelocity(KeyCycleOscillator keyCycleOscillator, float f) {
if (keyCycleOscillator != null) {
this.mDRotate = keyCycleOscillator.getSlope(f);
}
}
public void setTranslationVelocity(KeyCycleOscillator keyCycleOscillator, KeyCycleOscillator keyCycleOscillator2, float f) {
if (keyCycleOscillator != null) {
this.mDTranslateX = keyCycleOscillator.getSlope(f);
}
if (keyCycleOscillator2 != null) {
this.mDTranslateY = keyCycleOscillator2.getSlope(f);
}
}
public void setScaleVelocity(KeyCycleOscillator keyCycleOscillator, KeyCycleOscillator keyCycleOscillator2, float f) {
if (keyCycleOscillator == null && keyCycleOscillator2 == null) {
return;
}
if (keyCycleOscillator == null) {
this.mDScaleX = keyCycleOscillator.getSlope(f);
}
if (keyCycleOscillator2 == null) {
this.mDScaleY = keyCycleOscillator2.getSlope(f);
}
}
public void applyTransform(float f, float f2, int i, int i2, float[] fArr) {
float f3 = fArr[0];
float f4 = fArr[1];
float f5 = (f2 - 0.5f) * 2.0f;
float f6 = f3 + this.mDTranslateX;
float f7 = f4 + this.mDTranslateY;
float f8 = f6 + (this.mDScaleX * (f - 0.5f) * 2.0f);
float f9 = f7 + (this.mDScaleY * f5);
float radians = (float) Math.toRadians(this.mRotate);
float radians2 = (float) Math.toRadians(this.mDRotate);
double d = radians;
double d2 = i2 * f5;
float sin = f8 + (((float) ((((-i) * r7) * Math.sin(d)) - (Math.cos(d) * d2))) * radians2);
float cos = f9 + (radians2 * ((float) (((i * r7) * Math.cos(d)) - (d2 * Math.sin(d)))));
fArr[0] = sin;
fArr[1] = cos;
}
}