EasingUtils
ceramic.EasingUtils (Class)
Utility functions for converting between Easing enum values and strings.
This class provides serialization support for easing functions, allowing them to be stored in configuration files, transmitted over networks, or used in any context requiring string representation.
Usage Example
// Convert easing to string for storage
var easing = Easing.QUAD_EASE_OUT;
var str = EasingUtils.easingToString(easing); // "QUAD_EASE_OUT"
// Restore easing from string
var restored = EasingUtils.easingFromString("QUAD_EASE_OUT");
// Use with configuration
config.animationEasing = EasingUtils.easingToString(myEasing);
var loadedEasing = EasingUtils.easingFromString(config.animationEasing);
Limitations
- BEZIER and CUSTOM easings are not yet supported for serialization
- Invalid string names will throw an exception
See: ceramic.Easing For the easing enumeration
Static Members
easingFromString(str: String): Anonymous
Converts a string representation to an Easing enum value.
The string must exactly match an Easing enum constructor name (e.g., "LINEAR", "QUAD_EASE_IN_OUT", etc.).
Name | Type | Description |
---|---|---|
str |
String | The string name of the easing function |
Returns | Description |
---|---|
Anonymous | The corresponding Easing enum value |
easingToString(easing: Anonymous): String
Converts an Easing enum value to its string representation.
Returns the exact constructor name of the enum value, which can be used with easingFromString() to recreate the easing.
Name | Type | Description |
---|---|---|
easing |
Anonymous | The Easing enum value to convert |
Returns | Description |
---|---|
String | The string name of the easing constructor * haxe var str1 = EasingUtils.easingToString(Easing.LINEAR); // "LINEAR" var str2 = EasingUtils.easingToString(Easing.ELASTIC_EASE_IN); // "ELASTIC_EASE_IN" * // Round-trip conversion var original = Easing.SINE_EASE_OUT; var str = EasingUtils.easingToString(original); var restored = EasingUtils.easingFromString(str); // original == restored * TODO: Add support for BEZIER easing serialization |