I rushing through it, I made the code more complicated than necessary. This should work for the first version:
temp = thisComp.layer("Reveal Text Box").content("Rectangle Path 1").size[1];
if (time < key(2).time)
easeOut(time,key(1).time,key(2).time,[0,temp],[0,0])
else
easeIn(time,key(3).time,key(4).time,[0,0],[0,temp]);
and the second:
temp = thisComp.layer("Reveal Text Box").content("Rectangle Path 1").size[1];
if (time < key(2).time)
easeOut(time,key(1).time,key(2).time,[0,0],[0,temp])
else
easeIn(time,key(3).time,key(4).time,[0,temp],[0,0]);
Dan