Forums › Adobe After Effects Expressions › When using the “if” expression to limit the value, strange jumps occur, how to solve?
When using the “if” expression to limit the value, strange jumps occur, how to solve?
Katherine Jane
November 17, 2019 at 3:29 amHi all!
I animate the size of ” Layer 1″ from 0% to 100%, then I want ” Layer 2″ to follow ” Layer 1″ for animation, but with a delay of 2 seconds and multiplying by 1.5 (Speed up animation).
The result of this ” Layer 2″ will eventually be enlarged to 150%, but I only want to zoom to 120%, so I used the following expression:
va1 = thisComp.layer(" Layer 1").transform.scale
va2 = va1.valueAtTime ( time - .2 )*1.5;
max= [120,120];
if ( va2 < max ) { va2 } else { max }However, this expression has a very strange jitter and it is not possible to constrain ” Layer 2″ to 120% of the size.
If you change 1.5 directly to 1.2, the speed of this process will be much slower.My English is not very good. If there is any place that you don’t understand, please let me know and I will try my best to answer it.
Thank you for your time and advice
Dan Ebberts
November 17, 2019 at 5:45 amThis should work:
va1 = thisComp.layer(“Layer 1”).transform.scale
va2 = va1.valueAtTime (time – .2 )*1.5;
clamp(va2,[0,0],[120,120])Dan
Katherine Jane
November 17, 2019 at 6:45 amDear Dan,
Thank you so much~~~
The problem was solved perfectly, I used “linear” but it didn’t work.
Log in to reply.