Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions How to find if a property is animated?

  • How to find if a property is animated?

    Posted by Lord Scales on May 17, 2007 at 9:33 pm

    Hi there! I just would like to know if there is a way to detect if a property is animated, to do something like this (example only):

    x = thisComp.activeCamera.position
    if (x is animated) {this} else {that}

    Thank you.

    Lord Scales

    Lord Scales replied 18 years, 11 months ago 3 Members · 5 Replies
  • 5 Replies
  • Darby Edelen

    May 18, 2007 at 2:52 am

    I’m not sure what it is that you’re trying to accomplish, so this method might not work for you (it will only work if the property is currently changing/animating), but you could check the “.speed” of the property if its spatial. Otherwise you could compare the current value to the previous frame’s value to find out if the property is changing.

    Darby Edelen
    DVD Menu Artist
    Left Coast Digital
    Aptos, CA

  • Filip Vandueren

    May 18, 2007 at 11:46 am

    you can use numKeys, a value that is not keyframed is probably not animating:

    x = thisComp.activeCamera.position
    if (x.numKeys) {this} else {that}

    but, position may have an expression applied to it and no keyframes and that might also be considered animating: the scripting language has a method to check if a property has an expression, but you can’t do it from within an expression, I think.

    thye vamera could also be parented to a null: if that null is moving, is the camera ‘animated’ ?

  • Lord Scales

    May 18, 2007 at 5:02 pm

    Oh, thanks for help, but I already solved my problem changing completely the expression I was using.
    I just hope this new one wont take one year to render…

    amp = effect(“General Controls”)(“Flickering”);
    w = wiggle (2, amp);
    check = effect(“General Controls”)(“Use Light’s Intensity?”);
    idx = Math.round (effect(“General Controls”)(“Light Index”));
    l = thisComp.layer (idx);
    lPos = l.position;
    lInt = l.intensity;
    aC = thisComp.activeCamera;
    aCPos = aC.position;
    mInt = effect(“General Controls”)(“Intensity”) + w;
    lmInt = mInt + lInt + w;

    curDist = length (aCPos, lPos)
    maxLimit= 2500;
    minLimit = 0
    lmtedLen = clamp (curDist, minLimit, maxLimit);
    FI = linear (lmtedLen, minLimit, maxLimit, mInt, mInt/10);
    FII = linear (lmtedLen, minLimit, maxLimit, lmInt, lmInt/10);
    FIDiv = linear (FI, mInt, mInt/10, 15, 1);
    FIIDiv = linear (FII, lmInt, lmInt/10, 15, 1);
    finFI = linear (FI, mInt, mInt/10, mInt, mInt/FIDiv);
    finFII = linear (FII, lmInt, lmInt/10, lmInt, lmInt/FIIDiv);
    FIMult = linear (FI, mInt, 0, .2, 2);
    FIIMult = linear (FII, lmInt, 0, .2, 2);

    if (check == 1) {
    finFII*FIIMult
    } else {
    finFI*FIMult
    }

    This applied in a slider. In the main one I used this:

    intSlider = effect(“Intensity”)(“Slider”);

    if (Math.floor (intSlider <= 3)) { 0 } else { intSlider } Will it take too much time to render? Lord Scales

  • Filip Vandueren

    May 18, 2007 at 5:10 pm

    Doesn’t seem to be too computationally expensive…

    the main slowdowners when it comes to expressions are expressions that can’t be calculated before another expression is calculated, especially when you’re chaining a lot of those together.
    Like 100 copies of: thisComp.layer(index-1).position

    or expressions that loop through time to calculate a lot of values for averaging out, etc.

    Don’t forget, you can always convert your expression to keyframes.
    I sometimes change my comps framerate to a smaller number, or even 1fps, to create fewer keyframes, then switch back.

  • Lord Scales

    May 18, 2007 at 7:27 pm

    I thought it could be once I use a lot of linear() function. But now I created a better and simplified expression to do the same and I am using less if them.

    I hate when it creates 1 keyframe to every single frame. I think they could make AFX more intelligent in this task of converting expressions to keyframes. It could take 1 or 2 seconds more but anyway it’d be better.

    While they don’t, I am going to use your strategy!

    Lord Scales

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