Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Randomly play different animations (is this possible?)

  • Randomly play different animations (is this possible?)

    Posted by Matthew Boutros on July 13, 2021 at 3:33 am

    Planning a potential video several hours long (for a stream background), and want to add some randomness throughout the long length without doing it manually.

    As an example: say I had a loop of a frog sitting and wanted it to randomly play an animation of it croaking, or blinking, or hopping into the water and back again.

    Is there away of doing that? I can do a little scripting.

    FURTHER INFORMATION

    • Happy to set up the animations as comps, or time remapping keyframes, comps, or pre-rendered files – whatever works.
    • Would be nice to have a default loop to return to, but I can make it work if that complicates things.
    • Would be nice to be able to play with different liklihoods for different animations (have some be really rare) but also not necessary.
    Matthew Boutros replied 4 years ago 4 Members · 6 Replies
  • 6 Replies
  • Terry Coolidge

    July 13, 2021 at 3:46 am

    Several hours long? I would be looking for a video playback solution that allows for scripting randomized sequencing of animated clips/loops. This doesn’t sound like a job for After Effects to me. Not the right tool for what you’re wanting to do in my opinion.

  • Matthew Boutros

    July 13, 2021 at 3:48 am

    Can you suggest a tool? After Effects is what I know, so I’d like to know if it’s possible – but if you have other suggestions please let me know!

  • Robert Müller

    July 13, 2021 at 8:58 am

    Since it is for streaming I would look into a OBS plugin solution, this one I found after a quick google search:

    https://github.com/UpDownLeftDie/obs-random-videos

    Maybe you can find more in their community 🙂

  • Matthew Boutros

    July 13, 2021 at 11:14 pm

    This is helpful for other projects I have, and will look into it.

    Maybe I shouldn’t have mentioned streaming – I really want to know if this is possible in After Effects first and foremost. I have a lot of things I want to do with this technique, and don’t want people getting caught up in this particular project.

    Thanks again for your reply Robert!

  • Walter Soyka

    July 19, 2021 at 5:51 pm

    This looked both fun and useful, so I wrote a quick little script to do it. There’s no error-checking in here to speak of, so use it at your own risk, but it should work fine if you set everything up the way the script expects.

    The script requires you to set up a comp for it to work in. You should set the duration of the comp to be the total duration you want the final output to be. Next, add one each of all the elements (footage, comps, whatever) as layers in the working comp. Right-click one of the column headers in the timeline, then choose Columns… and make sure that the Comments column is visible.

    In the Comments column, you can put any integer as the “weight.” This will govern how often you want that particular layer to appear in the final. The default weight is 1, so if you want something to appear twice as often as the default, put a 2. If you want something to appear three times as often, put a 3.

    If you things to appear fractionally more often, you’ll have to do a little math yourself. For example, if you have three layers and you want one of them to appear only 20% more often than the other two, you’d weight the two layers 5 and the third layer 6.

    Once you’ve completed that, with your working comp as the active item with focus in Ae, run the script.

    The script will read the weights for each layer in your comp, and duplicate that layer that number of times, multiplied by the number of complete sets necessary to hit the target length. Next, it will randomize the layer order. Finally, it will prune any layers that begin after the comp ends.

    I hope this can be at least a little educational — let me know if you have any questions!

  • Matthew Boutros

    April 12, 2022 at 5:18 am

    Walter… this is incredible!! Oh I can’t wait to try this out. Heck yeah! Not sure why I didn’t get a reply notification so I’ve only just found out about this.

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy