Time remap a Precomp(loop), to sync to layer markers

Moderators: Disciple, zlovatt

Post Reply
mauroz
Posts: 2
Joined: December 8th, 2006, 2:13 pm

Hi there,

I'm trying to time remap a loop I have in a Pre-comp so that in the main comp it start always when the time cursor hit a layer marker.
Basically I need strech the duration of the Pre-comp so that it always fit the distance between two layer markers.

I tried Dan Ebberts' express:

hit=marker.key(1).time;
t=time-this_comp.layer("audio.wav").marker.nearest_key(time).time;
t+hit

but the loop stop at half time of the animation.
I think because the time cursor as soon as it cross half of the loop is getting the value of the next layer marker.
I also try to add some statement but with no luck..
Does anybody have any idea?

Mauro
xxxxxxxxxxxxxxxxx
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

Try this one. It should get you close. Change "marker layer" to the name of your layer where the markers will be.

L = thisComp.layer("marker layer");

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

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

if ((p == 0) || (n == 0)){
inPoint
}else{
linear(time,L.marker.key(p).time,L.marker.key(n).time,inPoint,inPoint + source.duration)
}


Dan
Dan Ebberts
Posts: 319
Joined: June 26th, 2004, 10:01 am
Location: Folsom, CA
Contact:

Yikes! The forum formatting trashed my code. Let me try it again:

L = thisComp.layer("marker layer");

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

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

if ((p == 0) || (n == 0)){
inPoint
}else{
linear(time,L.marker.key(p).time,L.marker.key(n).time,inPoint,inPoint + source.duration)
}
mauroz
Posts: 2
Joined: December 8th, 2006, 2:13 pm

Dan,

What can I say....

I love you!!!


[thanks]


xxxxxxxxxxxxxxxxxxxx
Mauro
[/b]
User avatar
Disciple
Posts: 137
Joined: June 5th, 2004, 8:05 am
Location: Los Angeles, CA
Contact:

Dan, in case you don't know this, you can use the "code" tags to keep clean code formatting on the forum

HTH

Alex
Post Reply