Animation or script transforming?

Hello guys,

I have been looking for an answer to this or for a similar topic on multiple sites and even though I did manage to find quite nice tutorials on how to do one or the other, none of them answered the following question:
What is better (performance wise) to have? animation of an object or to just script it to transform position and rotation (so that he actually moves by a fixed amount every frame or second). Especially when it comes to complex movements, like rotation (make it rotate exactly 2 times around z or x axis) and so on?

Animation provides more control on the movement, number of occurrences, speed and so on, but how does that translate performance wise? From my previous experience in programming (not unity), I know that making things be done at runtime by script is a lot better performance-wise.
However, I have never worked with animation so this really bugs me.

What is your opinion?
Many thanks!

I can’t talk numbers, or the theory, but I can tell you that from my experience, animation clips perform a lot better if the amount of objects to move by code is big.

In one of my last projects there where nearly 50 objetcs that were being translated and rotated by code (using itween if I’m not mistaken) and those translations had to loop indefinitely. What I found was that every time a translation by code ended and new one started there was a huge peak in the performance (tens of milliseconds, maybe a hundred) due to itween elements being destroyed and created again. I created an animation (with an editor script, to make objects translate along same path as the script), set the loop and applied to all the objects. Peaks disappeared.

Maybe it was because of the use of the itween library, but using animation clips made the game run a lot faster than controlling the movement of all the objects by script.