Skip to content

Instantly share code, notes, and snippets.

@pythoncat1024
Created December 1, 2018 06:54
Show Gist options
  • Save pythoncat1024/bc73d37dbff299cebc73ede7dcbbd267 to your computer and use it in GitHub Desktop.
Save pythoncat1024/bc73d37dbff299cebc73ede7dcbbd267 to your computer and use it in GitHub Desktop.
字母跳动动画
TextView tvChar = view.findViewById(R.id.char_tv);
ValueAnimator animator = ValueAnimator.ofObject((fraction, startValue, endValue) -> {
char start = (Character) startValue;
char end = (Character) endValue;
return (int) (start + (end - start) * fraction);
}, 'A', 'Z');
animator.addUpdateListener(animation -> {
int s = (Integer) animation.getAnimatedValue();
char ss = (char) s;
com.apkfuns.logutils.LogUtils.w("ss==" + ss);
tvChar.setText(String.format("%s", ss));
});
animator.setDuration(10000);
animator.setInterpolator(new LinearInterpolator());
animator.start();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment