Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Random frame on trigger

  • Random frame on trigger

    Posted by Justin Stephenson on June 12, 2014 at 6:39 pm

    Hello,

    I am working on an animation in which I would like to trigger a random frame in a frame sequence based on an audio event (an irregularly timed click). The frame would hold until the next trigger.

    I can very easily create a boolean switch from the audio using soundkeys or an expression. I am having a more difficult time figuring out how I would use this to trigger a random frame which would hold until the next trigger.

    I would appreciate it if someone could point me in the right direction.

    Best,

    – Justin

    ————————-
    Design, Animation, Editing, Color for Cinema, Broadcast, Web and Installation.

    Gear: 2 X Macpro 8 Core Nehalem, ATTO R380, Proavio EB8MS, nVidia GTX-286, Blackmagic Decklink Studio, AJA LHi, FSI LM-2461W, Tangent Wave, Yamaha HS50Ms W HS10w Sub

    Tools: Avid MC 5.5 (formerly FCP), CS 5.5, C4D13, Resolve 8.1, VDMX, Quartz Composer, Processing, Cubase 5.

    Justin Stephenson replied 11 years, 10 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    June 12, 2014 at 6:56 pm

    I think you first need to count how many triggers there have been up to the current time. This should help with that:

    https://www.motionscript.com/design-guide/audio-count.html

    Then use the resulting value (n) to seed the random number generator:

    seedRandom(n,true);

    Then select the random frame:

    framesToTime(Math.floor(random(number_of_total_frames)))

    Something like that.

    Dan

  • Justin Stephenson

    June 12, 2014 at 7:48 pm

    Perfect! Thank-you, Dan. I also used the counter to create random seeds for some fractal noise layers that I am using for textures and light.

    The end effect is that each time the bass drum is hit, a new background appears.

    Best,

    – Justin

    ————————-
    Design, Animation, Editing, Color for Cinema, Broadcast, Web and Installation.

    Gear: 2 X Macpro 8 Core Nehalem, ATTO R380, Proavio EB8MS, nVidia GTX-286, Blackmagic Decklink Studio, AJA LHi, FSI LM-2461W, Tangent Wave, Yamaha HS50Ms W HS10w Sub

    Tools: Avid MC 5.5 (formerly FCP), CS 5.5, C4D13, Resolve 8.1, VDMX, Quartz Composer, Processing, Cubase 5.

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