ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Random Text using only these four letters GCTA

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrea Stewart
Random Text using only these four letters GCTA
on Feb 9, 2015 at 9:46:09 pm

I know this should be simple. How can I make a random text generator that sticks only to GCTA?

Basically I want those letters to keep flipping and eventually settle on a certain sequence, eg GCTA as the result.

Any help appreciated.

Andrea Stewart
Producer/Editor/Director - Owner
Germane Creative LLC


Return to posts index

Kevin Camp
Re: Random Text using only these four letters GCTA
on Feb 9, 2015 at 11:47:39 pm

create a text layer and type GCTA into it, then add this expression to the source text and it will randomly jumble just those letters.

myText = text.sourceText.split( "" );
newText = "";

for ( i = 0 ; i < 4 ; i++ ){
r = Math.floor( random( 4 ) );
newText = newText + myText[ r ];
}

newText


then you could simply cut between the text layer with the expression and a text layer with final letters in the right order.... but i think you may have something else planned as it animates to the final resolve, so the expression may need to change to accomplish what you are after.

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

Kevin Camp
Re: Random Text using only these four letters GCTA
on Feb 10, 2015 at 12:45:44 am

This expression will resolve the text one character at a time based on layer markers. simply add a layer marker at the point at which you want a letter to resolve.

myText = text.sourceText.split( "" );

n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time){
n--;
}
}

newText = "";
for ( i=n ; i<4 ; i++ ){
r = Math.floor( random( 4 ) );
newText = newText + myText[ r ];
}

text.sourceText.substr( 0,n ) + newText


Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]