ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

locking keyframes to markers ?

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
cow
alex dinnin
locking keyframes to markers ?
on Jul 24, 2008 at 3:07:08 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


Return to posts index

cow
matthew tully
Re: locking keyframes to markers ?
on Jul 24, 2008 at 4:39:49 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?


Return to posts index

cow
Dan Ebberts
Re: locking keyframes to markers ?
on Jul 24, 2008 at 4:44:38 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



Return to posts index


cow
alex dinnin
Re: locking keyframes to markers ?
on Jul 24, 2008 at 8:52:06 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







Return to posts index

cow
Dan Ebberts
Re: locking keyframes to markers ?
on Jul 24, 2008 at 9:40:43 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



Return to posts index

cow
alex dinnin
Re: locking keyframes to markers ?
on Jul 25, 2008 at 11:26:39 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



Return to posts index


Raja Kamaruzzaman Rc
Re: locking keyframes to markers ?
on Apr 27, 2017 at 3:59:32 am

Hi you still there? How do you tweak it exactly? I tried dan's script but the marker only represent the second keyframe.. whenever I move the marker the animation speed change. I want the marker as a trigger, when the time needle go past the marker then the animation starts.


Return to posts index

Dan Ebberts
Re: locking keyframes to markers ?
on Apr 27, 2017 at 4:23:23 am

Something like this maybe:


L = thisComp.layer("Layer With Marker");
if ((L.marker.numKeys > 0) && (numKeys > 0)){
t1 = key(1).time;
t = Math.max(time - L.marker.key(1).time,0);
valueAtTime(t1 + t);
}else
value



Dan



Return to posts index

Raja Kamaruzzaman Rc
Re: locking keyframes to markers ?
on Apr 27, 2017 at 5:53:13 am

Oh Yes! That works! thanks for such a fast reply!

Have a Good Day Dan!


Return to posts index


Raja Kamaruzzaman Rc
Re: locking keyframes to markers ?
on Apr 28, 2017 at 7:07:17 am

Hi dan.. The script you're giving is working fine.. but what if I have more than two keyframes? meaning I want the first 2 keyframes play as usual, but only the third and fourth keyframes will be triggered by that marker.

I did this :

L = thisComp.layer("Layer With Marker");
if ((L.marker.numKeys > 0) && (numKeys > 0)){
t1 = key(3).time;
t = Math.max(time - L.marker.key(1).time,0);
valueAtTime(t1 + t);
}else
value

Key 1 and 2 does not play at all.

Thanks!


Return to posts index

ali asgari
Re: locking keyframes to markers ?
on Aug 22, 2015 at 3:47:38 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


Return to posts index

alex dinnin
Re: locking keyframes to markers ?
on Aug 22, 2015 at 6:00:08 pm

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

Could you try and explain a bit more ?



Return to posts index


ali asgari
Re: locking keyframes to markers ?
on Aug 22, 2015 at 9:01:17 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>


Return to posts index

Dan Ebberts
Re: locking keyframes to markers ?
on Aug 22, 2015 at 9:38:24 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



Return to posts index

ali asgari
Re: locking keyframes to markers ?
on Aug 23, 2015 at 7:33:14 am

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


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]