How use For each loop and timeline ?

Hello!

I need your help!

I created this structure (blueprint) for a simple Barchart. The boxes must be scaled by reading some data from a csv, animated by a timeline! In this structure, the animation is applied only to the last bar, the rest of the bars remain in place. Can someone tell me where to put that ■■■■ timeline so that it applies the animation to all the boxes correctly? I tried to place it before Get Data Table, then it applies the animation to all the boxes, but the Reverse function no longer works, as if an instance of that animation were created.


timeline is asyncronic…its like a delay…it has its own time. each time you reach PLAY it just runs the timeline (if stoped starts playing, if playing does nothing).

For loop runs the whole loop (x to y) and stops everything until it finished before continue the flow of the game. Its not async. thats why you can use For loops in functions but cant use timelines…note timeline node has a clock on it. that means async (like events)

You must create those components and put all in an array, then PLAY FROM START and in UPDATE from timeline put another for loop that iterates all the components (take the array and make a FOR EACH LOOP) and update the scale there.

Also you have a flip flop…so you create the static meshes and then you play in reverse…then you create AGAIN and reverse CREATE reverse…you are adding static meshes on each FLIP and dont getting rid of it on the FLOPS…here is some that can work deleting the static meshes when reverse ends:

anyway maybe is better to create that array of static meshes at the beginning of the game and keep them hidden…then instead of create/destroy you just unhide, use and then hide again.

Create/destroy stuff is the less efficient stuff :slight_smile:

4 Likes

In case you read already I added stuff to previous reply.
Good Luck!

Dany

Thank you very much for the support, I will try this, I hope I can do it! I’m at the beginning of working in the blueprint and it’s very difficult, at least so far :slight_smile:

1 Like

Eldany What node did you use here?

Sorry, I found it, but it doesn’t reverse the animation

1 Like

I’m very stupid, sorry, I solved it! Thanks a lot for the support!

1 Like

You’re not.

You are learning and screw things is part of learning and master anything (ask Elon).
Keep Screwing it! :slight_smile:

Best,
Dany

2 Likes

The adventure is not over! Now I want to add the percentages! :slight_smile:
I created a function to always position the percentage above the bar, then I created another For Each Loop for the text component, I linked this function right after the newly created for each loop! But only the first percentage follows the height of the bar! How do I convince the other percentages to follow the example of the first one :slight_smile:



To setPointLocation function add an integer input (call it INDEX)

inside the function, plug that Index input to your array indexes for (for mesh and text)

in the for loop body you are calling that function…plug the loop index to your function index.

image

You are the best! Thank you very much for your help, but the wonderful function is not working! Only the first percentage follows the first bar and the rest does not! What am I not doing right? :slight_smile:



Can someone help me please? How do I position all the percentages above the bars?
:slight_smile:

You just saved my life!

1 Like

ok I can back to my planet now :slight_smile:

1 Like

Thanks Bro

1 Like