Put your anchor point at one corner of the rectangle, that will take care of half the task, as that will be your origin [0,0] point.
The width of the text with sourceRectAtTime().width plus some margin will give you the width of the rectangle.
That will control both the arrow and the rectangle during the animation.
To get it animated, you can use the linear() or ease() to map the motion to a specific time range:
cursor_x_motion = linear(time, start_time, end_time, 0, rect_width+2*margin)
Kalleheikki Kannisto
Senior Graphic Designer