Move the anchor point to any edge you want.
Yes - probably the most flexible way is to use a null as a parent.
I'm assuming here that the triangle shown in the top image is NOT already rotated... but has been created 'as shown'.
1. Create yourself a null object, make it 3D and position the top left corner of the null over the edge you want to rotate.
2. set the orientation of the null to: 0.0, 0.0, 45 (45 degrees on the Z axis).
3. parent the shape to the null.
4. animate the X rotation value of the null
As Mike Abbott said, parenting is the solution. Orient the parent first, then parent, then rotate the parent. If the triangle is a shape layer you can turn on Snapping or hold down the shift key as you drag the null around so that it snaps to the line. This is easier to do if both layers are 3D when you are lining up the edges.
Thank you Mike!
This worked absolutely perfectly.
I followed all your steps and now I can animate what I intended.
Thank you so much!
Glad to be of help : )
PS : Rick Gerard already has more than enough forum points - he doesn't need any more! : )
Oops. I accidentally marked his answer as the correct one instead of yours.