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
Time remap a Precomp(loop), to sync to layer markers
-
- Posts: 320
- 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
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
-
- Posts: 320
- 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)
}
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)
}
Dan, in case you don't know this, you can use the "code" tags to keep clean code formatting on the forum
HTH
Alex
HTH
Alex