Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to animate text within a button

I would like to have text within a button blink/pulsate on and off. I know I can use AlphaAnimation to achieve this effect, but from what I know this acts on the entire button view. Is there a way to implement this type of animation on just the text within the button?

like image 973
andreiscv Avatar asked Nov 01 '13 21:11

andreiscv


People also ask

How do I make a button Animate?

Create a basic button. Choose Insert > New Symbol, or press Control+F8 (Windows) or Command+F8 (Mac OS). Note: In Flash 3 and earlier, deselect everything on the Stage and choose Insert > Create Symbol. In the Symbol Properties dialog box, enter a name for the new button symbol and choose Button as the Behavior option.

How do I start an animation on button click?

Use a css class for the animation and add the class to div when button clicked. (use @keyframes to define css animations.) Show activity on this post. Show activity on this post.


1 Answers

You could animate the text color from your standard color to transparent and back again

ObjectAnimator colorAnim = ObjectAnimator.ofInt(myButton, "textColor", Color.RED, Color.TRANSPARENT); 
colorAnim.setDuration(1000); 
colorAnim.setEvaluator(new ArgbEvaluator());     
colorAnim.setRepeatCount(ValueAnimator.INFINITE); 
colorAnim.setRepeatMode(ValueAnimator.REVERSE); 
colorAnim.start();
like image 191
Stratus_Hunter Avatar answered Oct 03 '22 13:10

Stratus_Hunter