How to create timeline-like variable in cpp

how to create something like timeline node in the cpp, and the data can be tweak visually as a curve (liek tweak that visually in defaults tab - or something like that)… can anyone can tell me that. thx?

You could e.g. create a new CurveFloat from the Editor (in the Content Browser go Add New > Miscellaneous > Curve > CurveFloat) and add your function there. That way you can tweak it visually as you like.

In the constructor of your C++ class where you want to use that curve, you first need to get the asset you just created:

static ConstructorHelpers::FObjectFinder<UCurveFloat> Curve(TEXT("CurveFloat'/Game/PathToAsset/MyCurve.MyCurve'"));
FOnTimelineFloat CurveFloatTrack{};
// this function will be called on timeline tick
CurveFloatTrack.BindUFunction(this, "MyCurveProgress");
// use the actual asset from the editor as timeline
FTimeline MyTimeline = FTimeline{};
MyTimeline.AddInterpFloat(Curve.Object, MyCurveProgress, FName(TEXT("curveTrack")));

Further you would need to start the timeline and implement your progress function which will be called every tick (which is like the Update output of the BP timeline node).

Have a look at FTimeline to see what is possible.

Hope this helps. If you have any questions, feel free to ask.

owh thx, i will try to implement that now jejeje

Has anyone got this working? Could you show us a project with eveything working?