ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Attach marker to source Text keyframe

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
SaSuki Nibrou
Attach marker to source Text keyframe
on Jul 6, 2018 at 1:45:59 pm

Hello 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


Return to posts index

Jacob Roth
Re: Attach marker to source Text keyframe
on Jul 6, 2018 at 3:12:20 pm

Are 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 ""


Return to posts index

SaSuki Nibrou
Re: Attach marker to source Text keyframe
on Jul 6, 2018 at 3:59:14 pm

No, what i'm trying to do is, i want to to attach markers to source text, so when i move the marker the text keyframe move too.



Return to posts index


Dan Ebberts
Re: Attach marker to source Text keyframe
on Jul 6, 2018 at 4:31:33 pm

Probably 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



Return to posts index

Mansouri Walid
Re: Attach marker to source Text keyframe
on Jul 6, 2018 at 5:04:06 pm

Hi Dan Ebberts thank for your help, the code is working but i don't know why when i move the marker, the source Text stay in the same position, sorry i'm not good enough in english i hope you undrestand what i'm talking about.



i want them to move together.

best regards
Walid


Return to posts index

Dan Ebberts
Re: Attach marker to source Text keyframe
on Jul 6, 2018 at 5:43:24 pm

An expression can't actually move a keyframe. It should give the same result though.

Dan



Return to posts index


Mansouri Walid
Re: Attach marker to source Text keyframe
on Jul 6, 2018 at 6:08:25 pm

is it possible to do it via scripts, if yes can you help me please.


Return to posts index

Dan Ebberts
Re: Attach marker to source Text keyframe
on Jul 6, 2018 at 9:36:03 pm

This 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



Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]