Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Trigger animation start when certain values are achieved

  • Trigger animation start when certain values are achieved

    Posted by Darko Bosic on February 10, 2020 at 5:32 pm

    Hi, Darko here,
    I’m having some problems with my expression.

    Let’s say I want to trigger opacity of one object A going from 0 to 100 when another object B reaches position of x = 500 and y = 500 or grater.
    I’ve made trigger and it works fine, but I can’t wrap my head around how to make it animated and not just instant.
    Right now when object B reaches x = 500 and y = 500 opacity just jumps from 0 to 100.

    Here is my expression so far:

    o = transform.opacity;
    objBx = thisComp.layer("Object B").transform.position[0];
    objBy = thisComp.layer("Object B").transform.position[1];

    if (objBx > 500 && objBy > 500){
    o = 100;
    }
    else{
    o = 0;
    }

    I want to make this without any keyframes, and I think that’s where things get complicated. I’ve tried using linear and ease expressions but I think don’t understand them really good and can’t get them to work.

    Thanks for your time and help!

    Darko Bosic

    Robin De man replied 6 years, 2 months ago 2 Members · 3 Replies
  • 3 Replies
  • Robin De man

    February 12, 2020 at 10:33 am

    Is it an option to use the linear function?

    var o = transform.opacity;
    var objBx = thisComp.layer("Object B").transform.position[0];
    var objBy = thisComp.layer("Object B").transform.position[1];
    var objPos = objBx + objBy;

    o = linear(objPos, 0,1000, 0, 100);

  • Darko Bosic

    February 12, 2020 at 1:12 pm

    If I’m understanding your code correctly, you are getting one value from two dimensional values and that doesn’t work for me. Also in linear(objPos, 0,1000, 0, 100) second and third arguments gave me some really strange results. I think the problem is that my arguments in if statement are spacial and so are arguments in linear.
    I’ll keep on trying different stuff until I get it!

    Thanks for the help!

    Darko Bosic

  • Robin De man

    February 12, 2020 at 1:25 pm

    I made a small setup with the linear function in, maybe it helps.
    https://www.dropbox.com/s/y6cy1kveamifw1g/transparant-position.zip?dl=0

    its a AE cc 2018 file

    gr Robin

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