Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions locking keyframes to markers ?

  • locking keyframes to markers ?

    Posted by Alex Dinnin on July 24, 2008 at 3:07 pm

    Hey everyone,

    Is there a way I can lock keyframes to a marker ???

    I have loads of maps to make, all the same format.. however the keyframes have to move.. eg map 01 has layer 01, 02 & 05 have scale, opacity and position keyframes at 12 & 120, and on map 02 they have the same keyframes but at 15 & 97.

    What would be great. would be to constrain all the keyframes to markers.. so at every map.. instead of having to twiddle down each layer.. I could just move two markers ??

    is this even possible, or am I being a bit optimistic ??

    thanks in advance

    Alex

    Raja kamaruzzaman Rc replied 9 years ago 5 Members · 14 Replies
  • 14 Replies
  • Matthew Tully

    July 24, 2008 at 4:39 pm

    you should make a null and attach as many sliders as you have properties to change each time, this way you only have to edit one set of keyframes.

    Not sure if this helps, could you explain the problem a little more?

  • Dan Ebberts

    July 24, 2008 at 4:44 pm

    Assumptions: Each map is its own comp; the map comps are all in another comp named “master”; there are exactly two linear keyframes for each keyframed property; the markers are applied to the map comp layers in the master comp; the map comp layers in the master comp have not been renamed. Then, applying this expression to each keyframed property should do the trick:

    L = comp(“master”).layer(thisComp.name);
    if ((L.marker.numKeys > 1) (&& numKeys > 1)){
    t1 = L.marker.key(1).time;
    t2 = L.marker.key(2).time;
    v1 = valueAtTime(key(1).time);
    v2 = valueAtTime(key(2).time);
    linear(time,t1,t2,v1,v2)
    }else{
    value
    }

    If your setup is different, the expression will need to be revised. 🙂

    Dan

  • Alex Dinnin

    July 24, 2008 at 8:52 pm

    ok.. Thanks for the help so far.. but I don’t think I really explained myself.
    I have a big resolution map, which I have a route going from A to B, using stroke. I have a triangle following the stroke (copied the path onto the position) to look like a pointer. As the Pointer gets near to B the name appears. I then precomp this into a Pal 16:9 comp which I animate the position.

    this is basically the run down.

    frame 10 : stroke starts, triangle starts.

    frame 100 : place name opacity 0%

    frame 110 : place name opacity 100%, end stroke.

    the durations of the maps change.. some are 90 frames some are 120 etc etc.. however the setup is always the same. The first keyframe is at 10 frames.. What I want to be able to do is have a marker which the end two keyframes follow.

    I have about 80 of these maps to do, so it would be fantastic if I could just move two end markers.. and the end keyframes follow..

    I hope this makes a bit more sense..

    thanks for your help already

    regards

    Alex

  • Dan Ebberts

    July 24, 2008 at 9:40 pm

    OK – now assume that you have a layer in the comp named “Layer With Marker”, where the marker is. Then try this:

    L = thisComp.layer(“Layer With Marker”);
    if ((L.marker.numKeys > 0) && (numKeys > 1)){
    t1 = key(1).time;
    t2 = L.marker.key(1).time;
    v1 = valueAtTime(key(1).time);
    v2 = valueAtTime(key(2).time);
    linear(time,t1,t2,v1,v2)
    }else{
    value
    }

    Dan

  • Alex Dinnin

    July 25, 2008 at 11:26 am

    Hi Dan,

    Thank you so much.. It took me a while to work out how it was working.. and then a bit longer to tweak it..

    But it works like a charm now.. thanks very much for you help

    Alex

  • Ali Asgari

    August 22, 2015 at 3:47 pm

    dear friend
    I have similar problem
    I’m working on a project and I have to import many sequences with own markers from primiere to after effects . I want to camera keyframe change to marker automatically . I tried to change your expression and change it for my project but I failed . may you help me .
    thanks in advance and sorry for my bad english

  • Alex Dinnin

    August 22, 2015 at 6:00 pm

    I’m sorry. I don’t really understand what you Nader to do.

    Could you try and explain a bit more ?

  • Ali Asgari

    August 22, 2015 at 9:01 pm

    I want to my camera keyframe position move base on markers of a layer .
    your expression worked finally with two keyframe. I tried to change and adopt it for more than two keyframe. but I got warning .
    I changed your expression this way

    L = comp(“master”).layer(thisComp.name);
    if ((L.marker.numKeys > 1)){
    t1 = L.marker.key(1).time;
    t2 = L.marker.key(2).time;
    t3= L.marker.key(3).time;
    v1 = valueAtTime(key(1).time);
    v2 = valueAtTime(key(2).time);
    v3= valueAtTime(key(3).time);
    linear(time,t1,t2,t3,v1,v2,v3)
    }else{
    value
    }

    and I got attached warning.
    many thanks for your help.

    <a href="https://images.creativecow.net/300638/attachment.jpg"><img src="https://i1.creativecow.net/u/300638/attachment.jpg" border="0" /></a>

  • Dan Ebberts

    August 22, 2015 at 9:38 pm

    linear() only works for two values. I think you need something more like this:


    L = comp("master").layer(thisComp.name);
    if ((L.marker.numKeys > 2) && (numKeys > 2)){
    t1 = L.marker.key(1).time;
    t2 = L.marker.key(2).time;
    t3= L.marker.key(3).time;
    v1 = valueAtTime(key(1).time);
    v2 = valueAtTime(key(2).time);
    v3= valueAtTime(key(3).time);
    if (time < t2){
    linear(time,t1,t2,v1,v2);
    }else{
    linear(time,t2,t3,v2,v3);
    }
    }else{
    value
    }

    Dan

  • Ali Asgari

    August 23, 2015 at 7:33 am

    you are great
    it worked .
    many thanks.
    and can I expand the expression for more key frames?

Page 1 of 2

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