
Expressions used at NAB Post|Production Campus, Las Vegas 2017
------------------------------------------------


Make Rectangle Scale from Left
---------------------------------
Link Position of Rectangle (not the Layer) to its Size, then divide by 2

content("Rectangle 1").content("Rectangle Path 1").size/2



Link Rectangle Size to Text Layer Size
-----------------------------------------
Type this 

x =
y = 
[x,y]

Point to Text Layer, and use Expression language menu to get the sourceRectAtTime

Type .width+300;
Point y to Rectangle Path, Vertical Size 


x = thisComp.layer("Name").sourceRectAtTime(t = time, includeExtents = false).width+300;
y = content("Rectangle 1").content("Rectangle Path 1").size[1];
[x,y]




Link BG to Text
-------------------
Use PickWhip to link Position for the layer (not for the rectangle) to Text layer's Position. Adjust Anchor Point on BG layer to reposition it.


thisComp.layer("Name").transform.position




Make the Text Bounce in
--------------------------
Animate the text layer in, with linear keyframes. 

Copy Keyframe Overshoot Expression from
http://motionscript.com/articles/bounce-and-overshoot.html to Position, after animating it in.

freq = 3;
decay = 5;

n = 0;
if (numKeys > 0){
  n = nearestKey(time).index;
  if (key(n).time > time) n--;
}
if (n > 0){
  t = time - key(n).time;
  amp = velocityAtTime(key(n).time - .001);
  w = freq*Math.PI*2;
  value + amp*(Math.sin(t*w)/Math.exp(decay*t)/w);
}else
  value
  


Endless Rotation
----------------------

Create a star Layer
for Rotation, use expression language menu to get Time

Type *100



Endless Looping
------------------------
Make 3 keyframes for Position
Use expression language menu to get loopOutDuration

Change duration to 2


loopOutDuration(type = "cycle", duration = 2)

