Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Save value data of an expression

  • Save value data of an expression

    Posted by Ben Goodman on May 1, 2016 at 4:22 pm

    Hi,
    I am trying to fix something in my expression and I will appreciate the help.
    I have a simple loopOut(‘pingpong’) expression on two keyframes on the rotation property.
    I wanted to stop and start the loop a few times, so I created a Checkbox and linked an ‘if’ expression like this:

    if (effect(“Checkbox Control”)(“Checkbox”) == 1)
    {
    loopOut(‘pingpong’);
    }
    else
    {
    transform.rotation;
    }

    It works well except that there is a jump whenever the checkbox is turning off.
    The rotation value jumps from whatever the value was at this time to the value of the second keyframe I gave at the begining.

    I think I need to save the value of the rotation at every ‘if’ loop and then return it back in ‘else’
    but I didn’t find a way how to do it.
    Thanks a lot!

    Ben Goodman replied 10 years ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Ebberts

    May 1, 2016 at 4:51 pm

    There’s no way to save any data from frame to frame, so it’s a lot more complicated than you would think. The best you can do would be to create your own loop. You would first need to look all previous checkbox keyframes to figure out how much “on” time there has been up to the current frame. Then you would use the modulo operator (%) to figure out where you are in the loop. You also have to account for the forward/backward part of the loop. There are a lot more details to take care of, but it’s definitely do-able if you have the motivation.

    I’m sure I’ve done something like that in the past, but I don’t have it handy.

    Dan

  • Ben Goodman

    May 1, 2016 at 6:40 pm

    Thank you so much for replying,
    I have learned a lot from you over the years!
    I’ll try what you suggested later and I’ll update.
    Thanks again!

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