Component:ValueGradientDriver: Difference between revisions

From Resonite Wiki
m add the actual good example RAAAH
m that comma is not supposed to be there
 
(3 intermediate revisions by 2 users not shown)
Line 6: Line 6:
|Name=Value Gradient Driver`1
|Name=Value Gradient Driver`1
}}
}}
The '''ValueGradientDriver''' component changes the value of the field defined in <code>Target</code> based on the items in the <code>Points</code> list, and their <code>Position</code> in relation to the <code>Progress</code> value.
The '''ValueGradientDriver''' component changes the value of the field defined in <code>Target</code> based on the items in the <code>Points</code> list and their <code>Position</code> in relation to the <code>Progress</code> value.


<!--T:2-->
<!--T:2-->
Line 12: Line 12:
{{Table ComponentFields
{{Table ComponentFields
|Progress|Float| Controls which items from the <code>Points</code> list will be used to drive the value of <code>Target</code>
|Progress|Float| Controls which items from the <code>Points</code> list will be used to drive the value of <code>Target</code>
|Target|IField`1|TypeString1=IField<float>| The field that this component will drive the value of
|Target|{{RootFieldType|FieldDrive`1|T}}|TypeAdv1=true| 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 <code>Points</code> to the current <code>Progress</code> value.
|Interpolate|Bool| Controls whether or not this component will interpolate (or blend) between the nearest two <code>Points</code> to the current <code>Progress</code> value.
|Points|SyncList`1|TypeString3=SyncList<Point>|A list of items indicating their <code>Position</code> (in relation to <code>Progress</code>), and a <code>Value</code>
|Points|{{RootFieldType|SyncList`1|[[#Point|Point]]&lt;T&gt;}}|TypeAdv3=true|A list of items indicating their <code>Position</code> (in relation to <code>Progress</code>), and a <code>Value</code>
}}
}}


Line 36: Line 36:
== Related Components == <!--T:5-->
== Related Components == <!--T:5-->
</translate>
</translate>
[[Category:ComponentStubs]]
[[Category:Generics{{#translation:}}]]
[[Category:Components{{#translation:}}|Value Gradient Driver`1]]
[[Category:Components{{#translation:}}|Value Gradient Driver`1]]
[[Category:Generic Components{{#translation:}}|Value Gradient Driver`1]]
[[Category:Components With Nested Types{{#translation:}}|Value Gradient Driver`1]]
[[Category:Components:Transform:Drivers{{#translation:}}|Value Gradient Driver`1]]
[[Category:Components:Transform:Drivers{{#translation:}}|Value Gradient Driver`1]]

Latest revision as of 22:32, 7 November 2024

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 field drive of T 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 list of Point<T> 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