Forum Replies Created

Page 7 of 277
  • Filip Vandueren

    July 4, 2023 at 1:42 pm in reply to: Keyframes offset and duration expression

    Do you want to actually move the keyframes with a script, or have the dynamic result of it, using an expression ?

  • Hello Suzann, it’s hard to troubleshoot without actually sitting in front of the project.

    I would try tracking the shoulders/hair with Mocha AE, maybe that has enough detail to do a precise track. Depending on the number of frames you need to fill in like this, it may be faster to do the positioning manually frame by frame, using the difference mode to aid in lining up an overiszed patch-layer with the surrounding areas that are visible, then masking it off to be a bit smaller afterwards.

    Hope that helps

  • Hello Liran,

    the solution is this:

    text.sourceText.style.setFont("Custom Font-Regular").setText("custom text from CSV");
  • Just for fun, here it is as a one-liner in Javascript:

    "TRAINDODGE".split("").reduceRight( (output,val,ind,arr) => output+=arr.splice(random(arr.length),1) ,"");
  • Filip Vandueren

    July 3, 2023 at 10:08 am in reply to: Moving something to position x at frame 20

    Hi Silvestro,

    the basic principle would be to calculate the variable dimensions of the text using thisComp.layer(“text”).sourceRectAtTime();

    This is pretty in-depth look at that: https://www.youtube.com/watch?v=CVliDoNgoCg

    Then you can use linear()-or ease() functions to then create the animation from [0,0] to a value calculated form the sourceRect

    Some contents or functionalities here are not available due to your cookie preferences!

    This happens because the functionality/content marked as “Google Youtube” uses cookies that you choosed to keep disabled. In order to view this content or use this functionality, please enable cookies: click here to open your cookie preferences.

  • Filip Vandueren

    July 3, 2023 at 9:54 am in reply to: Texts in two line

    Hi Arun,

    looks like your File -> Project Settings -> Expressions -> Engine is set to “Legacy Extendscript” (it needs to be Javascript)

    or, if you don’t see that setting, you are in a version of After Effects that doesn’t support font styles via expressions.

  • Yes, I can’t consistently get it to stop from sometimes glitching either.

    So I think there’s no way to get some solution like this “production-ready” or fool-proof.

  • Filip Vandueren

    June 29, 2023 at 5:21 pm in reply to: Texts in two line

    Hello Arun,

    I would use a textbox to automatically limit the horizontal length of the lines, and have a hidden textlayer that tries different fontsizes untill it finds thethreshold of where it becomes a three line text.

    Like this:

    – make a text-box that has the horizontal size that you want to wrap at, but make it plenty tall so it fits at least 3 lines.

    – give the sourceText this expression:

    maxFontSize=100;

    fs = maxFontSize - timeToFrames(time);

    style.setFontSize(fs);

    Starting from 0, it will try all integer fontsize starting from your desired maximum/default fontsize.

    – give this text-layer a slider control effect, I renamed it to “optimal FontSize” and give it this expression:

    posterizeTime(0);
    maxFontSize=100;
    function estimateLines(l,t) {
    st = l.text.sourceText.getStyleAt(1,t);
    ld = st.autoLeading ? st.fontSize*1.2 : st.leading;
    return Math.ceil(l.sourceRectAtTime(t).height/ld);
    }
    for (f=0; f<maxFontSize; f++) {
    t=framesToTime(f);
    if (estimateLines(thisLayer, t)<=2) break
    }
    text.sourceText.getStyleAt(1,t).fontSize;

    (alternatively this could be done witha binary search algoritmh instead of a frame by frame scan)

    The resulting fontSize is the first one fits in exactly 2 lines.

    You can hide the current layer, and use the calculation in a second text-layer like this:

    The second Textlayer should also be a textbox with the desired wrapping width and this expression for sourceText:

    posterizeTime(0);
    txt = thisComp.layer("input txt").text.sourceText;
    st = thisComp.layer("input txt").text.sourceText.style;
    st
    .setFontSize(thisComp.layer("input txt").effect("optimal FontSize")("Slider").value)
    .setAutoLeading(false)
    .setLeading(effect("leading")("Slider").value)
    .setText(txt);

    as you see, it now references the contents of the original text, the optimal fontsize, and a new effects slider where you can dial in the desired leading

  • Filip Vandueren

    June 29, 2023 at 9:33 am in reply to: Count Shape Layers

    Here’s one way to do it:

    assuming I want to check three layers that are layers 1, 2, and 3 and see if their position is less than 100 pixels form my target layer.

    I’m also assuming non of these layers are parented for now.

    I would give the text-layer’s sourceText property this expression:

    num = 0;
    for (i=1; i<4; i++) {
    if (length(thisComp.layer(i).position - thisComp.layer("target").position)<100) {
    num++;
    }
    }
    num;

    This straight line distance works better for 100×100 circles. You could change it to <1 and it will only count if they are at the exact same location.

    For squares that are all 100×100 pixels this kind of check is maybe better:

    num = 0;
    for (i=1; i<4; i++) {
    if (
    Math.abs(thisComp.layer(i).position[0] - thisComp.layer("target").position[0])<100
    &&
    Math.abs(thisComp.layer(i).position[1] - thisComp.layer("target").position[1])<100
    ) {
    num++
    }
    }
    num

  • Filip Vandueren

    June 29, 2023 at 9:24 am in reply to: Left aligned text in comp centre

    Hey Joe,

    since you’re already using 2 layers for the two lines, and the second layer is parented to the first, all you would need is for layer 2 to have this expression for position:

    [thisLayer.parent.sourceRectAtTime().left - thisLayer.sourceRectAtTime().left, value[1]];

    You can still tweak the vertical position of the 2nd line.

Page 7 of 277

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