UMG has support for animation timelines through the editor, but I often find them lacking. I created a UI tweening library in C++ to solve some of the problems of UMG animations:
- It's easy to create create multiple, offset animations for variable numbers of widgets inside containers. For example tweening each child of a VerticalBox with a delay between each element.
- It's possible to rearrange widget hierarchies without breaking animations.
- It's easy to scale animation durations, or have their speeds driven by code.
- Reusing animations between elements is easy.
UUITween::Create(SomeWidget, 0.2f)
.FromTranslation(FVector2D(-100, 0))
.FromOpacity(0.2f)
.ToTranslation(FVector2D(20, 10))
.ToOpacity(1.0f)
.Begin();
For more information, please refer to the full documentation on GitHub.
Example Usage
Tweening elements within a vertical box with a delay between each element
const float DelayBetweenElements = 0.1f;
for (int32 i = 0; i < MyVerticalBox.GetChildrenCount(); ++i)
{
UUITween::Create(MyVerticalBox.GetChildAt(i), 0.2f, DelayBetweenElements * i)
.FromTranslation(FVector2D(-100, 0))
.FromOpacity(0.2f)
.ToReset()
.Begin();
}