Component:ValueGradientDriver: Difference between revisions

From Resonite Wiki
m ProbablePrime moved page ValueGradientDriver`1 (Component) to Component:ValueGradientDriver`1: Creating component Namespace
No edit summary
Line 20: Line 20:
<!--T:3-->
<!--T:3-->
== Usage ==
== Usage ==
Each point in the <code>Points</code> list has a <code>Position</code> field and <code>Value</code> field. The <code>Position</code> field is used for comparison with the component's <code>Progress</code> field, while the <code>Value</code> field is the value used for driving the field in <code>Target</code>.
When <code>Interpolate</code> is checked, the value stored in <code>Target</code> is linearly interpolated between the <code>Value</code>s of the two points surrounding the current <code>Progress</code>. When unchecked, the output value is simply set to the <code>Value</code> of the closest point before the current <code>Progress</code>. The only exception to this is when no point exists before the current <code>Progress</code>, in which case the first point after the current <code>Progress</code> is used.
If two points have the same <code>Position</code>, then the point of greatest index takes priority if the value is not interpolated or if the positions are exactly equal to the current <code>Progress</code>. ''During'' interpolation, however, the point of ''least'' index takes priority.


<!--T:4-->
<!--T:4-->

Revision as of 07:10, 17 February 2024

This article or section is a Stub. You can help the Resonite Wiki by expanding it.


Component image 
Value Gradient Driver`1 component as seen in the Scene Inspector

The ValueGradientDriver component changes the value of the field defined in Target based on the items in the Points list, and their Position in relation to the Progress value.

Fields

Fields
Name Type Description
persistent Bool Determines whether or not this item will be saved to the server.
UpdateOrder Int Controls the order in which this component is updated.
Enabled Bool Controls whether or not this component is enabled.
Progress Float Controls which items from the Points list will be used to drive the value of Target
Target IField<float> The field that this component will drive the value of
Interpolate Bool Controls whether or not this component will interpolate (or blend) between the nearest two Points to the current Progress value.
Points SyncList<Point> A list of items indicating their Position (in relation to Progress), and a Value

Usage

Each point in the Points list has a Position field and Value field. The Position field is used for comparison with the component's Progress field, while the Value field is the value used for driving the field in Target.

When Interpolate is checked, the value stored in Target is linearly interpolated between the Values of the two points surrounding the current Progress. When unchecked, the output value is simply set to the Value of the closest point before the current Progress. The only exception to this is when no point exists before the current Progress, in which case the first point after the current Progress is used.

If two points have the same Position, then the point of greatest index takes priority if the value is not interpolated or if the positions are exactly equal to the current Progress. During interpolation, however, the point of least index takes priority.

Examples

Related Components