package com.bytedance.adsdk.ugeno.core;

import android.animation.AnimatorSet;
import android.animation.ArgbEvaluator;
import android.animation.ObjectAnimator;
import android.graphics.Canvas;
import android.graphics.Paint;
import android.text.TextUtils;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.AccelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import com.bytedance.adsdk.ugeno.core.fm;
import java.util.ArrayList;
import java.util.List;

/* JADX INFO: loaded from: classes.dex */
public class vt {
    private int ajl;
    Paint fm;
    private int jnr;

    /* JADX INFO: renamed from: lb, reason: collision with root package name */
    private AnimatorSet f6323lb = new AnimatorSet();
    private fm ro;
    private String wsy;
    private View yz;

    public vt(View view, fm fmVar) {
        this.yz = view;
        this.ro = fmVar;
        Paint paint = new Paint();
        this.fm = paint;
        paint.setAntiAlias(true);
    }

    public void ro() {
        AnimatorSet animatorSet = this.f6323lb;
        if (animatorSet != null) {
            animatorSet.cancel();
        }
    }

    public void fm() {
        ObjectAnimator objectAnimator;
        ArrayList arrayList = new ArrayList();
        List<fm.C0013fm> listLb = this.ro.lb();
        if (listLb == null || listLb.size() <= 0) {
            return;
        }
        for (fm.C0013fm c0013fm : listLb) {
            if (c0013fm != null) {
                objectAnimator = new ObjectAnimator();
                objectAnimator.setDuration(c0013fm.fm());
                if (TextUtils.equals(c0013fm.jnr(), "translateX")) {
                    objectAnimator.setPropertyName("translationX");
                } else if (TextUtils.equals(c0013fm.jnr(), "translateY")) {
                    objectAnimator.setPropertyName("translationY");
                } else {
                    objectAnimator.setPropertyName(c0013fm.jnr());
                }
                objectAnimator.setStartDelay(c0013fm.yz());
                objectAnimator.setTarget(this.yz);
                if (TextUtils.equals(c0013fm.jnr(), "backgroundColor")) {
                    objectAnimator.setIntValues((int) c0013fm.ajl(), (int) c0013fm.wsy());
                    c0013fm.ajl();
                    c0013fm.wsy();
                } else {
                    objectAnimator.setFloatValues(c0013fm.ajl(), c0013fm.wsy());
                }
                int iRo = (int) this.ro.ro();
                if (iRo != 0) {
                    objectAnimator.setRepeatCount(iRo);
                } else {
                    objectAnimator.setRepeatCount((int) c0013fm.ro());
                }
                if (TextUtils.equals(c0013fm.jnr(), "backgroundColor")) {
                    objectAnimator.setEvaluator(new ArgbEvaluator());
                }
                String strAjl = this.ro.ajl();
                if (TextUtils.isEmpty(strAjl)) {
                    strAjl = c0013fm.lb();
                }
                if (TextUtils.equals(strAjl, "reverse")) {
                    objectAnimator.setRepeatMode(2);
                } else {
                    objectAnimator.setRepeatMode(1);
                }
                if (c0013fm.wu() != null && c0013fm.wu().length > 0) {
                    objectAnimator.setFloatValues(c0013fm.wu());
                }
                if (TextUtils.equals(c0013fm.jnr(), "rotationX")) {
                    this.yz.post(new Runnable() { // from class: com.bytedance.adsdk.ugeno.core.vt.1
                        @Override // java.lang.Runnable
                        public void run() {
                            vt.this.yz.setPivotX(vt.this.yz.getWidth() / 2.0f);
                            vt.this.yz.setPivotY(vt.this.yz.getHeight());
                        }
                    });
                }
                if (TextUtils.equals(c0013fm.jnr(), "ripple")) {
                    this.wsy = c0013fm.vt();
                }
                String strEf = c0013fm.ef();
                strEf.getClass();
                switch (strEf) {
                    case "accelerate":
                        objectAnimator.setInterpolator(new AccelerateInterpolator());
                        break;
                    case "decelerate":
                        objectAnimator.setInterpolator(new DecelerateInterpolator());
                        break;
                    case "linear":
                    case "standard":
                        objectAnimator.setInterpolator(new LinearInterpolator());
                        break;
                    case "accelerateDecelerate":
                        objectAnimator.setInterpolator(new AccelerateDecelerateInterpolator());
                        break;
                }
                arrayList.add(objectAnimator);
            }
        }
        if (this.ro.yz() != 0) {
            this.f6323lb.setDuration(this.ro.yz());
        }
        this.f6323lb.setStartDelay(this.ro.jnr());
        if (TextUtils.equals(this.ro.fm(), "sequentially")) {
            this.f6323lb.playSequentially(arrayList);
        } else {
            this.f6323lb.playTogether(arrayList);
        }
        this.f6323lb.start();
    }

    public void fm(Canvas canvas, IAnimation iAnimation) {
        try {
            if (iAnimation.getRipple() == 0.0f || TextUtils.isEmpty(this.wsy)) {
                return;
            }
            this.fm.setColor(com.bytedance.adsdk.ugeno.wsy.fm.fm(this.wsy));
            this.fm.setAlpha(90);
            ((ViewGroup) this.yz.getParent()).setClipChildren(true);
            canvas.drawCircle(this.jnr, this.ajl, Math.min(r0, r2) * 2 * iAnimation.getRipple(), this.fm);
        } catch (Throwable th) {
            th.getMessage();
        }
    }

    public void fm(int i10, int i11) {
        this.jnr = i10 / 2;
        this.ajl = i11 / 2;
    }
}
