Skip to main content
S_ A
Inspiring
December 7, 2022
Answered

Expression shows error

  • December 7, 2022
  • 1 reply
  • 601 views

Hello,

I am following one tutorial 'VERBATIM'. I applied the same expression as my tutor used. but he got no error, I got. :'( why?

 

This topic has been closed for replies.
Correct answer Rick Gerard

There is no Math.Pl function. It's Math.PI

 

Try this:

n = 0;
if (numKeys > 0){
	n = nearestKey(time).index;
	if (key(n).time > time){
		n--
	}
}
if (n == 0){
	t = 0;
}
else{
	t = time - key(n).time;
}
n = nearestKey(time).index;
if (n > 0 && t < 1){
	v = velocityAtTime(key(n).time) - thisComp.frameDuration / 10;
	amp = .45;
	freq = 4.0;
	decay = 8.0;
	value + v * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t);
}	
else {
	value;
}

When you have problems with an expression, it is a good idea to use the toolbar's </> tool to post the expression.  When you have problems with a tutorial, it is always helpful to post a link to the tutorial. Unfortunately, most of them are presented by enthusiasts, and the workflows and explanations can be a little sketchy. 

 

1 reply

Rick GerardCorrect answer
Community Expert
December 7, 2022

There is no Math.Pl function. It's Math.PI

 

Try this:

n = 0;
if (numKeys > 0){
	n = nearestKey(time).index;
	if (key(n).time > time){
		n--
	}
}
if (n == 0){
	t = 0;
}
else{
	t = time - key(n).time;
}
n = nearestKey(time).index;
if (n > 0 && t < 1){
	v = velocityAtTime(key(n).time) - thisComp.frameDuration / 10;
	amp = .45;
	freq = 4.0;
	decay = 8.0;
	value + v * amp * Math.sin(freq * t * 2 * Math.PI) / Math.exp(decay * t);
}	
else {
	value;
}

When you have problems with an expression, it is a good idea to use the toolbar's </> tool to post the expression.  When you have problems with a tutorial, it is always helpful to post a link to the tutorial. Unfortunately, most of them are presented by enthusiasts, and the workflows and explanations can be a little sketchy. 

 

S_ A
S_ AAuthor
Inspiring
December 7, 2022

Thank you so much. I will remember what you said. Thank you.