How to create gun sprinting animation by script.

How can I create gun sprinting animation just by script. Please give me script or give me some idea.
Any answers to this question is appreciate here.

Hi, I extracted all this from the standard third person controller unity provides, the animationSpeedMultiplier variable will alter how fast your animations cycle.s play.

using UnityEngine;

using UnityEngine.AI;

public class Character : MonoBehaviour

{

    [Header("Animator")]
    [SerializeField]
    RuntimeAnimatorController animatorController;

    [SerializeField] AnimatorOverrideController animatorOverrideController;

    [SerializeField] Avatar characterAvatar;

    [SerializeField] [Range(.1f, 1f)] float animatorForwardCap = 1f;


    [Header("Nav Mesh Agent")]

    [SerializeField]
    float navMeshAgentSteeringSpeed = 1.0f;

    [SerializeField] float navMeshAgentStoppingDistance = 1.3f;


    NavMeshAgent navMeshAgent;

    Animator animator;

    Rigidbody ridigBody;

    public AnimatorOverrideController GetOverrideController()

    {
        return animatorOverrideController;
    }


    void Move(Vector3 movement)
    {

        SetForwardAndTurn(movement);

        ApplyExtraTurnRotation();

        UpdateAnimator();
    }



    void SetForwardAndTurn(Vector3 movement)

    {
        // convert the world relative moveInput vector into a local-relative

        // turn amount and forward amount required to head in the desired direction

        if (movement.magnitude > moveThreshold)

        {
            movement.Normalize();
        }


        var localMove = transform.InverseTransformDirection(movement);

        turnAmount = Mathf.Atan2(localMove.x, localMove.z);

        forwardAmount = localMove.z;

    }



    void UpdateAnimator()

    {
        animator.SetFloat("Forward", forwardAmount * animatorForwardCap, 0.1f, Time.deltaTime);

        animator.SetFloat("Turn", turnAmount, 0.1f, Time.deltaTime);

        animator.speed = animationSpeedMultiplier;
    }



    void ApplyExtraTurnRotation()
    {

        // help the character turn faster (this is in addition to root rotation in the animation)

        float turnSpeed = Mathf.Lerp(stationaryTurnSpeed, movingTurnSpeed, forwardAmount);

        transform.Rotate(0, turnAmount * turnSpeed * Time.deltaTime, 0);
    }



    void OnAnimatorMove()
    {
        // we implement this function to override the default root motion.
        // this allows us to modify the positional speed before it's applied.
        if (Time.deltaTime > 0)
        {
            Vector3 velocity = (animator.deltaPosition * moveSpeedMultiplier) / Time.deltaTime;

            // we preserve the existing y part of the current velocity.
            velocity.y = ridigBody.velocity.y;
            ridigBody.velocity = velocity;
        }
    }

But you can import the whole thing by going here →

But