Description
The FrequencyCurve
property of the HapticPattern
class represents the curve that defines how the frequency of the haptic feedback changes over time. This property is of type Curve
, which allows for complex, non-linear frequency changes to be defined, providing a more dynamic and realistic haptic experience.
Usage
To use the FrequencyCurve
property, you can access it directly from an instance of the HapticPattern
class. You can then manipulate the curve to adjust the frequency changes over the duration of the haptic pattern.
For example, you might want to create a haptic pattern where the frequency starts low and gradually increases. You can achieve this by setting the FrequencyCurve
to a curve that represents this behavior.
Example
// Create a new HapticPattern instance
HapticPattern hapticPattern = new HapticPattern();
// Access the FrequencyCurve property
Curve frequencyCurve = hapticPattern.FrequencyCurve;
// Modify the frequency curve to create a custom pattern
frequencyCurve.AddKey(0.0f, 0.5f); // Start at low frequency
frequencyCurve.AddKey(1.0f, 1.0f); // End at high frequency
// Now the haptic pattern will have a frequency that increases over time