# Lerp vs. Animation

I've read a few posts regarding lerp and animation, but none seemingly fully answer my question - or I'm not reading into them correctly.

Lets say I have a box in a game. This box has a lid, and the only way it opens is via user interaction (eg. put aside physics if it were to hang upside down; a user presses 'E' and the box opens).

Now, I can achieve this one of two ways.

1) I animate the model of the box with an "Open" animation - the box lid rotating on it's X axis until the model constitutes an 'open' box; OR

2) I lerp the box lid from closed to open over time using rotation on it's X axis until again, the model constitutes an 'open' box.

Apart from the post here showing that:

...through script, MoveTowards method caused up to 0.10 ms latency while playing regular animation almost made no change. If there was anything it could be something between 0.1 and 0.3 ms.

Is there any reason why one would be preferred over the other? I personally would prefer to use Lerp as that way, I can make a generic 'Open' class that I can attach to the box lid, and then to a door, just changing the axis on which it pivots.

Any ideas, thoughts or explanations would be greatly appreciated.

The Lerp solution works well for this one animation for this one box.
• Thanks for your answer! That explains in which circumstances animation is better than programmatically attaining the desired result, and vice versa. As I am going for simplicity for a proof of concept, I will stick with Lerp, but further down the track I will look to do some work with animations. Thank you again! May 11, 2016 at 11:07
• Note that usually underneath the animation frameworks there is Lerping going on. animations are often based on keyframe, with lerp (or easing curves) to move from frame to frame. A complex animation system can have keyframes for each component instead of keyframes for the entire thing. See for example the Dope sheet in Spine where each component has it's own timeline and keyframes. For your relative simple animation, a Lerp might be sufficient though. Just pointing out that animation system is a more complex implementation of the lerp method. May 11, 2016 at 12:45