0

I try to move my image one position to another with animation.Here is a my code

 int[] locationTo = new int[2];
    secondView.getLocationOnScreen(locationTo);
    int x1 = locationTo[0];
    int y1 = locationTo[1];


    logo.post(() -> {
        float height = logo.getHeight();
        logo.animate()
                .x(x1)
                .y(y1 - (height * 2))
                .setDuration(5000)
                .setListener(new Animator.AnimatorListener() {
                    @Override
                    public void onAnimationStart(Animator animator) {

                    }

                    @Override
                    public void onAnimationEnd(Animator animator) {

                    }

                    @Override
                    public void onAnimationCancel(Animator animator) {

                    }

                    @Override
                    public void onAnimationRepeat(Animator animator) {

                    }
                })
                .start();
    });

this code working perfect.I have two questions 1) Is the any way to check view's x1 and y1 runtime? 2) Is a any way or any library to add blur effect in my view runtime? I would to increase blur effect when view starting moving. Thanks

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
BekaKK
  • 2,173
  • 6
  • 42
  • 80
  • 1
    `Is a any way or any library to add blur effect` you could just use search to find it. `Is the any way to check view's x1 and y1 runtime` you may extend the Animation class, and override `applyTransformation` method, or try creating your custom Interpolator for the animation. – Vladyslav Matviienko Jan 10 '19 at 07:18
  • Thanks your attention.Can you share more details ? @Vladyslav Matviienko – BekaKK Jan 10 '19 at 07:22
  • about what exactly? – Vladyslav Matviienko Jan 10 '19 at 07:23
  • About,how to applyTransformation in my case – BekaKK Jan 10 '19 at 07:24
  • You may create your own Animation class, where you manually animate view. `applyTransformation` is the method which you need to override in your custom class. You will need to add the required transformations to ` Transformation t` the second parameter of this method. First parameter will show you the progress of the animation. – Vladyslav Matviienko Jan 10 '19 at 07:28
  • ok, but how I can add my custom animation class in my code ? – BekaKK Jan 10 '19 at 07:29
  • by creating a class that extends `Animation` – Vladyslav Matviienko Jan 10 '19 at 08:14
  • @VladyslavMatviienko as you can see OP is using `Animator`s, not `Animation`s - what OP needs is `setUpdateListener`, not `applyTransformation` – pskink Jan 10 '19 at 08:23
  • @pskink I see, but nothing stops him from switching to `Animations`. If you have your own options - why don't you describe them? – Vladyslav Matviienko Jan 10 '19 at 08:25
  • well, couple of years ago google devs switched from `Animation`s to `Animator`s as they are much more flexible, easy and powerful... – pskink Jan 10 '19 at 08:30

0 Answers0