Sprite tilts left/right depending on how far it is from the center [C#]

Trying to make a game which has the “Tinder RPG” genre made by Reigns where you swipe cards left or right and it tilts the card depending on how far it is from the middle. I’ve tried transform.rotatearound, but I think I’m not doing it correctly.

What I am trying to do is this effect, but left and right.128745-unityquestion.png

You don’t need to rotate it. You need to move it on the X axis.

What you are doing right now is rotating it around something. Sun around the moon

I’m guessing at your needs though. Need code