0

I created ScaleAnimation and added my custom Interpolator.i try to recieve slide animaton right to left.this is a my source

 public class HesitateInterpolator implements Interpolator {
    public HesitateInterpolator() {}
    public float getInterpolation(float x) {

        return (float) (6 * Math.pow(x, 2) - 8 * Math.pow(x, 3) + 3 * Math.pow(x, 4));
    }
}

and this is a my animation source code:

 ScaleAnimation anim = new ScaleAnimation(0.0f, 1.0f, 1.0f, 1.0f, Animation.RELATIVE_TO_SELF,1.0f, Animation.RELATIVE_TO_SELF, 0.5f);
        anim.setDuration(100);
        anim.setInterpolator(new HesitateInterpolator());

i searched about Interpolator and also i found some links for example this

How to apply easing animation function on view in android

what is a my goal.i want to receive Material Design same animation.i mean this material animation

https://www.google.com/design/spec/animation/authentic-motion.html#authentic-motion-mass-weight

p.s my code working perfect but i have spead problem.spead is slowly.i changed durrections but i want to change(Increas) spead with Interpolator.meybe i have something wrong in this line

 return (float) (6 * Math.pow(x, 2) - 8 * Math.pow(x, 3) + 3 * Math.pow(x, 4));

My goal is to create leftright animation same Material Design if anyone knows solution please help me thanks everyone

Community
  • 1
  • 1
donoachua
  • 193
  • 2
  • 16

0 Answers0