Skip to content

format

typescript
PSCurve.Evaluate(time, random_value)

class: PSCurve

description

Get the value of the curve at a specified time point.

parameter

param_nametypedescription
timenumberThe time point.
random_valuenumberRandom value (default is 1).

reture

typedescription
numberThe 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);
        
    }

}