Activity › Forums › Adobe After Effects Expressions › Expression to Control a Single Keyframe’s value
-
Expression to Control a Single Keyframe’s value
Posted by Jonathan Granskog on October 24, 2011 at 11:40 amI have this circle with an animated radial wipe (100%-0) and I would like its second keyframe (0%) to be adjusted accordingly to what you write in to a text layer, so my question is,
is there any expression that I can put on the circles radial wipe percentage value so that the second keyframe will be adjusted accordingly to what you write in to the text layer?Thanks a lot!
Dan Ebberts replied 3 years, 9 months ago 6 Members · 12 Replies -
12 Replies
-
Dan Ebberts
October 24, 2011 at 4:54 pmDo you mean that you want to use the timing of the 2nd keyframe but not the value? Are the keyframes linear? Are there keyframes after the 2nd one?
Dan
-
Jonathan Granskog
October 24, 2011 at 6:27 pmNo there are not more keyframes after the second one. I want to modify the second keyframe’s value by typing in a value into a text layer.
Say if I type into the text 100 I want the keyframe to be 100, but I don’t want the first keyframe to be affected by the text, hope you understand.
No they are not linear. I’ve adjusted the speed in the graph editor.
Thanks for your response! 🙂
-
Dan Ebberts
October 24, 2011 at 7:02 pmSomething like this, probably:
if (numKeys > 1){
newV2 = parseInt(thisComp.layer("Text Layer").text.sourceText);
v1 = valueAtTime(key(1).time);
v2 = valueAtTime(key(2).time);
linear(value,v2,v1,newV2,v1);
}else{
value
}
Dan
-
Jonathan Granskog
October 24, 2011 at 8:35 pmThanks a lot man! It works perfectly!
-Jonathan
PS. Love your site.
-
Buddy Giguere
June 27, 2012 at 12:09 amI believe I have a similar inquiry but haven’t got the knowledge of the AE expression language to make it happen.
I am trying to use motion paths with Trapcode Particular. I have a good understanding of particular and its limitations with motion paths but… here’s where Im stuck and I think you might be able to sort me out…
Im exporting nulls for 2 objects from a c4d scene
I want the first keyframe of my motion path to be driven by the position of object #1 and the second key frame of my motion path to driven by the position of object #2
so that over time the start and end positions of the motion path are attached to the nulls of the 3D objects so that particles and be emitted between them and controlled (somewhat) dynamically
Below is my best guess at what I might be shooting for based on your script for Jonathan
newV1 = parseInt(thisComp.layer("Null 1").position);
newV2 = parseInt(thisComp.layer("Null 2").position);
v1 = valueAtTime(key(1).time);
v2 = valueAtTime(key(2).time);
{
v1 = newV1;
v2 = newv2;
}
-
Dan Ebberts
June 27, 2012 at 2:37 amIf I understand what you’re trying to do, I think you’d need to do it with a 3D transformation matrix. It sounds like you need to move, rotate, and scale the motion path so that it fits in between the start and stop points. I don’t know of an easy way to do that and the math involved would be pretty complex.
Dan
-
Buddy Giguere
June 27, 2012 at 2:49 amconceptually it seems feasible, but only if I can reference the position values of the nulls over time to drive the start keyframe and end keyframe values of the motion path so the path will update as time goes on but the keys that build the path stay at frame zero and frame 20 (for example)
buuuuut, i dont know to make that happen, or if its even possible to write within AE
-
Chris Mcgovern
December 6, 2016 at 4:04 pmTrying to apply this expression to a trim path key frame. Used trim path to animate circle from 0 to a number added on a text layer. It is not working. The value typed on text layer applies to both key frames…
-
Dan Ebberts
December 6, 2016 at 7:42 pmTry it this way:
if (numKeys > 1) {
newV2 = parseInt (thisComp.layer("Text Layer").text.sourceText,10);
v1 = valueAtTime (key(1).time);
v2 = valueAtTime (key(2).time);
linear(value,v1,v2,v1, newV2);
}else{
value
}
Dan
-
Mark Aber
September 27, 2018 at 10:03 amhey all,
i was wondering if i could address the first and the second keyframe values with two different text layers at the same time.
best,
mark
Reply to this Discussion! Login or Sign Up