package com.airbnb.lottie.animation.keyframe; import android.graphics.Color; import android.graphics.Paint; import com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation; import com.airbnb.lottie.model.layer.BaseLayer; import com.airbnb.lottie.parser.DropShadowEffect; import com.airbnb.lottie.value.LottieFrameInfo; import com.airbnb.lottie.value.LottieValueCallback; /* loaded from: classes.dex */ public class DropShadowKeyframeAnimation implements BaseKeyframeAnimation.AnimationListener { private static final double DEG_TO_RAD = 0.017453292519943295d; private final BaseKeyframeAnimation color; private final BaseKeyframeAnimation direction; private final BaseKeyframeAnimation distance; private boolean isDirty = true; private final BaseKeyframeAnimation.AnimationListener listener; private final BaseKeyframeAnimation opacity; private final BaseKeyframeAnimation radius; public DropShadowKeyframeAnimation(BaseKeyframeAnimation.AnimationListener animationListener, BaseLayer baseLayer, DropShadowEffect dropShadowEffect) { this.listener = animationListener; BaseKeyframeAnimation createAnimation = dropShadowEffect.getColor().createAnimation(); this.color = createAnimation; createAnimation.addUpdateListener(this); baseLayer.addAnimation(createAnimation); BaseKeyframeAnimation createAnimation2 = dropShadowEffect.getOpacity().createAnimation(); this.opacity = createAnimation2; createAnimation2.addUpdateListener(this); baseLayer.addAnimation(createAnimation2); BaseKeyframeAnimation createAnimation3 = dropShadowEffect.getDirection().createAnimation(); this.direction = createAnimation3; createAnimation3.addUpdateListener(this); baseLayer.addAnimation(createAnimation3); BaseKeyframeAnimation createAnimation4 = dropShadowEffect.getDistance().createAnimation(); this.distance = createAnimation4; createAnimation4.addUpdateListener(this); baseLayer.addAnimation(createAnimation4); BaseKeyframeAnimation createAnimation5 = dropShadowEffect.getRadius().createAnimation(); this.radius = createAnimation5; createAnimation5.addUpdateListener(this); baseLayer.addAnimation(createAnimation5); } @Override // com.airbnb.lottie.animation.keyframe.BaseKeyframeAnimation.AnimationListener public void onValueChanged() { this.isDirty = true; this.listener.onValueChanged(); } public void applyTo(Paint paint) { if (this.isDirty) { this.isDirty = false; double floatValue = this.direction.getValue().floatValue() * DEG_TO_RAD; float floatValue2 = this.distance.getValue().floatValue(); float sin = (float) Math.sin(floatValue); float cos = (float) Math.cos(floatValue + 3.141592653589793d); int intValue = this.color.getValue().intValue(); paint.setShadowLayer(this.radius.getValue().floatValue(), sin * floatValue2, cos * floatValue2, Color.argb(Math.round(this.opacity.getValue().floatValue()), Color.red(intValue), Color.green(intValue), Color.blue(intValue))); } } public void setColorCallback(LottieValueCallback lottieValueCallback) { this.color.setValueCallback(lottieValueCallback); } public void setOpacityCallback(LottieValueCallback lottieValueCallback) { if (lottieValueCallback == null) { this.opacity.setValueCallback(null); } else { this.opacity.setValueCallback(new LottieValueCallback(this, lottieValueCallback) { // from class: com.airbnb.lottie.animation.keyframe.DropShadowKeyframeAnimation.1 final DropShadowKeyframeAnimation this$0; final LottieValueCallback val$callback; { this.this$0 = this; this.val$callback = lottieValueCallback; } /* JADX WARN: Can't rename method to resolve collision */ @Override // com.airbnb.lottie.value.LottieValueCallback public Float getValue(LottieFrameInfo lottieFrameInfo) { Float f = (Float) this.val$callback.getValue(lottieFrameInfo); if (f == null) { return null; } return Float.valueOf(f.floatValue() * 2.55f); } }); } } public void setDirectionCallback(LottieValueCallback lottieValueCallback) { this.direction.setValueCallback(lottieValueCallback); } public void setDistanceCallback(LottieValueCallback lottieValueCallback) { this.distance.setValueCallback(lottieValueCallback); } public void setRadiusCallback(LottieValueCallback lottieValueCallback) { this.radius.setValueCallback(lottieValueCallback); } }