private int getRippleAlpha(int preAlpha, int nowAlpha) {
        if (nowAlpha > preAlpha)
            return 0;
        int dAlpha = preAlpha - nowAlpha;
        return (255 * dAlpha) / (255 - nowAlpha);
    }
This is a touch foreground ripple drawable extends to StatePaintDrawable
caprice/ui/src/main/java/net/qiujuer/genius/ui/drawable/AlmostRippleDrawable.java