unfurl

Tween

A lightweight tweening library for Unreal Engine.

A lightweight tweening library for Unreal Engine.

๐Ÿ‘€ Summary

NsTween moves a value from a start to an end over time, with an easing curve. Use it from C++ with FNsTween::Play, or from Blueprint with async nodes. It suits UI motion and small game motion, such as a floating pickup, a door, or a color pulse.

NsTween does not replace UMG animations or Sequencer, and it does not replicate. Tweens run on real time, so a game pause or a time dilation does not slow them.

NsTween easing presets

๐Ÿ“ฆ Features

โš™๏ธ Requirements

๐Ÿ› ๏ธ Installation

  1. Clone or download this repository.
  2. Copy the NsTween folder into the Plugins folder of your project.
  3. For C++, add "NsTween" to the dependencies of your game module.
  4. Generate the project files and enable the plugin.

๐Ÿš€ Getting Started

In C++, FNsTween::Play returns a builder. Chain the options in the same statement. The tween starts when the builder goes out of scope.

#include "NsTween.h"

void AMyActor::BeginPlay()
{
    Super::BeginPlay();

    const FVector Start = GetActorLocation();
    FNsTween::Play(0.f, 100.f, 2.f, ENsTweenEase::InOutQuad, [this, Start](float Value)
    {
        SetActorLocation(Start + FVector(Value, 0.f, 0.f));
    })
    .SetOwner(this);
}

In Blueprint:

  1. Add the Tween Float node.
  2. Set Start, End, Duration Secs, and Ease Type.
  3. Connect Apply Easing to the code that uses Value.
  4. Connect On Complete to the code that runs at the end.

๐Ÿงฉ Blueprint Nodes

Node Output
Tween Float, Tween Vector, Tween Vector 2D The value on Apply Easing
Tween Rotator, Tween Quat, Tween Quat From Rotator A Rotator or a Quat on Apply Easing
Tween Transform, Tween Linear Color The value on Apply Easing
... Custom Curve versions The same, with a Float Curve as the ease
Play Float Tween, Play Vector Tween, Play Rotator Tween, Play Transform Tween, Play Color Tween A handle. The tween writes to the Target variable
Pause Tween, Resume Tween, Cancel Tween, Is Tween Active Control by handle

๐Ÿ”ง API

๐Ÿšง Limits

๐Ÿงพ Acknowledgement

NsTween takes its inspiration from Fresh Cooked Tweens by Jared Cook.

๐Ÿ“š Documentation


Contact