ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Expression value to a keyframe

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Vera Steinbeck
Expression value to a keyframe
on Mar 7, 2019 at 12:24:27 pm

hi there!
yesterday i searched for a good way to give my first keyframe a value and my second keyframe another value.

logical (for me) it would be like this:
s = thisComp.layer("control").effect("example")("example");
key(1).value = 0;
key(2).value = s;


but i found a solution in this forum where it was told that i have to go via keytime, like this:
(had to put it to the end of the post)

the second code works fine, buti think, this is far to complicated to solve my problem.
does anybody have a better approach to this?
🐮

max = thisComp.layer("control").effect("example")("example");
min = 0;
t1 = key(1).time;
t2 = key(2).time
if (time&lt;=t1) min;
else if (time>t1 && time<t2) ease(time,t1,t2,min,max);
else max;


Return to posts index

Alex Printz
Re: Expression value to a keyframe
on Mar 7, 2019 at 4:31:33 pm

You cannot push values into keys, only pull. You would do like this:


t1 = key(1).time;
t2 = key(2).time;

v1 = 0;
v2 = thisComp.layer("control").effect("example")("example");

linear(time,t1,t2,v1,v2)


note that you cannot adjust the curves with this; you are only looking at when these keys are set.


If you want to be able to adjust the slope, set the keys to have different property values (e.g, Key 1: 100, key 2:200), and try this:


p1 = key(1).value;
p2 = key(2).value;

v1 = 0;
v2 = thisComp.layer("control").effect("example")("example");

linear(value,p1,p2,v1,v2)


Note this second expression depends on the keys having different input property values and understanding that your property is going to convert the change in property values into a similar change between your two defined values!

Alex Printz
Mograph Designer


Return to posts index

Vera Steinbeck
Re: Expression value to a keyframe
on Mar 11, 2019 at 2:28:14 pm

thank you alex!


Return to posts index

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