Copy link to clipboard
Copied
Hello,
I'm in need of an expression whereby a marker value in one comp will drive/equal the time remap value of another comp.
as an example:
Within a comp (MarkerComp1), I have a layer (MarkerLayer1) in which the comp marker value is set to 20
In my second comp (TremapComp2) I have a Time remap layer (TrmapLayer2) in which I would like this to equal 20 as well.
Can this be done?
Thanks for any help
Jeff
Copy link to clipboard
Copied
http://www.motionscript.com/design-guide/marker-sync.html
Follow this example on how to read the marker comment, then simply use a
parseInt(m.comment)
to get a value from a text string.
Mylenium
Copy link to clipboard
Copied
I'll check this out.
Thanks!
Jeff
Copy link to clipboard
Copied
Trying to wrap my head around this.
I think the example Dan provided on his web site may be more complicated for what I need.
Below is an example (Dan also provided), which matches a marker value to the exact layer number of an opacity channel.
L = comp("MarkerComp1").layer("TremapComp2");
n = 0;
if (L.marker.numKeys > 0){
n = L.marker.nearestKey(time).index;
if (L.marker.key(n).time > time) n--;
}
if (n > 0){
idx = parseInt(L.marker.key(n).comment,10);
if (idx == index) 100 else 0;
}else{
0
}
I've tried various methods of modifying this to accept time remaping..., with no luck..
....Any ideas how to create an expression whereby a time remap value follows a marker value?
Thanks for any help.
Jeff
Copy link to clipboard
Copied
Try applying this to the time remap property of your TrmapLayer2:
L = comp("MarkerComp1").layer("MarkerLayer1");
n = 0;
if (L.marker.numKeys > 0){
n = L.marker.nearestKey(time).index;
if (L.marker.key(n).time > time) n--;
}
if (n > 0){
parseInt(L.marker.key(n).comment,10);
}else{
0
}
This should hold the time remapping at zero until a marker is reached on MarkerLayer1, then the time remap will be set to the value of the comment for that marker. If you have more than one marker, it will switch and hold each time it gets to the next marker.
Dan
Copy link to clipboard
Copied
Thanks for the help, Dan
I've copied the expression into the comp layer, but cant seem to get it to work properly... When the timeline hits a marker, the time remap comp stays at time index 5, ( regardless of the marker value)
After numerous attempts at various sequence images, duration's. It seems that the hold value of the time remap index may be related to the duration of the original image sequence. ie a 20 frame sequence holds at 20 in the time remap value index.
Any ideas to circumvent this?
thanks again
jeff
Copy link to clipboard
Copied
Please specify your setup again (comp names, layer names, what's nested, what's time remapped, etc.) so I can make sure I set the expression up correctly.
Dan
Copy link to clipboard
Copied
Sure.. thanks for the help.
My original composition is massive, so ive created a simple setup of 4 compositions:
1st: 19 frame image Sequence layer, ("Images_Comp") 19 frame duration
2nd: Time remaped from 1st comp ("TimeRemapComp") 100 frame duration
3rd: An empty composition ("MarkerLayerComp") 100 frame duration,.... this comp will be dragged into the 4th comp.
4th: My final animation control comp ("FinalAnimationComp") 100 frame duration
Within the ("FinalAnimationComp") is the layer ("MarkerLayerComp") in which I indicated several markers ie: 4, 6 8 etc.
I've pasted the expression bellow within the ("TimeRemapComp") time remap channel
L = comp("FinalAnimationComp").layer("MarkerLayerComp");
n = 0;
if (L.marker.numKeys > 0){
n = L.marker.nearestKey(time).index;
if (L.marker.key(n).time > time) n--;
}
if (n > 0){
parseInt(L.marker.key(n).comment,10);
}else{
0
}
But once again the time remap index begins and holds at frame 1, until I hit a marker value.. in which it then holds at index value of 19.
Hope this helps out
Jeff
Copy link to clipboard
Copied
Did you want the 4, 6, 8 markers to specify frames? The expression is currently treating those as seconds.Try changing this:
parseInt(L.marker.key(n).comment,10);
to this:
framesToTime(parseInt(L.marker.key(n).comment,10));
Dan
Copy link to clipboard
Copied
Thanks Dan!, that did the trick.
I really appreciate this
.. although one odd thing i notice... when the timeline falls on the marker 10, the time remap value reads 11, when the timeline falls on marker value of 4, the time remap jumps to 5. It seems to offset by 1.
Do you know what causes this?
...either way, I guess i can add an empty layer to compensate.
Thanks once again for the help!
Jeff
Copy link to clipboard
Copied
In your project settings, do you have "Start numbering frames at:" set to one? That would do it. You could trysubtracting one, like this:
framesToTime(parseInt(L.marker.key(n).comment,10)-1);
Dan
Copy link to clipboard
Copied
Great!
thanks, Dan
Jeff