Animation curve evaluate

1.8k views Asked by At

I'm not sure how to assign speed to my Animation curve:

public float speed;
public AnimationCurve ac;

transform.position = Vector3.Lerp(pos1, pos2, ac.Evaluate( ??? ));

I'm using it inside a coroutine.

1

There are 1 answers

1
Emily On

You can write:

ac.Evaluate(deltaTime * speed);

According to Unity docs:

public float Evaluate(float time);

Description

Evaluate the curve at time.

Parameter time

The time within the curve you want to evaluate (the horizontal axis in the curve graph).

Returns float

The value of the curve, at the point in time specified.