format
typescript
PSCurve.Evaluate(time, random_value)class: PSCurve
description
Get the value of the curve at a specified time point.
parameter
| param_name | type | description |
|---|---|---|
| time | number | The time point. |
| random_value | number | Random value (default is 1). |
reture
| type | description |
|---|---|
number | The value of the curve at the specified time. |
code example
typescript
class New_TypeScript
extends Component{
// Declare a PSCurve
private psCurve:PSCurve;
OnStart(): void {
let obj = new GameObject();
let com = obj.AddComponent<ParticleSystem>(ParticleSystem);
// Initialize the PSCurve
this.psCurve = com.initialModuleLifetime;
}
OnUpdate(): void {
let time = 1;
let value = this.psCurve.Evaluate(time);
Debug.Log("The value of the curve at", time, "seconds is:", value);
}
}