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

Expression for Exponential Scale ?

Community Beginner ,
Jul 25, 2023 Jul 25, 2023

Instead of using Keyframe assistaant > Exponential Scale, I would like to use an expression on the Scale property. What would be the correect expression taking into account scale at inpoint, scale at outpoint and duration between inpoint and outpoint? (my picture is zooming out)

Thanks !

TOPICS
Expressions
724
Translate
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

LEGEND , Jul 26, 2023 Jul 26, 2023
tStart=key(1).time;
tEnd=key(2).time;
tDiff=tEnd-tStart;

vStart=valueAtTime(tStart);
vEnd=valueAtTime(tEnd);
vDiff=vEnd-vStart;

mStart=Math.exp(0);
mEnd=Math.exp(1);
mFac=linear(time,tStart,tEnd,0,1);
mMul=Math.exp(mFac);

vStart+linear(mMul,mStart,mEnd,0,1)*vDiff;

 

Mylenium

Translate
LEGEND ,
Jul 26, 2023 Jul 26, 2023

Something like this perhaps:

 

tStart=key(1).time;

tEnd=key(2).time;

tDiff=tEnd-tStart;

vStart=valueAtTime(tStart);

vEnd=valueAtTime(tEnd);

vDiff=vEnd-vStart;

 

vStart+Math.exp(tDiff)*vDiff;

 

Mylenium

 

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

Thanks Mylenium. Sorry, I should have mentionned that current time should be taken into account to have the exponential scaling from tStart to tEnd. How would you fit the (time-inpoint) within your expression ? I tried to but was unable. Thanks !

Translate
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

If you want the animation to start at the in point of the layer:  tStart = inPoint;

If you want the animation to end 1 second before the out point of the layer: tEnd = outPoint - 1;

 

Check the expression I posted. 

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

Thank you !

Translate
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 ,
Jul 26, 2023 Jul 26, 2023
tStart=key(1).time;
tEnd=key(2).time;
tDiff=tEnd-tStart;

vStart=valueAtTime(tStart);
vEnd=valueAtTime(tEnd);
vDiff=vEnd-vStart;

mStart=Math.exp(0);
mEnd=Math.exp(1);
mFac=linear(time,tStart,tEnd,0,1);
mMul=Math.exp(mFac);

vStart+linear(mMul,mStart,mEnd,0,1)*vDiff;

 

Mylenium

Translate
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

Something like this maybe:

t1 = inPoint;
t2 = outPoint - thisComp.frameDuration;
v1 = valueAtTime(t1);
v2 = valueAtTime(t2);
if (time < t1){
  v1;
}else if (time > t2){
  v2;
}else{
  d = t2 - t1;
  dv = v2 - v1;
  t = (time - t1)/d;
  v1 + dv*Math.exp(10*(t-1));
}
Translate
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

If you want to work without keyframes, try this version of Mylenium's expression:

 

tStart=inPoint;
tEnd= inPoint + 2;// move time in seconds
tDiff=tEnd-tStart;
vStart=[10, 10];// starting Scale
vEnd=[70, 70];// ending Scale
vDiff=vEnd-vStart;
mStart=Math.exp(0);
mEnd=Math.exp(1);
mFac=linear(time,tStart,tEnd,0,1);
mMul=Math.exp(mFac);
vStart+linear(mMul,mStart,mEnd,0,1)*vDiff;

 

 The math does not match applying the Keyframe Assistants' Exponential Scale perfectly, but it looks pretty good.

RickGerard_0-1690388757669.png

Change line two to tEnd = outPoint, and the animation will last as long as the layer.

Translate
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