Activity › Forums › Adobe After Effects Expressions › text animator triggered by comp marker
-
text animator triggered by comp marker
Posted by Peter Zeet on June 14, 2012 at 3:53 amHi there!
I have one zillion comp markers with some specific words related to the actors speech inside most of them along almost 30 minute video
I have a text layer, and the source text has an expression so it reads the comments inside the markers (thanks to this post https://forums.creativecow.net/thread/227/16077 )The thing is… I need to have each word appearing with a subtle bouncy scale animation when they appear, (lets say when they pop up the go from 80% to 100% scale and then some subtle bouncy effect)
So on each marker, the text grows, and when we arrive to next marker, the new text appears growing nicely, and so on…I could do that using one zillion layers, but is really a pain, so I hope this workaround works… is that possible?
many thanks in advance!
Josh Good replied 11 years, 7 months ago 3 Members · 12 Replies -
12 Replies
-
Dan Ebberts
June 14, 2012 at 5:25 amI’m not sure if this is what you’re after, but it might get you headed in the right direction. Set your Scale Animator amount to 0% and apply this expression:
m = thisComp.marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n > 0){
t = time - m.key(n).time;
startVal = 0;
endVal = 100;
dur = 0.1;
if (t < dur){
s = linear(t,0,dur,startVal,endVal)
}else{
amp = (endVal - startVal)/dur;
freq = 3;
decay = 5;
w = freq*Math.PI*2;
s = endVal + amp*Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w
}
[s,s]
}else
value
Dan
-
Peter Zeet
June 14, 2012 at 12:24 pmyes! it`s really close! Is there a way to make the chars appear not as a whole word, but in order? (or random, but not as a whole word)
(as if you animated the in and out in a range selector) -
Dan Ebberts
June 14, 2012 at 3:07 pmTry adding an expression selector, deleting the range selector, and adding this expression to the expression selector amount:
maxDelay = .5;
seedRandom(textIndex,true);
myDelay = random(maxDelay);m = thisComp.marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n > 0){
t = time - (m.key(n).time + myDelay);
startVal = 100;
endVal = 0;
dur = 0.1;
if (t < dur){
s = linear(t,0,dur,startVal,endVal)
}else{
amp = (endVal - startVal)/dur;
freq = 3;
decay = 5;
w = freq*Math.PI*2;
s = endVal + amp*Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w;
}
[s,s]
}else
value
maxDelay determines how long it takes for all the characters to appear.
Dan
-
Josh Good
December 10, 2014 at 5:30 pmI have a text layer, and the source text has an expression so it reads the comments inside the markers on the text layer.
I’m wondering if there was a way to modify the expression so you can have the text from the previous marker still display after the play head hits the next marker. Just like you were animating a sentence with the text animator.
The text marker expression is applied to the source text.
The range selector is still on the text layer but the expression is added to the expression selector.Thanks in advance!
/* This is applied to source text*/
txt = value;
n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time > time) n--;
if (n > 0) txt = marker.key(n).comment;
}
txt/* This is applied to the scale expression selector*/
m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n > 0){
t = time - m.key(n).time;
startVal = 100;
endVal = 0;
dur =.3;
if (t < dur){
s = linear(t,0,dur,startVal,endVal)
}else{
amp = (endVal - startVal)/dur;
freq = 3;
decay = 5;
w = freq*Math.PI*2;
s = endVal + amp*Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w
}
[s,s]
}else
value -
Dan Ebberts
December 10, 2014 at 8:51 pmI’m not sure this is exactly what you’re after, but try it on source text and see if it helps you get there:
if (marker.numKeys > 0){
txt = "";
n = marker.nearestKey(time).index;
if (marker.key(n).time > time) n--;
for (i = 1; i <= n; i++){
txt += (i > 1 ? " " : "") + marker.key(i).comment;
}
txt
}else{
value
}
Dan
-
Josh Good
December 10, 2014 at 9:25 pmThanks for the quick reply!
That worked great. But the text started in the center then changed positions when the rest of the text was added by the other markers.
What I’m trying to do is have it animate on as a whole line of text like you can do by key framing the index property with the range selector in the text animator. I want the range index to be controlled by the layer markers. Do you know of anyway to do that?
Thanks a bunch!
-
Dan Ebberts
December 10, 2014 at 11:17 pmDo you maybe have your text layer center-justified? When I tested it (with a left-justified text layer), the text didn’t move once it came on screen–the new text just popped up on the right.
Dan
-
Josh Good
December 11, 2014 at 1:08 amYeah you were right it was center-justified. It works perfect now!
Thanks so much for your help!
You the man Dan!
-
Josh Good
December 11, 2014 at 2:17 pmOk last question.
I have the below expression applied to to amount property on the expression selector with the scale set at 0%.
The scaling effect happens on every word each time the playhead hits a marker and I only need the effect to happen once per word. Is there a way to do that?
-Thanks
m = marker;
n = 0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
}
if (n > 0){
t = time - m.key(n).time;
startVal = 100;
endVal = 0;
dur =.2;
if (t < dur){
s = ease(t,0,dur,startVal,endVal)
}else{
amp = (endVal - startVal)/dur;
freq = 3;
decay = 10;
w = freq*Math.PI*2;
s = endVal + amp*Math.sin((t-dur)*w)/Math.exp(decay*(t-dur))/w
}
[s,s]
}else
value
Reply to this Discussion! Login or Sign Up