Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Change value of a field in a different composition.

  • Change value of a field in a different composition.

    Posted by George Felix on July 7, 2017 at 6:54 am

    I don’t know if this is possible.

    Basically I want to do a counter that will store a value so I can later retrieve it in a different frame with an expression

    In comp A we have a field called A

    In comp B we have a field B that has some expressions in it. We have a variable in it called count.

    In the if statement is true, 1 is added to the value of A in Comp A.
    When the if statement is true again, it retrieves the value of A in Comp A and adds 1 to it again. The value of A changes, only when the if is true. This will create a counter.

    George

    George Felix replied 9 years ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 7, 2017 at 1:17 pm

    Expression have no memory, so there are no persistent variables. There may be workarounds though, depending on what you’re trying to do.

    Dan

  • George Felix

    July 7, 2017 at 2:46 pm

    I would like to be able to make a loop counter .

    I’m making a game clock which will run for 45 minutes. I figured to have the scored change automatically when the clock reaches the time that a goal is scored.

    Originally the goals scored of team A is 0.

    At 10:05, they score a goal.
    This time is at the frame of (10*60 + 5) = 605 seconds and if we have 30 frames per second, then at frame 18150, the score should change from 0 to 1.

    At frame 31150 they score a second goal, then the 1 should change to 2. Every time a frame is reached that a new goal is scored, the value displayed should change by 1.

    Is their a work around.

    We know how many goals will be scored in the half, and the frame that they are scored upon.

    Any help will be greatly appreciated.

    George

  • Dan Ebberts

    July 7, 2017 at 4:03 pm

    This is a simple example where you set up an array with the goal scoring times (in seconds):


    goalTimes = [100,200,300,400]; // in seconds
    score = 0;
    for (i = 0; i < goalTimes.length; i++){
    if (time > goalTimes[i])
    score++
    else
    break;
    }
    score

    Dan

  • George Felix

    July 7, 2017 at 4:49 pm

    I don’t know how to thank you!!!!!!

    It works great!!!!

    Thanks

    George

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