Activity › Forums › Adobe After Effects Expressions › Attach marker to source Text keyframe
-
Attach marker to source Text keyframe
Posted by Mansouri Walid on July 6, 2018 at 1:45 pmHello guys, i’m new here it’s my first post
please i have a question, is there any way to attach marker key to source text keyframes ? , i want when i move the marker the source text keyframe move too attached to each other.best regards
Dan Ebberts replied 8 years ago 3 Members · 7 Replies -
7 Replies
-
Jacob Roth
July 6, 2018 at 3:12 pmAre you trying to get the source text to reflect marker comments? If so, here’s your code.
m = thisComp.layer("Your Layer"); // source text layer name inside parens and quotes
n=0;
if (m.marker.numKeys > 0){
n = m.marker.nearestKey(time).index;
if (m.marker.key(n).time > time) n--;
}
if (n > 0) m.marker.key(n).comment else "" -
Mansouri Walid
July 6, 2018 at 3:59 pm -
Dan Ebberts
July 6, 2018 at 4:31 pmProbably like this:
m = marker;
n=0;
if (m.numKeys > 0){
n = m.nearestKey(time).index;
if (m.key(n).time > time) n--;
n = Math.min(n,numKeys);
}
if (n > 0)
key(n).value
else
""
Dan
-
Mansouri Walid
July 6, 2018 at 5:04 pm -
Dan Ebberts
July 6, 2018 at 5:43 pmAn expression can’t actually move a keyframe. It should give the same result though.
Dan
-
Mansouri Walid
July 6, 2018 at 6:08 pmis it possible to do it via scripts, if yes can you help me please.
-
Dan Ebberts
July 6, 2018 at 9:36 pmThis is pretty rough, but it should give you the idea:
var myComp = app.project.activeItem;
var myLayer = myComp.layer(1);
var myMarker = myLayer.property("Marker");
var times = [];
for (var i = 1; i <= myMarker.numKeys; i++){
times.push(myMarker.keyTime(i));
}
var myProp = myLayer.property("ADBE Text Properties").property("ADBE Text Document");
var values = [];
for (var i = 1; i <= myProp.numKeys; i++){
values.push(myProp.keyValue(i));
}
for (var i = myProp.numKeys; i > 0; i--){
myProp.removeKey(i);
}
for (var i = 0; i < Math.min(values.length,times.length); i++){
myProp.setValueAtTime(times[i],values[i]);
}
Dan
Reply to this Discussion! Login or Sign Up

