You could create a nice and smooth “color blink” effect for any DisplayObject, including TextField instances with a few lines of the code using TweenMax:
1 2 3 4 5 6 7 8 9 10 11 | import com.greensock.easing.Cubic; import com.greensock.plugins.ColorMatrixFilterPlugin; import com.greensock.plugins.EndArrayPlugin; import com.greensock.plugins.TweenPlugin; import com.greensock.TweenMax; /* run this line only once (as example, you can put it into the main document's constructor or your initialization function) */ TweenPlugin.activate([ColorMatrixFilterPlugin, EndArrayPlugin]); /*and use this line later to start blinking */ TweenMax.to(anyDisplayObject, 1 , {colorMatrixFilter:{colorize: 0x74F88E , amount: 1 }, repeat:- 1 , yoyo: true , ease:Cubic.easeInOut} ); |
By the way, be careful with TintPlugin or ColorTransformPlugin while tweening TextFields with TweenMax – you can notice some lags or jerks in the tween animation.
Found a typo? Please, highlight it and press Shift + Enter or click here to inform me!