Animations wouldn't work for weapon mechanics?

I’ll start off this post by just saying I generally have absolutely no idea what I’m doing with animations I’ve only ever done 2D drawn animations
If I were to create a recoil or ADS animation for a weapon, the animation would always start in the same position meaning if I were to create a weapon sway or something, or the weapon was in a different position, the ADS animation would snap the weapon to a different point when the animation starts. How would I blend animation so that the weapon would go from whatever point it is at to the ads position? also with a recoil animation, it would just shake and snap the weapon over and over instead of making it go more up each time
Would I need to do this with code?
I know I could google this or something but I’m not exactly sure what I’m asking is called

Hard to figure out what the problem is

If you do transition between nodes in Animator, it should blend position from current weapon position to the one at start of animation (there is a setting for blend time in transition, after you click the arrow between nodes in animator), so there should be no snapping if you use animator.

As for code, you can use Animator.CrossFade() with second parameter being blend time.

So I know about animation transitions but my question is if I were to have a recoil animation on the gun that starts at a certain point and moves the weapon up, then when this animation repeats when the weapon fires again it would snap to the start of the animation because that is the position in the animation. How would I have this animation not start at a specific point but start at it’s actual position and move up so that it will continuously move up as the animation repeats?

I would use DOTween instead, Animator won’t do the job here:

Import DOTween: DOTween (HOTween v2) | Animation Tools | Unity Asset Store

If it shows setup window, click SetUp, then mark all, then it will compile

Make gun GO (GameObject) child of a “Pivot” GO and make a script on that Pivot parent with

public class Recoil : MonoBehaviour
{
public float upAmount = 0.2f;
public float recoilDuration = 0.1f;

public void AnimateRecoil()
{
    var originalYPosition = transform.localPosition.y;
    transform.DOKill();
    transform.DOLocalMoveY(originalYPosition  + upAmount, recoilDuration)
        .OnComplete(() => transform.DOLocalMoveY(originalYPosition , recoilDuration));
}

}

Ok, thank you for your help!