Sair
  • Comunidade global
    • Idioma:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Keeping Exponential Scale "live" with expressions

Entusiasta ,
Mar 27, 2009 Mar 27, 2009
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?).
TÓPICOS
Expressões
9.3K
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
LENDA ,
Mar 27, 2009 Mar 27, 2009
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
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Mar 27, 2009 Mar 27, 2009
Besten Dank!
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Mar 28, 2009 Mar 28, 2009
Here is the Ease 1 wizz link Mylenium talked about: http://ianhaigh.com/easeandwizz/
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Mar 31, 2009 Mar 31, 2009
WOW! Ease 'n Wizz is awesome!
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Apr 01, 2009 Apr 01, 2009
I agree. Ease and Wizz is awesome. I see a PayPal donation button on Ian's site, too. I'm just sayin'...
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Apr 01, 2009 Apr 01, 2009
Consider him tipped!
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Apr 15, 2009 Apr 15, 2009

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

}
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Defensor ,
Apr 17, 2009 Apr 17, 2009

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.

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Community Expert ,
Apr 18, 2009 Apr 18, 2009

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

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Apr 22, 2009 Apr 22, 2009

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

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Entusiasta ,
Apr 23, 2009 Apr 23, 2009

SUCCESS!

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Community Expert ,
Jul 26, 2023 Jul 26, 2023

 

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

 

Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines
Community Expert ,
Jul 26, 2023 Jul 26, 2023
MAIS RECENTE

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
Traduzir
Denunciar
Diretrizes da comunidade
Seja respeitoso, dê crédito à fonte original do conteúdo e verifique se há cópias antes da publicação. Saiba mais
community guidelines