How To Create Widget Animation With Pure c++ Using UWidgetAnimation, UMovieScene, UMovieSceneTracks, UMovieSceneSections ETC.

Hello I have a widget written in pure C++. I want to create and play an animation for this widget using C++. Currently, I am using the UWidgetAnimation, UMovieScene, and UMovieSceneTracks, UmovieSceneSection, classes, but I haven’t been able to play the animation successfully.

I would like a very simple animation example where the Render Opacity of a UImage widget is 0 at the 0th second and 1 at the 1st second.

Can someone please share a code example?

I don’t want to use the ‘`UPROPERTY(Transient, meta = (BindWidgetAnim))’ macro. I want to write the animation purely in C++. Thank you.

can anyone know how to do it im trying over a week

If you have a reference to the widget in your C++ you can just set the color / opacity like the following. Code snippet that sets buttons active / inactive in C++.

// color and opacity constants
const FLinearColor ACTIVE_BUTTON_COLOR = FLinearColor(1, 1, 1, 1);
const FLinearColor INACTIVE_BUTTON_COLOR = FLinearColor(1, 1, 1, 0.333f);

UButton* _Button_Tool_01; // need reference to it

// set the color
_Button_Tool_01->SetBackgroundColor(INACTIVE_BUTTON_COLOR);

In your case you would tick a timer and change the color over time.