Advertisement
syad28

After Effects Expression

Jun 30th, 2016
496
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. Moving position upward and downward
  2. //350 is 350px
  3. //3 is speed
  4.  
  5.  
  6. posY = 540;
  7. posX = 960;
  8. posY = posY + Math.sin(time*3) * 350;
  9. [posX,posY]
  10.  
  11. ////////////////////////////
  12. Default position
  13.  
  14. x = transform.position[0];
  15. y = transform.position[1];
  16.  
  17. ////////////////////////////
  18. To start an expression at the specific time
  19.  
  20. timeStart = 4; //start at 4 sec
  21. if(time>timeStart){
  22. //insert your expression here
  23. }else{
  24. //do nothing,but make sure there is a returned result
  25. }
  26.  
  27. ////////////////////////////
  28.  
  29. +---[ SHAPE LAYER AUTO-FIT TEXT WIDTH ]----------------------------+
  30. |
  31. | [ Shape Layer > Transform > Position ]
  32. |
  33. t = thisComp.layer("my_text");
  34. tRect = t.sourceRectAtTime(time,false);
  35. tUL = t.toComp([tRect.left,tRect.top]);
  36. tLR = t.toComp([tRect.left+tRect.width,tRect.top+tRect.height]);
  37. tCenter = (tUL + tLR)/2
  38. myRect = sourceRectAtTime(time,false);
  39. myUL = toComp([myRect.left,myRect.top]);
  40. myLR = toComp([myRect.left+myRect.width,myRect.top+myRect.height]);
  41. myCenter = (myUL + myLR)/2
  42. delta = myCenter - tCenter;
  43. value - delta
  44.  
  45. | [ Shape Layer > Rectangle 1 > Scale ]
  46. |
  47. t = thisComp.layer("my_text");
  48. tRect = t.sourceRectAtTime(time,false);
  49. tUL = t.toComp([tRect.left,tRect.top]);
  50. tLR = t.toComp([tRect.left+tRect.width,tRect.top+tRect.height]);
  51. myRect = sourceRectAtTime(time,false);
  52. myUL = toComp([myRect.left,myRect.top]);
  53. myLR = toComp([myRect.left+myRect.width,myRect.top+myRect.height]);
  54. margin = 10;
  55. [(tLR[0]-tUL[0] + 2*margin)/(myLR[0]-myUL[0]),(tLR[1]-tUL[1]+ 2*margin)/(myLR[1]-myUL[1])]*100
  56.  
  57. +--------------------------------------------------------------------------------------------------------+
  58.  
  59.  
  60. http://youtube.com/ShuichiSyad
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement