Created
December 1, 2018 06:54
-
-
Save pythoncat1024/bc73d37dbff299cebc73ede7dcbbd267 to your computer and use it in GitHub Desktop.
字母跳动动画
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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