Bind AnimtionCurve to control the local position of the gam object

Hello!
I am unable to bind AnimationCurve to a local object transform.
If you do something like that

    public AnimationCurve animCurve;
    public GameObject target;
    float curveTimer = 0f;

    // (1, 0, 0) – x 
    // (0, 1, 0) – y 
    // (0, 0, 1) – z
    public Vector3 vector = new Vector3(0, 1, 0);

    void Update()
    {

        curveTimer += Time.deltaTime;
        if (curveTimer > 2)
            curveTimer = 0;

        float curveAmount = animCurve.Evaluate(curveTimer);
        target.transform.localPosition = vector * curveAmount;
    }

Everything moves as it should
gif1
5884511--626984--1.gif
BUT if the object is locally rotated, then it does not move quite as it should.
gif2
5884511--626990--2.gif
As I understand it, need to use Vector3.up (forward or right depending on which axis).
But it works the same way and nothing changes. Ithink need to somehow use the direction
How do I snap an AnimationCurve so that the curve controls the position of the object, like this:
gif3
5884511--626996--3.gif

I think you’re maybe looking for something like this:

    public Vector3 vector;
   
    void Start() {
       vector = transform.right;
    }

    void Update()
    {

        curveTimer += Time.deltaTime;
        if (curveTimer > 2)
            curveTimer = 0;
        float curveAmount = animCurve.Evaluate(curveTimer);
        target.transform.localPosition = vector * curveAmount;
    }

Wow, I didn’t even think of such a simple solution, lol. Probably just tired. Thanks, It works