Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expression error with a “bounce-decay-stop” expression

  • Expression error with a “bounce-decay-stop” expression

    Posted by K. marie Mccarthy on March 8, 2019 at 3:53 pm

    Hi there,

    I am brand new to expressions and am pulling my hair out over this one. I’m following a Lynda tutorial for creating animated type and the author provided an expression to use to create a bounce-decay-stop effect in a write-on text exercise. I copy and pasted it exactly in two different compositions and I keep getting the same error message:

    Error at line 1 in property ‘Position’ of layer XX in comp ‘XXX’

    expression result must be of dimension 2, not 1

    I don’t even know where to start in troubleshooting this; Google and forum searches aren’t giving me any additional clues. I would be deeply appreciative if someone could look at this expression and help me out. Thank you.

    Expression:
    cushioning = 3;
    freq = 2;
    rebond = false;
    if (numKeys > 1 && freq != 0 ){
    if (nearestKey(time).index == 1) { value }
    else {
    if (length(velocity) == 0) {
    tempsClefProx = nearestKey(time).time;
    if ( tempsClefProx <= time ) { tempsDebut = tempsClefProx }
    else { tempsDebut = key(nearestKey(time).index-1).time }
    temps = time – tempsDebut;
    spring = velocityAtTime(tempsDebut-thisComp.frameDuration) * ( .15/freq * Math.sin(freq * temps * 2 * Math.PI) / Math.exp( temps * cushioning) );
    if (rebond == 0) valueAtTime(tempsDebut) + spring;
    if (rebond == 1 && valueAtTime(tempsDebut-thisComp.frameDuration) > valueAtTime(tempsDebut)) valueAtTime(tempsDebut) + Math.abs(spring);
    if (rebond == 1 && valueAtTime(tempsDebut-thisComp.frameDuration) < valueAtTime(tempsDebut)) valueAtTime(tempsDebut) – Math.abs(spring);
    }
    else { value }
    }
    }
    else { value }

    K. marie Mccarthy replied 7 years, 4 months ago 2 Members · 7 Replies
  • 7 Replies
  • Oleg Pirogov

    March 9, 2019 at 1:31 am

    This error means that the expression is evaluated to be a number (dimension 1) and not a vector like [0,0] (dimension 2) which the Position property in 2D space should be.

    The given expression works fine for me as it is.

    The code is incompatible with the new AE 2019 JavaScript Engine and should raise an error (though I’m not sure which one exactly). Make sure you are not using this in AE 2019 without Legacy Engine turned on.

  • K. marie Mccarthy

    March 12, 2019 at 12:49 am

    Oleg—thanks so much for your response. I’ve kept trying to get this to work but no luck. I’ve noticed I only get the error message when I paste the expression into a layer with more than one keyframe. (See attached screen cap.) One keyframe, no error message, two keyframes, error message. Is this a clue?

    Incidentally, even when I get the expression successfully placed into the layer, the behavior doesn’t even work. There’s no bounce/decay/stop.

  • Oleg Pirogov

    March 12, 2019 at 1:45 am

    Which version of AE is it?

  • K. marie Mccarthy

    March 12, 2019 at 1:49 am

    CC 2019

  • Oleg Pirogov

    March 12, 2019 at 3:30 am

    So, have you tried it with Legacy ExtendScript (File -> Project Settings)?
    This expression won’t work for default AE CC 2019 expression engine.

  • Oleg Pirogov

    March 13, 2019 at 3:46 am

    I’ve just noticed this comparison:
    valueAtTime(tempsDebut-thisComp.frameDuration) < valueAtTime(tempsDebut)
    It is not THE problem, cause with rebond = false; it’s not evaluated, but it hints that the expression was meant for 1D properties and in general should not be applied for 2D-properties like Position in your example (cause for 2D properties this becomes “<” vector comparison which doesn’t make any sense).

  • K. marie Mccarthy

    March 14, 2019 at 3:50 pm

    You’re a star! This was exactly the problem. I changed the settings to Legacy ExtendScript and the expression worked. I’ll have to do some more research on this issue and how it might affect my expressions in the future. Thank you so much for helping me on this; I would have never figured it out on my own.

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