FORUMS: list search recent posts

Expression error with a "bounce-decay-stop" expression

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
K. Marie McCarthy
Expression error with a "bounce-decay-stop" expression
on Mar 8, 2019 at 3:53:25 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 }


Return to posts index

Oleg Pirogov
Re: Expression error with a "bounce-decay-stop" expression
on Mar 9, 2019 at 1:31:38 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.


Return to posts index

K. Marie McCarthy
Re: Expression error with a "bounce-decay-stop" expression
on Mar 12, 2019 at 12:49:30 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.



Return to posts index


Oleg Pirogov
Re: Expression error with a "bounce-decay-stop" expression
on Mar 12, 2019 at 1:45:58 am

Which version of AE is it?


Return to posts index

K. Marie McCarthy
Re: Expression error with a "bounce-decay-stop" expression
on Mar 12, 2019 at 1:49:44 am

CC 2019


Return to posts index

Oleg Pirogov
Re: Expression error with a "bounce-decay-stop" expression
on Mar 12, 2019 at 3:30:54 am

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


Return to posts index


K. Marie McCarthy
Re: Expression error with a "bounce-decay-stop" expression
on Mar 14, 2019 at 3:50:27 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.


Return to posts index

Oleg Pirogov
Re: Expression error with a "bounce-decay-stop" expression
on Mar 13, 2019 at 3:46:47 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).


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]