Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions After Effect Expression – Add selected number to value in a random time

  • After Effect Expression – Add selected number to value in a random time

  • Kim Tae Kyun

    January 15, 2021 at 10:15 pm

    I’m trying to make fake twitch kind of stuff But, stuck in small thing but annoying part..

    So, i want to make Random Chat speed.
    That mean selected number added in random time

    This is what i come up with

    // this expression go separated Y position
    var t = time
    var sN = 100 //selectedNumber
    var value = 0 //you can put existing Y value
    var talkDesider = Math.round(Math.random()*3);
    
    if (Talkdesider == 3){
       value = value + sN
    } else {
       value
    }
    

    this code will set selectedNumber and Value, TalkDesider

    if Talkdesider is 3 value + 100 and store that data to value again

    and if Talkdesider isn’t 3 just value will be output

    i thought this will work.. but after effect value or var isn’t store data over keyframe… so is there any way to make this..??

  • Dan Ebberts

    January 15, 2021 at 10:24 pm

    Expressions have no memory, or any way to pass results from one frame to the next. In this case I think your expression will (on each frame) have to re-calculate, frame-by-frame, everything that has occurred prior to the current time to come up with the correct result for the current frame.

  • Kim Tae Kyun

    January 15, 2021 at 11:02 pm

    Yes, that’s what i was learning about expression.. sadly..

    so that mean creating a value array form other javascript tool(chrome? or extendscript) and using that array to make keyframe is the only way?

  • Dan Ebberts

    January 16, 2021 at 12:03 am

    I guess you could do it with a script, which would create keyframes for your result.

    Or you could do it with an expression that creates the result on the fly, as I described. The expression might eventually bog down though, if your comp is long.

Viewing 1 - 4 of 4 posts

Log in to reply.

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