Loop Animations

I have a animation loop.
How do i randomly change the duration at the end of the loop
every thing i try, spark throws up an error talking about how i looped the patches

If you need something further down the reactive patch graph to affect it, it’s not possible purely in the patch editor. It’s a pain, but you can do it by sending a pulse to script, then sending it from script back into patches.

1 Like

I was able to get it to work with your recommendations @josh_beckwith
Wow what a pain in the ass.

1 Like

Glad to know it works. I moved this topic to Spark AR Question and tag it to Animation category. Please mark Josh’s response as the solution to put this topic to Solved section :slight_smile:

1 Like

Actually you can just send random values with the random patch and whichever value is feed to the patch when the new loop is about to start is the one used for the whole loop, until the next one begins, and a new random value is picked. That’s why changing the duration while a loop is already in progress, won’t take effect until the current one ends

@Tomas_Pietravallo but you need something to trigger the randomize patch

You can just use another Loop animation that is something like 0.5s and is constantly generating new numbers :wink:

Like Tomas said, you can use Loop Animation as trigger. Just make sure to connect the second output called Looped, not the Progress to the Random’s pulse input.

There is a product on Gumroad resolve this by using block. for you reference:

1 Like

@pofu.lu That is awsome. Makes it alot easier then doing it through code.

@Adi_Satrio and @Tomas_Pietravallo I understand what you guys are saying but that only changes the random number at a specific time. I need that random number to be generated at the end of the animation loop. The reason if is I have an object with a duration of 1 and in the middle it gets a new number at .5 seconds nd changes duration to 3 you would see the object all of the sudden change speeds in the middle of the animation. @josh_beckwith and @pofu.lu suggestions actually change the duration at the end of the loop so there is no jump in speed in the middle of the animation.

1 Like