Both Object- and ValueAnimator jumps when Duration is set above API LvL 24

574 Views Asked by At

I am using ObjectAnimator to move an ImageView cntinuously from the top to the bottton of the screen. The code is the following:

    ObjectAnimator animate;
    animate = ObjectAnimator.ofFloat(ImageView, "translationY" ,0 ,screenHeight);
    animate.setDuration(time);
    animate.setInterpolator(new LinearInterpolator());
    animate.setRepeatCount(ValueAnimator.INFINITE);
    animate.start();

After the animation is started I change the Duration of the animtaion every x seconds. The animation is flawless but whenever I run the app on a phone or emulator that uses Android 7.0 (API lvl 24) or above, every time I change the Duration the Image skips frames and jumps further in the animation. I lower the Duration every time the ImageView arrives at the botton of the screen with 10ms. Also the jump becomes every time a bit greater so at the very beginning at the first setDuration there is none and the a little and then bigger and bigger. I tried looking for an answere but I couldn´t find any so I hoped some Developer recognise this and helps me out.

0

There are 0 best solutions below