1

我对棒棒糖动画有疑问。这里有一个关于问题 问题棒棒糖动画的视频

CircularReveal 出现在 ObjectAnimator 之前,尽管有延迟。

  imm = (ImageView) findViewById(R.id.shape);

    rl = (RelativeLayout) findViewById(R.id.layout);

    final View mView = (View) findViewById(R.id.view);

    mButtonOff = (Button) findViewById(R.id.buttonOff);
    mButtonOff.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View view) {

            float iX = imm.getX();
            float iY = imm.getY();
            Log.d(TAG, "iX: " + iX + " iY: " + iY);


            int lW = rl.getWidth();
            int lH = rl.getHeight();
            Log.d(TAG, "lW: " + lW + " lH: " + lH);


            //ofFloat("oggetto da muovere", "tag", "X di partenza", "X di arrivo"
            // X di arrivo data: X dell'oggetto + (larghezza del layout /2) - (dimensione dell'oggetto + margine dell'oggetto + margine del layout)
            ObjectAnimator anim1 = ObjectAnimator.ofFloat(imm, "x", iX, iX + (lW / 2) - (56 + 16 + 16));
            ObjectAnimator anim2 = ObjectAnimator.ofFloat(imm, "y", iY, iY + (lH / 2) - (56 + 16 + 16));


            AnimatorSet animSet = new AnimatorSet();

            animSet.play(anim1).with(anim2);
            animSet.setDuration(1000);
            animSet.start();


            int finalRadius = Math.max(mView.getWidth(), mView.getHeight());
            Animator animCircual = ViewAnimationUtils.createCircularReveal(mView, 624 + 56, 878 + 56, 0, finalRadius);
            animCircual.setStartDelay(1000);
            animCircual.setDuration(1000);
            mView.setVisibility(View.VISIBLE);
            animCircual.start();                
        }
    });
4

0 回答 0