Forum Replies Created

Page 91 of 1081
  • Dan Ebberts

    May 2, 2022 at 6:52 pm in reply to: TypeMonkey versus word-by-word subtitles

    Instead of applying the expression to the source text, you could use the same concept, but use an opacity animator. Set the opacity of the animator to 0%, In the Advanced section of the range selector, set Units to Index and Based On to Words, and set Smoothness to 0%. Apply this expression to the End property:

    text.sourceText.value.split(" ").length

    and this expression to the Start property:

    val = 0;

    t = text.sourceText;

    m = marker;

    if (t.numKeys > 0 && m.numKeys > 0){

    k = t.nearestKey(time).index;

    if (time < t.key(k).time) k --;

    if (k > 0){

    n = m.nearestKey(time).index;

    if (time < m.key(n).time) n--;

    if (n > 0){

    nCount = 0;

    nTemp = n;

    while (nTemp > 0 && (m.key(nTemp).time >= t.key(k).time)){

    nCount++;

    nTemp--;

    }

    val = nCount

    }

    }

    }

    val

    Something like that.

  • Dan Ebberts

    May 2, 2022 at 4:28 pm in reply to: TypeMonkey versus word-by-word subtitles

    I’m not sure this is exactly right, but it should be close:

    str = "";

    m = marker;

    if (numKeys > 0 && m.numKeys > 0){

    k = nearestKey(time).index;

    if (time < key(k).time) k --;

    if (k > 0){

    n = m.nearestKey(time).index;

    if (time < m.key(n).time) n--;

    if (n > 0){

    nCount = 0;

    nTemp = n;

    while (nTemp > 0 && (m.key(nTemp).time >= key(k).time)){

    nCount++;

    nTemp--;

    }

    if (nCount > 0){

    txt = value.split(" ");

    str = txt.slice(0,nCount).join(" ");

    }

    }

    }

    }

    str

  • My experience is that trying to simulate radio button functionality with checkboxes will never quite work correctly and will just lead to frustration. Use a dropdown menu control instead.

  • Dan Ebberts

    April 29, 2022 at 4:19 pm in reply to: Script Button with Modifier Key

    I don’t think you can do exactly what you’re asking for, but you can check for modifier keys inside your onClick function. To check for the shift key key, you would do something like this:

    var myState = ScriptUI.environment.keyboardState;

    if (myState.shiftKey){

    // do shift + click function

    }else{

    // do regular click function

    }

    It’s in the JavaScript Tools Guide.

  • Dan Ebberts

    April 28, 2022 at 7:28 pm in reply to: TypeMonkey versus word-by-word subtitles

    It’s hard to picture exactly what you’re after. Maybe you could describe that a little more (rather than focus on the tools you have tried).

  • It sounds like it might be pretty much the worst case scenario, where you have to use the brute force, frame-by-frame method to find the trigger event. This is a simple example where the expression needs to find when the slider has reached its ID value (which is 10 in this example) and will scale up, hold, and scale down from that point:

    slider = thisComp.layer("Controls").effect("Slider Control")("Slider");

    myID = 10;

    scaleMult = 1.1;

    scaleUpTime = 1.0;

    holdTime = 1.0;

    scaleDnTime = 1.0;

    if (slider.value >= myID){

    t = time;

    while (slider.valueAtTime(t) >= myID){

    t -= thisComp.frameDuration;

    }

    deltaT = time - t + thisComp.frameDuration;

    if (deltaT > scaleUpTime + holdTime + scaleDnTime){

    value;

    }else if (deltaT > scaleUpTime + holdTime){

    linear(deltaT,scaleUpTime + holdTime, scaleUpTime + holdTime + scaleDnTime,value*scaleMult,value);

    }else if (deltaT > scaleUpTime){

    value*scaleMult;

    }else{

    linear(deltaT,0,scaleUpTime,value,value*scaleMult);

    }

    }else

    value

    It assumes that the slider value always increases. The longer your comp is, the worse the performance will get. Hopefully this will get you started.

  • How are you animating the slider value, and how will the expression know which slider value it needs to respond to?

  • Dan Ebberts

    April 26, 2022 at 2:58 pm in reply to: After Effects Position Expression

    This should randomly select the position of any layer except the one with the expression:

    minDur = .5;

    maxDur = 1.5;

    t = tPrevT = inPoint;

    seedRandom(index,true);

    while (t <= time){

    tPrev = t;

    t += random(minDur,maxDur);

    }

    seedRandom(tPrev,true);

    L = [];

    for (i = 1; i <= thisComp.numLayers; i++){

    if (i == index) continue;

    L.push(i);

    }

    fromComp(thisComp.layer(L[Math.floor(random(L.length))]).transform.position)

  • Dan Ebberts

    April 26, 2022 at 12:09 am in reply to: After Effects Position Expression

    I think we need more info. Please be more descriptive about what you’re trying to do.

  • Dan Ebberts

    April 24, 2022 at 11:31 pm in reply to: text colour based on position/index in word

    textIndex only works for expressions applied to the Amount property of an Expression Selector. Did you maybe not set that up correctly?

Page 91 of 1081

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