Forum Replies Created

  • David Avila

    July 25, 2022 at 5:53 pm in reply to: valueAtTime() on a REGEX Text Layer

    Sorry for the thread bump, but I was wondering if it’s possible to have the nested composition’s time jump to 0 instead of the main-comp’s current time.

    var t = 0;

    var f = timeToFrames(time);

    t = time;

    while (f >= 0)

    {

    if ( checker() == 0 )

    {

    t = time - framesToTime(f);

    break;

    }

    else

    {

    f--;

    }

    }

    t


    I’d like to get something like if t > 0, timeRemap = 0, + 1 frame every time it meets the condition. I think it requires another while loop, but I’m not sure how to ‘store’ values.

    Currently, t can be anywhere, 100f – 110f; 505-515, etc. The nested composition’s animation is at 0f- 10f.

  • David Avila

    January 10, 2022 at 9:12 pm in reply to: valueAtTime() on a REGEX Text Layer

    I see!

    A friend reduced the expression down quite a bit:

    time - (function(f){
        while(f-- >= 0) if(!thisComp.layer("MasterEvalFunction").text.sourceText.valueAtTime(framesToTime(f+1)).includes("P2_Being_Hit: 1")) return framesToTime(f+1);
    })(timeToFrames(time))
  • David Avila

    January 10, 2022 at 7:11 pm in reply to: valueAtTime() on a REGEX Text Layer

    The two master-variables are being calculated every frame, so I was wondering how I would re-write the script to use them somehow. I just need for the comp’s timeRemap to jump and play from 0:00 while the value is true…Something like this:

    Edit, I figured it out but I was wondering if someone could please break down the way the while-loop works. A friend and I were talking about it and it’s kinda confusing, thank you.

    The expression:

    var masterEval = thisComp.layer("MasterEvalFunction").text.sourceText; var masterResult = masterEval.includes("P2_Being_Hit: 1"); // Original Script by Dan Ebberts txt = masterEval; t = 0; f = timeToFrames(time); if ( masterResult ) { t = time; while (f >= 0) { if ( !txt.valueAtTime(framesToTime(f) ).includes("P2_Being_Hit: 1") ) { t = time - framesToTime(f); break; } f--; } } t

  • David Avila

    January 9, 2022 at 6:21 pm in reply to: valueAtTime() on a REGEX Text Layer

    Well, valueAtTime() doesn’t work with strings or ints. IIRC, it has to be done on a property. My initial text layer is a whole paragraph which I truncate using REGEX — once I do that, valueAtTime() doesn’t work on the reference anymore.

    I’m trying to initialize a pre-comp’s animation whenever this text layer is ‘`1’, otherwise, freeze the pre-comp at 0:00. I believe in order to do this, valueAtTime() is necessary for the while-loop to work.

  • David Avila

    August 24, 2021 at 7:22 pm in reply to: toComp… I just don’t get it

    I hope it’s not rude to tack on a question concerning the toComp function:

    I’ve noticed that it requires two points. So when you want to use just one (x or y) point, you have to evaluate both, then pick one using the array syntax, right?

  • I realized I could have just done this to create the 2 lists.

    text = "";

    for (i = 1; i < 50; i++) {

    text +=

    labelName${[i]} = thisComp.layer("Checker").effect(${[i]}).name;</p><p>labelValue${[i]} = thisComp.layer("Checker").effect(${[i]})("Checkbox");</p><p>

    }

    text2 = "";

    for( j = 1; j < 50; j++){

    text2 +=

    labelName${[j]} + ":" + "" + labelValue${[j]} + "\\r" +</p><p>

    }

    text + "\r" + text2

  • David Avila

    June 7, 2021 at 10:05 pm in reply to: Triggering an animation using a Text Layer Value

    Actually, the first one is what I wanted. I should have mentioned it, but it’s just going to be a simple animation like a strobe that blinks on and off while the text is “On”, and then resets or disappears when it’s “Off”.

    In this new case, it holds it in its last position from before. I added an “else {n =0}” to your if-statement to reset it back to 0 so that it can replay once “On” comes up again.

    This is my version of your first script with the attendant comments:

    textResult = thisComp.layer("is_On_or_Off?").text.sourceText

    thisLayerTimeRemap = 0; // thisLayer = Pre-composed layer whose animation starts at 0:00

    if (textResult == "On"){

    thisLayerTimeRemap = time; // sets pre-composed layer's time remap value equal to this composition's time value

    playheadValue = timeToFrames(time); //this composition's playhead-value/time converted to frames

    while (playheadValue >= 0){

    if (textResult.valueAtTime(framesToTime(playheadValue)) == "Off"){ // checks if text-result says "Off"

    thisLayerTimeRemap = time - framesToTime(playheadValue); // keeps its value at zero as time advances

    break; // after setting the time-remap to 0, breaks out of the loop

    }

    playheadValue--; // subtracts 1 frame the playhead's time-value in order to move the animation forward by one frame.

    }

    }

    thisLayerTimeRemap // outputs the result of this layer's Time Remap value

  • David Avila

    June 7, 2021 at 8:18 pm in reply to: Triggering an animation using a Text Layer Value

    Thanks!

    I applied the expression to a pre-compsed layer’s Time Remapping expression. My pre-composed layer’s animation begins at 0 and whenever my Text Layer reads “On”, it begins to play the animation as long as the Text Layer says “On”. When the Text Layer goes to “Off”, the Time Remapping value goes back to 0.

    I believe I get most of it until the ‘break’ and the subtraction from ‘f’. Break terminates the while-loop after setting ‘t’ to 0 in the previous line? Subtracting one from ‘f’ is allowing the animation to increase by 1 frame at a time, right; it’s creating the 1 frame offset between the time remap’s value and the composition playhead value?

    I don’t know if it’s uncouth to post my own renamed and commented version of your script on here?

  • David Avila

    July 1, 2020 at 5:09 pm in reply to: Automatic font size on text based on its width

    Ahh, thanks.

    I needed to also do it for a long else-if statement. I figured it was the same way, setting the style and the text result in each of the “else if” outputs.

  • David Avila

    July 1, 2020 at 4:45 pm in reply to: Automatic font size on text based on its width

    speaking of font expressions, is there a way to have a text layer reference another layer, and have its own type of font-style-expression? like

    thisComp.layer("Main").text.sourceText.style.setFauxBold(1).setFauxItalic(1).setFontSize(900)

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