// int width = binding.gameItemWinContext.getWidth(); // int height = binding.gameItemWinContext.getHeight(); // int ivXCenter = width/2; // int ivYCenter = height/2; // Logger.e("打印"+width); // float circleRadius = (float) Math.hypot(ivXCenter, ivYCenter); //// Animator circularReveal = ViewAnimationUtils.createCircularReveal(binding.gameItemWinContext, ivXCenter, ivYCenter, 0f, circleRadius); // Animator circularReveal = ViewAnimationUtils.createCircularReveal(binding.gameItemWinContext, ivXCenter, ivYCenter, 0f, circleRadius); // binding.gameItemWinContext.setVisibility(View.VISIBLE); // circularReveal.setInterpolator(new LinearInterpolator()); // circularReveal.setDuration(3000); // circularReveal.start();
// int centerX = (binding.gameItemWinContext.getLeft() + binding.gameItemWinContext.getRight()) / 2; int centerX = 200; int centerY = (binding.gameItemWinContext.getTop() + binding.gameItemWinContext.getBottom()) / 2; // Math.hypot(x,y): 返回sqrt(x2 +y2) Logger.e("打印"+binding.gameItemWinContext.getLeft()); // 获取扩散的半径 float finalRadius = (float) Math.hypot((double) centerX, (double) centerY); // 定义揭露动画 Animator mCircularReveal = ViewAnimationUtils.createCircularReveal( binding.gameItemWinContext, centerX, centerY, 0, finalRadius); // 设置动画持续时间,并开始动画 mCircularReveal.setDuration(1000); mCircularReveal.setInterpolator(new LinearInterpolator()); mCircularReveal.start();
标签:动画,int,float,binding,擦除,gameItemWinContext,android,circularReveal From: https://www.cnblogs.com/zhangxuetao/p/16921599.html