• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Expression disabled error !!

Explorer ,
Feb 10, 2017 Feb 10, 2017

Copy link to clipboard

Copied

//The below script creates jiggle for keyframes in any property but sometimes

//results in attached error

//Can someone please help me with this

Thanks

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;

}

if (n > 0){

v = velocityAtTime(key(n).time - thisComp.frameDuration/10);

amp = .05;

freq = 2.0;

decay = 5.0;

value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);

}else{

value;

}

Thanks in advance !!

erro.PNG

TOPICS
Expressions

Views

3.0K

Translate

Translate

Report

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

correct answers 1 Correct answer

Community Expert , Feb 10, 2017 Feb 10, 2017

Does your comp have a long duration between keyframes (or after the last keyframe)? If so, you might need to limit the "t" variable so that Math.exp doesn't overflow. Try changing this line:

t = time - key(n).time;

to this:

t = Math.min(time - key(n).time,10);

Dan

Votes

Translate

Translate
LEGEND ,
Feb 10, 2017 Feb 10, 2017

Copy link to clipboard

Copied

And what specifically are you asking? From a quick glance I'd simply say the loop decrements to zero if there are less than two keyframes. Unlike arrays, keyframe indices start at 1. Once you introduce the wrong index, of course all consecutive calculations will fail.

Mylenium

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 10, 2017 Feb 10, 2017

Copy link to clipboard

Copied

LATEST

Does your comp have a long duration between keyframes (or after the last keyframe)? If so, you might need to limit the "t" variable so that Math.exp doesn't overflow. Try changing this line:

t = time - key(n).time;

to this:

t = Math.min(time - key(n).time,10);

Dan

Votes

Translate

Translate

Report

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