Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Wiggle Flicker expression

  • Wiggle Flicker expression

    Posted by Bryan Woods on January 29, 2013 at 1:18 am

    Trying to create an expression that will trigger when a marker is reached for 12 frames from a marker’s time. I couldn’t find any resource online stating how to make an expression last for a specific duration. Drove me crazy. I tried writing it myself, but I’m not getting anywhere. Any suggestions?

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n--;
    }
    }

    if (n == 0){
    value;
    } else {
    if ((marker.key(n).time) < (marker.key(n).time+12)){
    wiggle(8,100);
    }else{
    value;
    }
    }

    Bryan Woods replied 13 years, 6 months ago 2 Members · 3 Replies
  • 3 Replies
  • Bryan Woods

    January 29, 2013 at 1:32 am

    Hold the phone. I got it.

    n = 0;
    if (marker.numKeys > 0){
    n = marker.nearestKey(time).index;
    if (marker.key(n).time > time){
    n--;
    }
    }

    if (n == 0){
    value;
    } else {
    if (time < (marker.key(n).time+1)){
    wiggle (5,100);
    }else{
    value;
    }
    }

    However I’m going by timecode, and I’d like to work in frames. I know there’s a timeToFrames, but how do I work that in to this? Do I need to set time converted to frames as a variable? How do I use that with marker.key?

  • Dan Ebberts

    January 29, 2013 at 1:54 am

    I haven’t tested it, but this should work:

    if (timeToFrames(time) < (timeToFrames(marker.key(n).time)+1))

    Dan

  • Bryan Woods

    January 29, 2013 at 2:20 am

    Yup, thats it. Thank you Dan.

    Final flicker code:


    //triggers a flicker at every layer marker lasting 12frames

    n = 0;
    duration = 12; //# of frames from marker
    if (marker.numKeys > 0){
     n = marker.nearestKey(time).index;
     if (marker.key(n).time > time){
       n--;
     }
    }

    if (n == 0){
     value;
    } else {
    if (timeToFrames(time) < (timeToFrames(marker.key(n).time)+duration)){
    wiggle (10,90);
    }else{
    value;
    }
    }

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