Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects AE expression – trigger script on marker

  • AE expression – trigger script on marker

    Posted by Ondrej Hanel on July 30, 2012 at 8:16 am

    Hi guys,
    I have come across a bit stragne thing. I have a layer and I want to randomize its position at each marker. Soundd trivial, but it’s giving me headache so far.

    The script:

    n = marker.nearestKey(time).index;

    if (marker.key(n).time == time){
    minVal = [0.1*thisComp.width, 0.1*thisComp.height];
    maxVal = [0.9*thisComp.width, 0.9*thisComp.height];
    random(minVal,maxVal)

    } else {
    value
    }

    So this script does randomize the position at each marker, but when the marker is passed it returns the layer to original position… which is so not what i want 🙂

    any thoughts?

    Ondrej Hanel replied 13 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dan Fredley

    July 30, 2012 at 5:28 pm

    Try this:

    n = marker.nearestKey(time).index;

    if (marker.key(n).time < time){
    minVal = [0.1*thisComp.width, 0.1*thisComp.height];
    maxVal = [0.9*thisComp.width, 0.9*thisComp.height];
    random(minVal,maxVal)

    } else {
    value
    }

  • Ondrej Hanel

    July 31, 2012 at 7:42 am

    Hi,
    thanks for the reply. I actually had something like that already, it causes the layer to start randomizing its position at each frame passing the first marker. So its kinda like opposit of what I have.

    However I need the layer to randomize its position just at one frame – where the marker is.

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