Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions offset position based upon percentage

  • offset position based upon percentage

    Posted by Adam Taylor on August 4, 2009 at 7:55 pm

    I have two text layers – identical text but one has a much larger font size. I want to parent them both to a null which offsets the y position based upon a percentage figure from a slider.

    I have a feeling the best way to achieve this is with an expression, unfortunately I have no idea how to do this!!

    please can someone point me in the right direction?

    thanks
    Adam

    Adam Taylor
    Video Editor/Audio Mixer/ Compositor/Motion GFX/Barista
    Character Options Ltd
    Oldham, UK

    http://www.sculptedbliss.co.uk

    Nick Hill replied 16 years, 9 months ago 2 Members · 1 Reply
  • 1 Reply
  • Nick Hill

    August 17, 2009 at 8:15 pm

    Hi Adam

    Assuming the width/height of each text layer is irrelevant in determining its position (AE doesn’t give you a way to find this out with expressions) I would try this:

    1) add two Slider controls to the null. Call one something like MaxDisplacement and the other Percentage. Percentage would go from 0 to 1; MaxDisplacement is the maximum amount you want each layer to move.

    2) in the Position property of each text layer do something like this (you may need to change the names depending on your comp)

    maxDisp = thisComp.layer(“Null”).effect(“MaxDisplacement”)(“Slider”);
    perc = thisComp.layer(“Null”).effect(“Percentage”)(“Slider”);
    dy = maxDisp * perc;
    [transform.position[0], transform.position[1] + dy]

    Move the Percentage slider between 0 and 1 to move each layer up or down to the maximum value of MaxDisplacement. You can still position each layer because its position is taken into account in the expression.

    Hope this helps

    Nick

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