Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to Make a Secret iOS App Text Animation

I'm trying to duplicate the Secret App's Text Label transition. Does anyone the best way to approach it?

It looks like they have each letter start out as clear text color and then animate it to gray and then white text color.

Here are some screenshots: enter image description hereenter image description hereenter image description hereenter image description here

like image 372
NatashaTheRobot Avatar asked Apr 13 '14 21:04

NatashaTheRobot


3 Answers

Here is another solution https://github.com/zipme/RQShineLabel

I use CADisplayLink together with NSAttributedString that way we only need one UILabel, have a look :)

like image 53
Zipme Avatar answered Nov 11 '22 16:11

Zipme


Thanks everyone for the help. I was able to get this working with some modification to keep the label fading in over and over. Here is my full source code: https://github.com/NatashaTheRobot/SecretTextAnimationExample

like image 39
NatashaTheRobot Avatar answered Nov 11 '22 17:11

NatashaTheRobot


Here's a possible way.

First, let's note that a UILabel can hold and display an NSAttributedString. Using NSMutableAttributedString, you can make each letter a different color.

So, start with two labels, one right on top of the other (i.e. in front of it, hiding it), with the same text but different letter colorings. Now fade the alpha of the top one to zero, thus gradually revealing the one behind it. Thus each letter will seem gradually to assume the color of the letter behind it.

like image 35
matt Avatar answered Nov 11 '22 16:11

matt