Android custom animation interpolator - slow animation speed by half after half of it's duration has passed -


i've applied animation on progressbar such animates max progress 0 in constant pace (by default)

i need behave this:

  • animate 100% progress 50% progress in 5 seconds.
  • animate 50% progress 0% progress in 10 seconds

basically want animation slow it's speed half once reaches 50% progress want transition smooth.

i tried run 2 different animations 1 after another, once first animation ended in animaton listener on end callback starting next 1 doubled duration, there small annoying pause , doesn't continuous.

can define interpolator handle , formula be?

this current code

private class progressbaranimation extends animation {         private progressbar progressbar;         private float from;         private float  to;          public progressbaranimation(progressbar progressbar, float from, float to) {             super();             this.progressbar = progressbar;             this.from = from;             this.to = to;         }          @override         protected void applytransformation(float interpolatedtime, transformation t) {             super.applytransformation(interpolatedtime, t);             float value = + (to - from) * interpolatedtime;              progressbar.setprogress((int) value);             points = (int)(value/100);             txtprogress.settext(string.valueof(points));              settextposition(value);         }      } 

and calling this:

anim = new progressbaranimation(progressbar, progressbar.getmax(), 0);         anim.setinterpolator(new progressinterpolator());         anim.setduration(10000);         anim.setstartoffset(0);  progressbar.startanimation(anim); 


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -