Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Use markers to drive text highlight and fade

  • Use markers to drive text highlight and fade

    Posted by Justin Crowell on November 12, 2024 at 2:35 am

    I’ve been thinking about this and, here is what I’m trying to accomplish: Ideally, each time we reach a marker a word would go to 100% opacity and then immediately start fading. That fade would continue as we hit the next marker/word, with something like a 1.5 second delay.

    Howdy,

    I have markers (on another layer) driving a text highlight by animating the offset of an animator.

    I have one animator set zero opacity, full range.

    Then the second animator set to 100% opacity, range of one word, then I apply this expression to the offset:

    let myMarkers = thisComp.layer(index-3).marker;

    let n = myMarkers.nearestKey(time).index; // get index of the closest key in time

    if (time < myMarkers.key(n).time) { n–; } // make sure n == most recent key index only

    linear(time,myMarkers.key(n-2).time,myMarkers.key(n-1).time,n-2,n-1);

    It does a good job of highlighting the selected word, but it’s not easing at all–just looks like I have hold keyframes for each value.

    Any thoughts? Or maybe a different way to do this. My other thought was to ease the opacity from 100 to 0 each time we hit a new marker, but that seems like it could have the same problem.

    Thanks!

    Dan Ebberts
    replied 1 month ago
    2 Members · 2 Replies
  • 2 Replies
  • Justin Crowell

    November 12, 2024 at 5:32 pm

    Sorry to waffle on this but…it looks like my client wants it the way I had it initially, so:

    Basically I just want to emulate what it looks like if you add a linear keyframe to the offset every time we hit a marker. So I’d like to use either a linear or ease function to go to the next offset value each time we arrive at a marker. No need to do the complex fade-down stuff, I think.

  • Dan Ebberts

    November 12, 2024 at 11:24 pm

    I’m not sure how helpful this will be, but it might give you some ideas. For your text layer, add an opacity Animator and set the Opacity value to 0. Then add an Expression Selector and delete the Range Selector. Set the Expression Selector’s “Based On” property to “Words”. Then add this expression to the Expression Selector’s Amount property:

    m = thisComp.layer(index-3).marker;
    val = 100;
    fadeTime = 1.5;
    if (m.numKeys > 0){
    n = m.nearestKey(time).index;
    if (time < m.key(n).time) n--;
    if (n > 0){
    if (textIndex <= n){
    t = time - m.key(textIndex).time;
    val = linear(t,0,fadeTime,0,100)
    }
    }
    }
    val

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy