ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression to Control a Single Keyframe's value

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jonathan Granskog
Expression to Control a Single Keyframe's value
on Oct 24, 2011 at 11:40:11 am

I 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!


Return to posts index

Dan Ebberts
Re: Expression to Control a Single Keyframe's value
on Oct 24, 2011 at 4:54:38 pm

Do 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



Return to posts index

Jonathan Granskog
Re: Expression to Control a Single Keyframe's value
on Oct 24, 2011 at 6:27:26 pm

No 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! :)


Return to posts index


Dan Ebberts
Re: Expression to Control a Single Keyframe's value
on Oct 24, 2011 at 7:02:47 pm

Something 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



Return to posts index

Jonathan Granskog
Re: Expression to Control a Single Keyframe's value
on Oct 24, 2011 at 8:35:56 pm

Thanks a lot man! It works perfectly!

-Jonathan

PS. Love your site.


Return to posts index

Buddy Giguere
Re: Expression to Control a Single Keyframe's value
on Jun 27, 2012 at 12:09:38 am

I 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;
}


Return to posts index


Dan Ebberts
Re: Expression to Control a Single Keyframe's value
on Jun 27, 2012 at 2:37:41 am

If 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



Return to posts index

Buddy Giguere
Re: Expression to Control a Single Keyframe's value
on Jun 27, 2012 at 2:49:24 am

conceptually 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


Return to posts index

Chris McGovern
Re: Expression to Control a Single Keyframe's value
on Dec 6, 2016 at 4:04:11 pm

Trying 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...


Return to posts index


Dan Ebberts
Re: Expression to Control a Single Keyframe's value
on Dec 6, 2016 at 7:42:17 pm

Try 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



Return to posts index

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