nipapin

Expression | Stretch Values

May 26th, 2019 (edited)
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. t1 = key(1).time;
  2. t2 = key(2).time;
  3. stretch = true;
  4. toTime = function(){
  5.     low = thisComp.duration;
  6.     nextTime = thisComp.duration;
  7.     prevTime = 0;
  8.     for( i = thisComp.numLayers; i > index; i--)
  9.         if(thisComp.layer(i).inPoint < low && thisComp.layer(i).inPoint > time){
  10.             low = thisComp.layer(i+1).inPoint;
  11.             nextTime = thisComp.layer(i).inPoint;
  12.             prevTime = thisComp.layer(i+1).inPoint;
  13.             break;
  14.         }else{
  15.             prevTime = thisComp.layer(index+1).inPoint
  16.         }
  17.     return [prevTime, nextTime];
  18. }
  19. data = toTime();
  20. if(stretch){
  21. linear(time, data[0], data[1], t1, t2)
  22. }else{
  23. linear(time, data[0], data[0]+(t2-t1), t1, t2)
  24. }
Add Comment
Please, Sign In to add comment