First of all sorry for my poor experience about expressions.
I have done a modification of Dan Ebberts's expression "Trigerring animation with markers) for use the time of the markers from another comp layer but I am always getting an error "this property has no keyframe number xx"
What I am doing wrong?. Is there any way the expression to stop looking for more markers than the layer has got. Thanks in advance
action =comp("time_remap").layer("White Solid 1");
n = 0;
if (marker.numKeys > 0){
n = marker.nearestKey(time).index;
if (marker.key(n).time >= time){
n--;{
if (n > marker.numKeys) n = 0;}
}
}
if (n == 0){
0
}else{
m = marker.key(n);
m1 = marker.key(n+1);
myComment = m.comment;
myComment1 = m1.comment;
c= action.marker.key(myComment).time;
c1=action.marker.key(myComment1).time;
d=marker.key(myComment).time;
d1=marker.key(myComment1).time;
ease(time,d,d1,c,c1);
}
easing remapped time between markers
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
It might be that you only need to change this line:
if (n > marker.numKeys) n = 0;}
to this:
if (n > marker.numKeys-1) n = 0;}
Hard to say for sure though, without knowing exactly what you're trying to do.
Dan
if (n > marker.numKeys) n = 0;}
to this:
if (n > marker.numKeys-1) n = 0;}
Hard to say for sure though, without knowing exactly what you're trying to do.
Dan
Layer still looking for markers...
I have got a Composition (5 seconds duration) with a PreComp layer (time remapped) with six markers. The original comp has got 6 markers too but on 14 seconds. It just a correspondence. Marker number 1 time will be number one time on the other comp, etc.
The problem is when time reaches last keyframe says me... "this property has no keyfame number 8" "error ocurred at line..." here:
m1 = marker.key(n+1);
I have got a Composition (5 seconds duration) with a PreComp layer (time remapped) with six markers. The original comp has got 6 markers too but on 14 seconds. It just a correspondence. Marker number 1 time will be number one time on the other comp, etc.
The problem is when time reaches last keyframe says me... "this property has no keyfame number 8" "error ocurred at line..." here:
m1 = marker.key(n+1);
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
This one might work better for you:
You'll have to adjust the first line and you might want to change linear() to ease(), but play around with it.
Dan
Code: Select all
L =thisComp.layer("target") ;
max = Math.min(L.marker.numKeys,marker.numKeys);
if (max > 0){
n = 0;
if (L.marker.numKeys > 0){
n = L.marker.nearestKey(time).index;
if (L.marker.key(n).time > time){
n--;
}
}
if (n == 0){
t1 = 0;
t2 = L.marker.key(1).time;
t3 = 0;
t4 = marker.key(1).time;
linear(time,t1,t2,t3,t4);
}else if (n >= max){
marker.key(max).time + (time - L.marker.key(max).time);
}else{
t1 = L.marker.key(n).time;
t2 = L.marker.key(n+1).time;
t3 = marker.key(n).time;
t4 = marker.key(n+1).time;
linear(time,t1,t2,t3,t4);
}
}else{
value
}
You'll have to adjust the first line and you might want to change linear() to ease(), but play around with it.
Dan
Thanks Dan,
with some text corrections it is working fine. This is my final expression
with some text corrections it is working fine. This is my final expression
Code: Select all
L =thisComp.layer("source") ;
M=comp("source").layer("White Solid 1").marker;
max = Math.min(L.marker.numKeys,M.numKeys);
if (max > 0){
n = 0;
if (L.marker.numKeys > 0){
n = L.marker.nearestKey(time).index;
if (L.marker.key(n).time > time){
n--;
}
}
if (n == 0){
t1 = 0;
t2 = L.marker.key(1).time;
t3 = 0;
t4 = M.key(1).time;
ease(time,t1,t2,t3,t4);
}else if (n >= max){
M.key(max).time + (time - L.marker.key(max).time);
}else{
m=marker.key(n)
m1=marker.key(n+1)
myComment=m.comment
myComment1=m1.comment
t1 = L.marker.key(n).time;
t2 = L.marker.key(n+1).time;
t3 = M.key(myComment).time;
t4 = M.key(myComment1).time;
ease(time,t1,t2,t3,t4);
}
}else{
value
}