FORUMS: list search recent posts

Text Animator - limiting the random character options

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Caroline Hodge
Text Animator - limiting the random character options
on Nov 9, 2017 at 1:26:07 pm

Hi,
so I said I could help a little with creating some sizzler title cards on AE as I know a little; they want DNA code transitioning to title text and was just applying a couple of presets like 3D SPIN and a few keyframes, but it seems they want one more like the computer random character to end title as they found in some tutorials. So I threw on the Animator Algorithm preset and jiggled a few unwanted factors, but of course this uses completely random characters, and I specifically need only the characters G, C, T and A. I noticed there was a couple of posts before about choosing ranges, with scripts and mentions of hexadecimals but I have basically zero knowledge of what they meant or even where I'm supposed to put the script or how.
Any basic idiot level help available?

Cheers.


Return to posts index

Doyle Lewis
Re: Text Animator - limiting the random character options
on Nov 9, 2017 at 7:40:23 pm

If I understand your question, you want a text layer to choose a DNA letter (i.e. G,C,T, and A.) and that is it? OK if so, then no prob,

So for your text layer that you want to have randomly choose a letter just add this script into the source text field.


seedRandom(Index, true); //I used the seed random so that your random letter wouldn't change at every frame. I used index as the seed so that layers that start on the same frame don't have the same value
V=random(0, 4.9); //chooses a random number with decimals between 0 and 4.9. If you just did 4 then with rounding 4 would almost never be chosen because it would have to pick exactly 4

R=Math.floor(V); //Rounds it down to a whole number

if (R = 1) { "G"
} else if (R = 2) { "C"
} else if (R = 3) { "T"
} else { "A"
} //This just assigns a letter value to each number output we created


Now as we know DNA only connects certain letter to other letters so If you wanted to have a Text layer that chose the correct match to the random Letter chosen then place a text layer directly under (very important!!!) the one you want it to pair with and put this expression in the source text field.


P=thisComp.layer(Index-1).text.sourceText; //Checks the source text of the layer directly above it

if (P = "C") { "G"
} else if (P = "G") { "C"
} else if (P = "A") { "T"
} else { "A"
} //whatever letter is chosen on the layer above this sets the value to its partner letter


As a note, I did this on a chromebook without any access to AE so was not able to test this. The expressions are fairly simple so I just pounded it out. I am sure however that I have some syntax errors somewhere and it may not work straight off, but if there are let me know and I will help find the mistakes if need be.

Doyle Lewis,
Location Assistant
ABC Studios




Return to posts index

Caroline Hodge
Re: Text Animator - limiting the random character options
on Nov 10, 2017 at 10:24:38 am

Thanks so much for helping!

It doesn't need to match its pair so the first script is fine.

So I include text.sourceText and then paste the script straight after that I presume?

I'm getting warning: property or method 'Index' in Class 'global' is missing or does not exist. It may have been renamed, moved, deleted, or the name may have been mistyped.

It will need to end on the desired end title, so I'll be able to just keyframe near the end with a-non GCAT letter and it will override the script? Or do I need to put that on a different layer?


Return to posts index


Doyle Lewis
Re: Text Animator - limiting the random character options
on Nov 12, 2017 at 7:44:51 pm

Hey Caroline,

Sorry for the delay. Moral of the story is don't write expressions that you can't test haha. I jumped on my desktop this weekend and it was pretty quick but found the problems I had. Like i said it was mostly syntax issues lol.

here is the correct expression tested and working:


seedRandom(index, true);
V=random(0, 4.9);

R=Math.floor(V);

if (R == 1) { "G"
} else if (R == 2) { "C"
} else if (R == 3) { "T"
} else { "A"
}


Doyle Lewis,
Location Assistant
ABC Studios




Return to posts index

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