mouse to control animation

hi everyone I’ve got a little problem with controlling the animation with the mouse frame by frame

for example

i have two animation with 30 frames

the mouse set to 0 on axis’s when the mouse moves to up +1 it starting the animation all the way up to +366 on axis

up+1 axis play on frame 1
up+366 axis play on frame 30

so when u move the mouse up the mouse is controlling what frame to be on if im half way up to the highest axis point then i only want to be half way on the animation

aiming up or down animation or left or right to dodge something

plz help

thanks in advance

C# script

    void Start()
    {
         // First set both animations layer value to something different to each other. This allows you to play them both at the same time.

        animation["aim"].layer = 1;
        animation["dodge"].layer = 2;

        // Second set both their speed to 0.

        animation["aim"].speed = 0;
        animation["dodge"].speed = 0;

        // Thirdly play both the animations

        animation.Play("aim");
        animation.Play("dodge");
    }

    // Use the mouse input to set the normalized time of the animations to what you want. Something like this.

    public float maxMouse = 366;
    void Update()
        {
        float newTimeAim = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.y)) / maxMouse;
        float newTimDodge = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.x)) / maxMouse;
    
        animation["aim"].normalizedTime = newTimeAim ;
        animation["dodge"].normalizedTime = newTimDodge ;
    }

And a javascript version.

function Start()
{
     // First set both animations layer value to something different to each other. This allows you to play them both at the same time.
    animation["aim"].layer = 1;
    animation["dodge"].layer = 2;

    // Second set both their speed to 0.
    animation["aim"].speed = 0;
    animation["dodge"].speed = 0;

    // Thirdly play both the animations
    animation.Play("aim");
    animation.Play("dodge");
}

// Use the mouse input to set the normalized time of the animations to what you want. Something like this.

var maxMouse : float = 366;
function Update()
{
    var newTimeAim : float = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.y)) / maxMouse;
    var newTimDodge : float = Mathf.Min(maxMouse, Mathf.Max(0, Input.mousePosition.x)) / maxMouse;

    animation["aim"].normalizedTime = newTimeAim ;
    animation["dodge"].normalizedTime = newTimDodge ;
}

Note that I haven’t tested these… good luck!