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

Expression to set a value at a specific time ?

New Here ,
Apr 05, 2020 Apr 05, 2020

Hi ! I have a slider that controls the position of a layer.

I want my position to be at the value of the slider at the 19th second of my composition, and then to go to 0 at the 20th second.

 

Doyou know any expression that would allow me to say "At X moment, be X value, and at Y moment, be Y value" ?

 

Thanks in advance !

TOPICS
Expressions
1.9K
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 ,
Apr 05, 2020 Apr 05, 2020
LATEST

You can use time, inPoint - time to get the time a layer is visible, and valueAtTime to find the time of a keyframe or marker. To transition between two times you can use a linear, ease, easeIn, or easeOut method right from the Expression Language>Interpolation menu in the timeline.

 

This expression will use the value of the slider to set both X and Y values, start the change nine seconds after the layer starts and end with the position of the layer at 0,0 at ten seconds.

ctrl = thisComp.layer("Control").effect("Slider Control")("Slider");
t = inPoint - time;
tMin = 9; // time to start in seconds
tMax = 10; // time to end in seconds
value1 = ctrl.value;
value2 = 0;

v = ease(time, tMin, tMax, value1, value2)
[v, v]

I hope that makes sense. 

 

If you want to change only one of the position values with the slider then you will have to break apart the array. 

 

If you want the position value to start at the current position value, then animate to the position value of the slider, then move to zero then that's another problem but the solution is similar. 

 

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