You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
using UnityEngine;
|
|
|
|
namespace UnityEditor.VFX.Operator
|
|
{
|
|
//[VFXHelpURL("Operator-PeriodicTotalTime")]
|
|
[VFXInfo(category = "Time")]
|
|
class PeriodicTotalTime : VFXOperator
|
|
{
|
|
public class InputProperties
|
|
{
|
|
[Tooltip("Sets the period of time to be looped over (in seconds).")]
|
|
[Min(0.001f)]
|
|
public float Period = 5.0f;
|
|
[Tooltip("Sets the output value range interpolated over the period of time.")]
|
|
public Vector2 Range = new Vector2(0.0f, 1.0f);
|
|
}
|
|
|
|
public class OutputProperties
|
|
{
|
|
[Tooltip("Outputs the current time within the specified time period.")]
|
|
public float t = 0;
|
|
}
|
|
|
|
public override string name
|
|
{
|
|
get
|
|
{
|
|
return "Periodic Total Time";
|
|
}
|
|
}
|
|
protected override VFXExpression[] BuildExpression(VFXExpression[] inputExpression)
|
|
{
|
|
VFXExpression[] output = new VFXExpression[]
|
|
{
|
|
VFXOperatorUtility.Lerp(inputExpression[1].x, inputExpression[1].y, VFXOperatorUtility.Frac(VFXBuiltInExpression.TotalTime / inputExpression[0])),
|
|
};
|
|
return output;
|
|
}
|
|
}
|
|
}
|