Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions A question about global variable

Tagged: 

  • A question about global variable

    Posted by Dan Smith on September 15, 2024 at 7:11 pm

    Hey folks,

    the expression attached below defines a global variable, and I want to understand why the array gets automatically cleared after some time. How can I control when or if it gets cleared,thanks.

    if (typeof $.globalVar !== “undefined”) {

    $.globalVar.push(value)

    } else {

    $.globalVar = [value];

    }

    value;

     

    Dan Smith replied 3 weeks, 5 days ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    September 15, 2024 at 9:33 pm

    I would expect that not to work reliably just because of the way AE is designed to render frames asynchronously, where you can drop the CTI anywhere in the timeline and any expressions will solve without depending on results from previous frames. I suspect there is no good way to do global variables.

  • Dan Smith

    September 16, 2024 at 1:24 pm

    Hi Dan, thanks for your reply.

    In fact, I applied this expression to the position property and then called the values from this global variable group in another shape layer’s path property to create a path. I’m trying to create an effect in AE that looks like real-time writing, but the problem is that it clears itself automatically. Haha, it’s amusing but also quite confusing.

  • Dan Ebberts

    September 16, 2024 at 3:38 pm

    I think the important takeaway is that it’s not reliable. It might appear to work in some situations, but you shouldn’t count on it.

  • Dan Smith

    September 17, 2024 at 11:53 am

    Exactly,thanks a lot ,Dan.

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