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

Keeping Exponential Scale "live" with expressions

Enthusiast ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

Is there a way to replicate the Exponential Scale via expression?

As you know, once you run the animation assistant, the keyframes are locked down and if I need to change the start or end values, I have to delete all the intermediate KFs and re-run the animation assistant. Kind of a hassle, eh?

It would be cool if I could set a start and stop keyframe or layer markers and have the expression do its thing between a min and max value (via sliders?).
TOPICS
Expressions

Views

8.4K

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
LEGEND ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

http://www.motionscript.com/mastering-expressions/simulation-basics-2.html also try Ease & Wizz, a collection of scripts that will setup expressions for alternate interpolation methods (from a different site, haven't the link handy).

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
Enthusiast ,
Mar 27, 2009 Mar 27, 2009

Copy link to clipboard

Copied

Besten Dank!

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
Mar 28, 2009 Mar 28, 2009

Copy link to clipboard

Copied

Here is the Ease 1 wizz link Mylenium talked about: http://ianhaigh.com/easeandwizz/

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
Enthusiast ,
Mar 31, 2009 Mar 31, 2009

Copy link to clipboard

Copied

WOW! Ease 'n Wizz is awesome!

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
Apr 01, 2009 Apr 01, 2009

Copy link to clipboard

Copied

I agree. Ease and Wizz is awesome. I see a PayPal donation button on Ian's site, too. I'm just sayin'...

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
Enthusiast ,
Apr 01, 2009 Apr 01, 2009

Copy link to clipboard

Copied

Consider him tipped!

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
Enthusiast ,
Apr 15, 2009 Apr 15, 2009

Copy link to clipboard

Copied

So one thing I noticed with Ease & Wizz is that there's no setting exactly like AE's Exponential Scale animation assistant. I've written the author and asked to include a 'linear' interpolation as all of E&W's options use some sort of easing.

So he gave me this expression by Dan to use. But I'm getting a "div() must be scalar" error when I place use it in a scale property. Can someone take a look and see what's wrong?

if (numKeys > 1){

  v1 = key(1).value;

  v2 = key(2).value;

  t1 = key(1).time;

  t2 = key(2).time;

  if (time > t1 && time < t2){

    t = time - t1;

    T = t2 - t1;

    k = Math.log(v2/v1)/T;

    v1*Math.exp(k*t)

  }else{

    value

  }

}else{

  value

}

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
Enthusiast ,
Apr 17, 2009 Apr 17, 2009

Copy link to clipboard

Copied

Are you using this on a 2- or 3-dimensional property?  I think the problem is here:

    k = Math.log(v2/v1)/T;

The expression looks like it was written for a one-dimensional property, not for vectors like scale or position.  I think v2/v1 is another way of expressing div(v2, v1).  In any case, you are trying to divide a vector by another vector.

My vector math was never very good, so I'm not sure what the solution is at this point.  I suspect it is more complicated than simply dividing each component of v2 by its corresponding component of v1.

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 ,
Apr 18, 2009 Apr 18, 2009

Copy link to clipboard

Copied

I think this should work for what you're trying to do. For two keyframes it should give the same result as if you applied AE's exonential scale. If there are more than two keyframes, it will apply the exponential scale between each adjacent pair of keyframes. Should work for multi-dimensional properties as well. I just took it out of the oven, so it may not be completely cooked. Let me know if you run into problems.

n = 0;
if (numKeys > 0){
  n = nearestKey(time).index;
    if (key(n).time > time){
      n--;
    }
}

if (n == 0 || n == numKeys){
  value
}else{
  d = 1
  try{
    value[1];
    d++;
    value[2];
    d++;
    value[3];
    d++;
  }catch (err){
  }
  t1 = key(n).time;
  t2 = key(n+1).time;
  if (d == 1){
    v1 = key(n).value;
    if (v1 == 0) v1 = .0001;
    v2 = key(n+1).value;
    if (v2 == 0) v2 = .0001;
    k = Math.log(v1/v2)/(t2-t1);
    v1/Math.exp((time-t1)*k)
  }else{
    v = [];
    for(i = 0; i < d; i++){
      v1 = key(n).value;
      if (v1 == 0) v1 = .0001;
      v2 = key(n+1).value;
      if (v2 == 0) v2 = .0001;
      k = Math.log(v1/v2)/(t2-t1);
      v = v1/Math.exp((time-t1)*k)
    }
    v
  }
}

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
Enthusiast ,
Apr 22, 2009 Apr 22, 2009

Copy link to clipboard

Copied

Wow!  Thanks Dan! I'll give it a whirl tomorrow morning!

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
Enthusiast ,
Apr 23, 2009 Apr 23, 2009

Copy link to clipboard

Copied

SUCCESS!

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 ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

 

Dan, I fiddled with your expression for a few minutes, and it's throwing an error I can't figure out.
RickGerard_1-1690433579585.png

 

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 ,
Jul 26, 2023 Jul 26, 2023

Copy link to clipboard

Copied

LATEST

Wow, that's an old one. It looks like it isn't rigged to handle multi-dimensional properties (even though I said it should be). That's a lot of code. I haven't looked at it too much, but this should be a lot better:

val = value;
if (numKeys > 1){
  n = nearestKey(time).index;
  if (key(n).time > time) n--;
  if ((n > 0) && (n < numKeys)){
    d = key(n+1).time-key(n).time;
    dv = key(n+1).value-key(n).value;
    t = (time-key(n).time)/d;
    val = key(n).value + dv*Math.exp(10*(t-1));
  }
}
val

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