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

    }



  • 相关阅读:
    [Python3网络爬虫开发实战] 3.1.3-解析链接
    pusher-http-go
    gopush-cluster 架构
    消息队列 redis vs nsq
    redis资料
    golang+websocket
    golang之flag.String
    Linux环境下安装mysql
    golang版的crontab
    golang实现wav文件转换为mp3文件
  • 原文地址:https://www.cnblogs.com/xiaoxiaing/p/7809279.html
Copyright © 2011-2022 走看看