How to Get Correct Text Layer Size in After Effects

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ม.ค. 2025

ความคิดเห็น • 29

  • @GrahamCross-l5h
    @GrahamCross-l5h ปีที่แล้ว

    Surely if you parented the underline to the text layer - it would simply follow the scale of the text layer?

  • @DaleplayUy
    @DaleplayUy 3 ปีที่แล้ว +6

    Great tutorial! After finishing it, I´ve made a simplified version of the code:
    yourTextLayer = thisComp.layer("text");
    x = yourTextLayer.sourceRectAtTime().width * yourTextLayer.transform.scale[0]/100;
    y = value[1];
    [x,y];

    • @andrewj22
      @andrewj22 2 ปีที่แล้ว

      Yeah, the expression provided is unnecessarily convoluted.

  • @RHStevens1986
    @RHStevens1986 5 ปีที่แล้ว +4

    Literally looking for this solution in the last 24 hours

  • @IDMovieZwijndrecht
    @IDMovieZwijndrecht 5 ปีที่แล้ว +1

    You're on a roll! Thanks bro!

    • @ukramedia
      @ukramedia  5 ปีที่แล้ว

      Thank YOU! 😁

  • @SashaFromSaintP
    @SashaFromSaintP 5 ปีที่แล้ว +1

    Instant like to Sergei!

  • @steilvorlageDE
    @steilvorlageDE ปีที่แล้ว

    Great stuff, but why didn't you pickwhip the scale and multiplied it with x/100?

  • @pilemedya
    @pilemedya 4 ปีที่แล้ว +1

    hi thank you great job but your script does not work in my after fx 2020 do you know why can you help me
    targetLayer = thisComp.layer("mavianemon");
    this line mostly error
    w = targetLayer.sourceRectAtTime().width;
    and this too if i delete other line

  • @krithivasramamurthy4838
    @krithivasramamurthy4838 3 ปีที่แล้ว +1

    Thank you Sergei!

  • @vinteeum
    @vinteeum 5 ปีที่แล้ว +3

    how can I do this but using a composition instead of a shape?

  • @BenAha
    @BenAha 4 ปีที่แล้ว +7

    there's an error in height code. should be:
    CODE FOR HEIGHT:
    ...
    finalSize = h + p * h;

  • @ovidiumurzea
    @ovidiumurzea 4 ปีที่แล้ว +1

    What if I add a space at the end of the word? How can I make the shape extend so it underlines the space character as well?

  • @bolshooylenny
    @bolshooylenny 5 ปีที่แล้ว +2

    Hi Sergey, can you tell please what plugin or extension you use in expressions console because in your video I saw interactive expressions and menus with operators, it is like in sublime text editor, please suggest where I can find it?

  • @Climberfx
    @Climberfx 3 ปีที่แล้ว +2

    Great, thank you!

  • @KanugulaRohith
    @KanugulaRohith 4 ปีที่แล้ว

    Your video card does not support the selected configuration please reduce the layer size

  • @nickjames5602
    @nickjames5602 11 หลายเดือนก่อน

    I copied this code verbatim word for word and can't get anything to work. Is this code still valid in 2024 with After Effects 2024?

  • @VideofoundryNet
    @VideofoundryNet 3 ปีที่แล้ว +1

    p = (s - 100) * .01
    finalSize = w + p * w
    This is the same as:
    finalSixe = s * .01 * w
    So all you have done is to scale w by the scale parameter?

    • @andrewj22
      @andrewj22 2 ปีที่แล้ว

      Exactly what I was going to say. It's an unnecessarily convoluted way of calculating it.
      Why would you subtract 100 from the percent in one line, then add it back in ("w +") in the next?? Bizarre.

  • @keithhopkin
    @keithhopkin 4 ปีที่แล้ว +1

    Just saved my life

    • @ukramedia
      @ukramedia  4 ปีที่แล้ว

      That's great to hear! Thanks for watching, Keith!

  • @HuyLe2607
    @HuyLe2607 4 ปีที่แล้ว

    But it's suitable for text that aligns center only. With aligning left and right, the shape does not work. :(

    • @ChupoCro
      @ChupoCro 3 ปีที่แล้ว +1

      For left aligned text you have to move the anchor point of the line (rectangle shape) to the left. For example if you have a layer "Letters" with the text and another layer with Rectangle 1 shape for the line then the expressions would be:
      Rectangle path size:
      [thisComp.layer("Letters").sourceRectAtTime().width, value[1]]
      Transform: Rectangle 1 anchor point:
      [-content("Rectangle 1").content("Rectangle Path 1").size[0]/2, 0]
      Transform:
      thisComp.layer("Letters").transform.position

    • @BroskiiFX
      @BroskiiFX 3 ปีที่แล้ว

      @@ChupoCro Where would this go along with his coding? I'm a little lost here.

  • @daryljudd9190
    @daryljudd9190 5 ปีที่แล้ว +2

    Nice script, but wouldn't a simpler way be to just parent the shape layer to the text layer? That's how I've done it.

    • @andrewj22
      @andrewj22 2 ปีที่แล้ว

      Parenting combined with the expression would behave differently; for one, the line wouldn't stay the same thickness when scaling. Or, if you're suggesting just parenting with no expression at all, then when you want to create a second version with different text, the box wouldn't be the right size.

  • @osalomono
    @osalomono 4 ปีที่แล้ว +1

    It is likely that anyone watching this type of video is an advanced expressions user or writer, you don't have to waste time explaining how Array values work, or that the position property is defined using arrays. Hopefully this is not the case of padding your video to reach a particular duration. Better time could have been spent explaining the Math behind the finalSize value.
    Thanks for sharing

    • @WolfGodwin
      @WolfGodwin 3 ปีที่แล้ว +2

      It is thanks to Ukramedia not assuming people know everything about expressions that I am able to learn more and increase my productivity in AE.