You could use an expression to convert the object’s 3D coordinates to 2D screen (Comp) space and then rotate the layer based on how far it has traveled beyond a threshold value ‘left’ in this case:
left = 150; //The distance in pixels from the left side of the comp when the layer begins to rotate
right = thisComp.width – left; //The distance in pixels from the right side of the comp when the layer begins to rotate back
duration = 50; //The distance in pixels that the layer will need to travel beyond the threshold for the rotation to reach the ‘end’ angle
start = -90; //The angle to begin the rotation from
end = 0; //The angle to rotate to
angle = start;
x = thisLayer.toComp(anchorPoint)[0]; //Transform this layer’s 3D Coords into its 2D coords and use the X value only
//If we’ve passed the ‘left’ side but haven’t reached the ‘right’ side yet
if((x >= left)&&(x <= right)){
angle = ease(x, left, left + duration, start, end); //ease from the 'start' to 'end' angle as the x value increases from 'left' to 'left + duration'
}
if(x > right){
angle = ease(x, right, right + duration, end, start); //ease from the ‘end’ to ‘start’ angle as the x value increases from ‘right’ to ‘right +duration’
}
angle; //return the angle
That should work!