amorti = effect( dampening )(1) undefined value used in expression

New Here ,
Oct 06, 2020

Copy link to clipboard

Copied

AE gurus:
 
Ive got a template that works perfectly when i open it, but when I import to another project and  i take one of the pre comps into my main comp then i get this error.

snipboard.io/cBhwGH.jpg

 
I dont know much about the scripting side, any one have any ideas?
 
I know the error is on line 1 but dont know how to fix it.
 
Please Help
 
TIA
 
Peace, love and great coffee to ya
 
Here is the script:
amorti = effect("Dampening")(1);
freq = effect("Elasticity")(1);
 
rebond = 0;
 
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 * amorti ) );
 
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 }
TOPICS
Error or problem, Expressions, Scripting

Views

82

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Community Beginner ,
Oct 06, 2020

Copy link to clipboard

Copied

Make sure you have keyframes on the property the expression is applied and that you have two Slider Controls on the Layer called "Dampening" and "Elasticity". The expression requires this variables to work and those are user controls for their name's property... It looks like an old expression to me. So it will probably not work in the JavaScript engine (new standard). If you really need to use it, you have to change the expression language. You can do so, if you click on the Depth (8bpc) under the tab expressions and select ExtendedScript.

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
jadeb91081890 AUTHOR LATEST
New Here ,
Oct 07, 2020

Copy link to clipboard

Copied

@TobiFrei it is a 2015 template, I have had some issues before where the new version fo AE I just needed to change a character in the expression or give it a value. There where key frames active. 

However when I looked at the original, there was no detailed expression. 

I would still love to find out more why this happened, and what the proper solution to the expression is, however I did find a work around. 

Made a new project. Imported both projects,
Made new comp with main comp and template comp.
So far no issue ?
Renders perfect

Thanks for trying to help
 

Likes

Translate

Translate

Report

Report
Reply
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more