Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Alternate between two values x-times per second.

  • Alternate between two values x-times per second.

    Posted by Andy Rider on July 25, 2009 at 4:18 pm

    I’m looking for a z position value to alternate between two values at a certain frequency (more than 25 times a second (pal) so I can’t loop key frames. If anyone knows how to do this I would be very grateful.

    Thanks

    Andy

    Andy Rider replied 16 years, 9 months ago 3 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    July 25, 2009 at 5:03 pm

    I think this will do it:

    zVal1 = 500;
    zVal2 = 1000;
    freq = 50;

    phase = Math.floor(time*freq);
    z = phase%2 ? zVal2 : zVal1;
    [value[0],value[1],z]

    Dan

  • Andy Rider

    July 25, 2009 at 8:23 pm

    Thanks for replying so quickly Dan I appreciate your help!

    I tried the expression (which I almost understand lol). Unfortunatly I don’t think After Effects works the way I thought it might.

    I’m trying to create an audio wave form using Particular releasing static particles.

    I used audio key frames to effect the emitter’s height y-axis and a null to animate it across the x-axis. I thought if i used enough particles and moved them back and forth the z-axis fast enough I would be able to give the waveform some depth

    Unfortunately due to the comp frame rate the expression rounds the position off to either one of the two values and does not show evidence of movement between frames.

    Cheers

    Andy

  • Filip Vandueren

    July 30, 2009 at 7:34 pm

    In trapcode Particular V2 (just released) you can set the Emitters position to ‘precise’,
    which is to say that it will recalculate the position of the emitter for every particle that’s spawned.

    Unless you specify this, the maximum timing resolution of Particular is 1/10th of a frame. (the default, and only option in V1)

    So it’s not a limitation of After Effects

  • Andy Rider

    July 31, 2009 at 3:36 pm

    Cheers for your help Filip.

    I should have been less vague in my first post as the expression Dan kindly wrote works per frame.

    1/10th of a frame might just be good enough until I can afford Particular 2. I would need an expression that works like a wiggle frequency but without the randomness and in-between values i.e. alternate between value “x” and value “y” 250 times a second.

    Does any one have any idea if this is possible as i think the waveform could look quite cool with some work?

    Thanks

    Andy

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