-
Expression error with a “bounce-decay-stop” expression
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 }
