FORUMS: list search recent posts

decode effect based on a Dan Ebberts expression

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
ole sturm
decode effect based on a Dan Ebberts expression
on Apr 30, 2014 at 6:00:49 am

Hi all,

I found the below expression here on CC and it does everything I need with the exception of one thing - currently, the random letters all stop at once to form the specified text string. However, I need it to "decode" from left to right similar to the effect achieved with the "decoder fade in" preset. Is this something that is possible with expressions or do I need to try a different approach?

Many thanks

choices = "GTCA";
str = "THIS IS THE TEXT STRING THAT APPEARS";
tStart = 0; //time at which the animation starts
tStop = 3; //time at which the animation stop
cps = 20; // characters per second
tStartAgain = 4; //time at which the animation restarts
if ((time > tStart && time &lt; tStop) || time > tStartAgain){
seed = Math.floor(time*cps);
seedRandom(seed,true);
s = "";
for (i = 0; i &lt; str.length; i++){
idx = Math.floor(random(choices.length));
s += choices[idx];
}
}else{
s = str;
}
s


Return to posts index

Kevin Camp
Re: decode effect based on a Dan Ebberts expression
on Apr 30, 2014 at 3:29:41 pm

you might try the text preset 'decoder fade in'.

if you don't want the fade in portino, twirl down the text properties to get to text>animator>opacity and either set it to 100% or delete it all together. (note if you remove the opacity change, you may want to use a fixed width/mono space font to prevent character overlap)

Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

ole sturm
Re: decode effect based on a Dan Ebberts expression
on Apr 30, 2014 at 11:17:28 pm

Hi Kevin, that's certainly the effect I want to achieve but it won't work as the decode effect does not limit the characters being used - I need to limit mine to G, T, C and A.


Return to posts index


Kevin Camp
Re: decode effect based on a Dan Ebberts expression
on May 1, 2014 at 6:25:48 pm

ole, i must apologize for not fully reading your post, where you had clearly stated that you were looking for something similar to that decoder preset that i recommended. (DOH!)

looking at the expression, i think you just need to combine substrings of the random string and the final string, something like this:

choices = "GTCA";
str = "THIS IS THE TEXT STRING THAT APPEARS";
tStart = 0; //time at which the animation starts
tStop = 3; //time at which the animation stop
cps = 20; // characters per second
tStartAgain = 4; //time at which the animation restarts
if ((time > tStart && time < tStop) || time > tStartAgain){
seed = Math.floor(time*cps);
seedRandom(seed,true);
s = ""
sRand = "";
for (i = 0; i < str.length; i++){
idx1 = Math.floor(random(choices.length));
idx2 = Math.floor(linear(time,tStart,tStop,0,1)*str.length);
sRand += choices[idx1];
s = str.substr(0,idx2) + sRand.substr(idx2,str.length);
}
}else{
s = str;
}
s


Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

ole sturm
Re: decode effect based on a Dan Ebberts expression
on May 2, 2014 at 5:46:48 am

No problem at all. Just glad you're able to help out with this. I have to admit, this is now waaaay beyond me and I have absolutely no idea how this is doing it's magic. Something's not quite right though - on frame 1 we see the formed sentence, then at frame 2 scrambled text and at frame 3 the "decode" process starts. However, what I'm hoping it would do is showing randomly scrambled letters animating up until the "tStart" at which point the decode process begins and runs until "tSop". Not sure if that makes sense.

Anyhow, thanks again for helping out.


Return to posts index

Kevin Camp
Re: decode effect based on a Dan Ebberts expression
on May 2, 2014 at 9:42:28 pm

it sounds like you don't need it to repeat, so i omitted that part, but this should do it.

essentially it just uses the original expression until time exceeds the tStart time, then it does the modified expression.

choices = "GTCA";
str = "THIS IS THE TEXT STRING THAT APPEARS";
tStart = 1; //time at which the animation starts
tStop = 4; //time at which the animation stop
cps = 20; // characters per second

if (time < tStart){
seed = Math.floor(time*cps);
seedRandom(seed,true);
s = "";
for (i = 0; i < str.length; i++){
idx1 = Math.floor(random(choices.length));
s += choices[idx1];
}
}
else if (time >= tStart && time < tStop){
seed = Math.floor(time*cps);
seedRandom(seed,true);
s = "";
sRand = "";
for (i = 0; i < str.length; i++){
idx1 = Math.floor(random(choices.length));
idx2 = Math.floor(linear(time,tStart,tStop,0,1)*str.length);
sRand += choices[idx1];
s = str.substr(0,idx2) + sRand.substr(idx2,str.length);
}
}else{
s = str;
}
s


Kevin Camp
Art Director
KCPQ, KZJO & KRCW


Return to posts index

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