Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression to get Gradient Ramp to follow text size.

  • Expression to get Gradient Ramp to follow text size.

    Posted by Mervin James on November 24, 2019 at 11:36 pm

    Hi guys is there an expression to get a gradient ramp effect to adjust to the size of the text. So if the text is shorter or longer then the ramp would adjust to it.
    Also is there an expression i can use to get the gradient ramp to follow moving text as currently I can only achieve it with adding a gradient overlay from layer styles and there for I lose the ability to connect the colors to a color control?

    Thanks in advance

    Mervin James replied 6 years, 5 months ago 2 Members · 2 Replies
  • 2 Replies
  • Cassius Marques

    November 25, 2019 at 7:22 pm

    I guess you only need the answer for the first question. That alone would make it follow the text anyway.

    if you mean horizontally then:

    start of ramp
    L = thisLayer;
    rect = L.sourceRectAtTime(time,false);
    x = L.toComp([rect.left,0])[0];
    y = L.toComp([rect.left,0])[1];
    [x,y]

    end of ramp
    L = thisLayer;
    rect = L.sourceRectAtTime(time,false);
    x = L.toComp([rect.left+rect.width,0])[0];
    y = L.toComp([rect.left,0])[1];
    [x,y]

    If you want vertically then:

    L = thisLayer;
    rect = L.sourceRectAtTime(time,false);
    x = L.toComp([rect.left+rect.width/2,0])[0];
    y = L.toComp([rect.height,0])[1];
    [x,y]

    L = thisLayer;
    rect = L.sourceRectAtTime(time,false);
    x = L.toComp([rect.left+rect.width/2,0])[0];
    y = L.toComp([rect.height,-150])[1];
    [x,y]

    This are the results of me messing with code posted by someone (probably Dan) somewhere here. I’ve used before, its not perfect but it works.

    Cassius Marques
    http://www.zapfilmes.com

  • Mervin James

    November 28, 2019 at 7:31 am

    Works perfectly ????????. Thank you very much for your help. ????

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