-
Notifications
You must be signed in to change notification settings - Fork 451
TextView TextColor Animation
WoWoTextViewColorAnimation performs an animation to change the text color of a TextView. Any sub-class that extends TextView is able to change its text color with this kind of animation.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addAnimations(findViewById(R.id.test1), Chameleon.RGB);
addAnimations(findViewById(R.id.test2), Chameleon.HSV);
}
private void addAnimations(View view, Chameleon chameleon) {
ViewAnimation viewAnimation = new ViewAnimation(view);
viewAnimation.add(WoWoTextViewColorAnimation.builder().page(0)
.from("#ff0000").to("#00ff00").chameleon(chameleon).build());
viewAnimation.add(WoWoTextViewColorAnimation.builder().page(1)
.from("#00ff00").to("#0000ff").chameleon(chameleon).build());
viewAnimation.add(WoWoTextViewColorAnimation.builder().page(2)
.from("#0000ff").to("#ff0000").chameleon(chameleon).build());
viewAnimation.add(WoWoTextViewColorAnimation.builder().page(3).start(0).end(0.5)
.from("#ff0000").to("#000000").chameleon(chameleon).build());
viewAnimation.add(WoWoTextViewColorAnimation.builder().page(3).start(0.5).end(1)
.from("#000000").to("#ff0000").chameleon(chameleon).build());
wowo.addAnimation(viewAnimation);
wowo.setEase(ease);
wowo.setUseSameEaseBack(useSameEaseTypeBack);
wowo.ready();
}
You may notice that there are 2 kind of discolorations of this animation. As a matter of fact, every animation that extends from SingleColorPageAnimation and MultiColorPageAnimation has a parameter named Chameleon
which performs the discoloration job. Check Chameleon Wiki to know about the difference between RGB
and HSV
discoloration-styles and how they works.
If you wanna change text color of some custom views that do not extends from TextView. Then you can extends SingleColorPageAnimation or MultiColorPageAnimation by yourself to perform this magic. Check Custom Animation for more informations.
WoWoTextViewColorAnimation extends SingleColorPageAnimation and PageAnimation. Check more implementation details in its superclasses.
Basic Animations
- Position Animation
- Position 3D Animation
- Translation Animation
- Translation 3D Animation
- Scale Animation
- Alpha Animation
- Rotation Animation
- Elevation Animation
TextView Animations
Color Animations
- Background Color Animation
- Shape Color Animation
- State-List Color Animation
- Layer-List Color Animation
Interface Expansibility