zoukankan      html  css  js  c++  java
  • Android为TV端助力 电影栏目移动到底部或者顶部时抖动动画

    1 移动到底部上下抖动
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(holder.itemView,"translationX",0,0);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(holder.itemView,"translationY",0,10,15,10,0);
    AnimatorSet set =new AnimatorSet();
    set.setDuration(1000);
    set.setInterpolator(new SpringScaleInterpolator(0.4f));
    set.playTogether(animatorX,animatorY);
    set.start();
    2,移动左边或者右边边缘,左右抖动
    ObjectAnimator animatorX = ObjectAnimator.ofFloat(holder.itemView,"translationX",0,10,15,10,0);
    ObjectAnimator animatorY = ObjectAnimator.ofFloat(holder.itemView,"translationY",0,0);
    AnimatorSet set =new AnimatorSet();
    set.setDuration(1000);
    set.setInterpolator(new SpringScaleInterpolator(0.4f));
    set.playTogether(animatorX,animatorY);
    set.start();
    
    
    public class SpringScaleInterpolator implements Interpolator {
    //弹性因数
    private float factor;

    public SpringScaleInterpolator(float factor) {
    this.factor = factor;
    }

    @Override
    public float getInterpolation(float input) {

    return (float) (Math.pow(2, -10 * input) * Math.sin((input - factor / 4) * (2 * Math.PI) / factor) + 1);
    }

    }



  • 相关阅读:
    ebs R12 支持IE11
    reloc: Permission denied
    3.23考试小记
    3.21考试小记
    3.20考试小记
    3.17考试小记
    3.15考试小记
    3.13考试小记
    3.12考试小记
    3.10考试小记
  • 原文地址:https://www.cnblogs.com/xiaoxiaing/p/7809279.html
Copyright © 2011-2022 走看看