Activity › Forums › Adobe After Effects › Getting position from first keyframe only
-
Getting position from first keyframe only
Posted by Mike Foran on December 13, 2018 at 5:02 pmI would like the position of one layer to match the position of another layer’s first motion path keyframe. So object A would remain in the same place that Object B started it’s motion. Is there an expression that can get the position value of just the first keyframe?
Mike Foran replied 7 years, 5 months ago 4 Members · 8 Replies -
8 Replies
-
Richard Garabedain
December 13, 2018 at 5:09 pmHmm..How new to after effects are you? I need to know before I can answer.. Im not sure I understand the problem…It seems like a simple copy and paste would work..but that must not be it because that is too simpe
-
Mike Foran
December 13, 2018 at 5:18 pmI’m pretty advanced actually. I’m looking for a dynamic solution. Not sure if explaining the issue helps, but I’m trying to use a light path to control the path of particles in Stardust. When you use a Motion node in Stardust to do this, it bases the emitter on the location of where the light’s motion path starts. So if I move the starting position of the light, the the entire path of the particles shifts. I have to keep copying the starting point position of the light to the position of the emitter so the particles align to my light’s path.
This is a pain in the butt. I thought if I could just have an expression that would automatically retrieve the position of the light’s first keyframe for the position of the emitter, it might make this a lot easier to work with. I thought I understood it but I can’t seem to write an expression that isn’t broken.
-
Marko Suto
December 13, 2018 at 5:25 pmI’m no expert, but “valueAtTime” sounds like what you’re looking for?
thisComp.layer(1).position.valueAtTime(1/x) /// x being your comp frame rate
-
Richard Garabedain
December 13, 2018 at 7:29 pmcould you parent the light to a null and use stardusts starting keyframe to parent to the position of the null?
-
Mike Foran
December 13, 2018 at 7:49 pmI think that will do for now but I was hoping for something that would identify the first keyframe and pull that value. From other posts it does involve valueAtTime and key(1) but I can’t seem to figure the correct syntax. This is what I have so far, which does not work:
L = thisComp.layer("Motion Path A")
if (L.transform.position.numKeys > 1){
v1 = L.transform.position.valueAtTime(key(1));
}else{
L.transform.position
}
This gives me an error that “this property has no keyframe number 1” although it does. I think I’m just not addressing the layer properly?
-
Mike Foran
December 13, 2018 at 7:58 pmcould you parent the light to a null and use stardusts starting keyframe to parent to the position of the null?
Yes, but the issue here is that I am trying to adjust the path of the light that the particles are to follow (actually several of them) and if I move the first keyframe of the light position, the entire path of particles becomes offset from the path. The emitter position of Stardust needs to have the same coordinates as the first keyframe of the light path. So parenting the light to a null doesn’t solve my issue in this case. Thank you though.
-
Walter Soyka
December 13, 2018 at 8:08 pmTry this:
L = thisComp.layer("Motion Path A");
if (L.transform.position.numKeys > 1) {
L.transform.position.valueAtTime(L.transform.position.key(1).time);
} else {
L.transform.position;
}Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive | RenderBreak [blog] | Profile [LinkedIn]
Reply to this Discussion! Login or Sign Up