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);
}

}



转载于:https://www.cnblogs.com/xiaoxiaing/p/7809279.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值