Forum Replies Created

Page 2 of 6
  • Hi John, try this:

    1. Create a Null with 2 sliders called Total Width & Spacing, and apply the following expression to the Total Width slider:

    const spacing = effect("Spacing")("Slider").value;

    let totalWidth = 0;

    let rectTime = time;

    if (thisLayer.marker.numKeys) {

    rectTime = thisLayer.marker.key(1).time;

    }

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

    const L = thisComp.layer(i);

    if (L.hasParent && L.parent.index == thisLayer.index) {

    totalWidth += L.sourceRectAtTime(rectTime).width + spacing;

    }

    }

    totalWidth - spacing;

    2. Make sure your text layers are left-aligned, parent them to the Null, and use the following code for your text layers’ position:

    const spacing = parent.effect("Spacing")("Slider").value;

    const totalWidth = parent.effect("Total Width")("Slider").value;

    const center = thisComp.width / 2;

    let x = center - (totalWidth / 2);

    let rectTime = time;

    if (parent.marker.numKeys) {

    rectTime = parent.marker.key(1).time;

    }

    for (let i = thisComp.numLayers; i > index; i--) {

    const L = thisComp.layer(i);

    if (L.hasParent && L.parent.index == parent.index) {

    x += L.sourceRectAtTime(rectTime).width + spacing;

    }

    }

    parent.fromComp([x, parent.transform.position[1]]);

    If you want to start a new line, you can create a new Null and parent all related text layers to that Null – then you can control the line spacing with your Nulls’ Y positions.

    Regarding text animators, you can use a marker on the Null layer as the sampling time for the layout.

    LMK if that works!

  • Julian Chojnacki

    April 4, 2024 at 12:49 pm in reply to: kinetic typography with radial wave movement

    If you only need a fixed layout like a grid, a one-layer solution would definitely render much faster

  • Julian Chojnacki

    April 4, 2024 at 12:21 pm in reply to: kinetic typography with radial wave movement

    Sure, is a second (invisible) text layer for the calculations ok?

    The radius is a great addition btw, I totally forgot about that!
    You could even go fancy and apply separate radii to dx & dy directly in the center variable.

  • Julian Chojnacki

    April 4, 2024 at 3:26 am in reply to: kinetic typography with radial wave movement

    Hi Oleg,

    add 2 sliders to your layer called Anim and Delay and try the following code on an expression selector either based on characters or words:

    const ti = textIndex - 1;

    const { basedOn } = thisProperty.propertyGroup(1);

    const anim = effect("Anim")("Slider");

    const delay = effect("Delay")("Slider").value;

    const lines = text.sourceText.value.split(/\n|\r|\3/);

    let lineIndex = itemsInLine = totalCount = 0;

    for (let line of lines) {

    const count = basedOn == 3 ? line.split(" ").length : line.length;

    totalCount += count;

    if (totalCount > ti) {

    itemsInLine = count;

    break;

    }

    lineIndex++;

    }

    const colIndex = ti - (totalCount - itemsInLine);

    const dx = colIndex - (itemsInLine - 1) / 2;

    const dy = lineIndex - (lines.length - 1) / 2;

    const center = Math.hypot(dx, dy);

    anim.valueAtTime(time - framesToTime(delay) * center);

    // anim.valueAtTime((time - framesToTime(delay) * center) % (anim.key(anim.numKeys).time));

    Now animate the slider and tweak your delay as you wish 🙂

    You can easily create a looping radial wave animation using loopOut() on the Anim slider or with the code I commented out in the last line.

    Just watch out when using paragraph/boxText: this won’t work unless you add your linebreaks manually.

  • Julian Chojnacki

    March 28, 2024 at 9:40 am in reply to: Paragraph Alignment Detection

    Amazing, thank you Filip 🙏

    The only limitation I found so far is when using single-char strings, since tracking requires at least 2 characters to be effective. But I can’t think of a scenario where detecting the alignment of a single char would be necessary 😀

  • Hi! You’re almost there, but instead of adding the layer index i to result, you should add 1 each time you find a layer named “Depth”. Also, remove the break statement to ensure the loop continues to check all layers even if your condition is met.

  • Julian Chojnacki

    March 19, 2024 at 11:14 am in reply to: Paragraph Alignment Detection

    Yeah for sure – it works great! 🙂 You truly thought outside the box there haha

    Could you shed some light on the mechanics of this approach? Curious what’s going on under the hood.

  • Julian Chojnacki

    March 17, 2024 at 4:57 pm in reply to: Paragraph Alignment Detection
  • Julian Chojnacki

    March 17, 2024 at 4:07 pm in reply to: Paragraph Alignment Detection

    Hi Filip,

    do you have any suggestions on how to detect the paragraph alignment of a box text?

    After running some tests this is the closest I got:

    const t = sourceRectAtTime(time, false);

    const b = sourceRectAtTime(time, true);

    const tc = t.left + t.width / 2;

    const bc = b.left + b.width / 2;

    const thr = t.width * 0.01;

    let al;

    if (Math.abs(tc - bc) <= thr) {

    al = 1; // Center

    } else if (tc < bc) {

    al = 0; // Left

    } else {

    al = 2; // Right

    }

    al;

    It kinda works, but it’s hit or miss – especially when changing the font size and text begins to overflow (thus my attempt to introduce a threshold). I genuinely have no clue how to detect center alignment with all the fluctuations 😀 Any ideas on how to nail this down? Or perhaps a different approach altogether? All ears for your expertise 😎

    Best!

  • Julian Chojnacki

    October 6, 2023 at 1:30 pm in reply to: Maintain logo position in resizing shape layer

    Hi Justin,

    you could either attach the logo’s position to the left edge of the box or to the right edge of your text with some margin. The exact code depends on your setup.

    Here are some examples:

    // Right edge of the text

    // Logo parented to your text layer

    const { left, width, top, height } = parent.sourceRectAtTime();

    const margin = 50;

    [left + width + 50, top + height / 2];

    // Right edge of the box

    // Logo parented to your box layer

    const { left, width, top, height } = parent.sourceRectAtTime();

    const margin = 50;

    [left + width - 50, top + height / 2];

    Let me know if this works for you

Page 2 of 6

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