ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

When using the "if" expression to limit the value, strange jumps occur, how to solve?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Katherine Jane
When using the "if" expression to limit the value, strange jumps occur, how to solve?
on Nov 17, 2019 at 3:29:17 am

Hi 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


Return to posts index

Dan Ebberts
Re: When using the "if" expression to limit the value, strange jumps occur, how to solve?
on Nov 17, 2019 at 5:45:26 am

This should work:

va1 = thisComp.layer("Layer 1").transform.scale
va2 = va1.valueAtTime (time - .2 )*1.5;
clamp(va2,[0,0],[120,120])


Dan



Return to posts index

Katherine Jane
Re: When using the "if" expression to limit the value, strange jumps occur, how to solve?
on Nov 17, 2019 at 6:45:14 am

Dear Dan,
Thank you so much~~~
The problem was solved perfectly, I used "linear" but it didn't work.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]