Activity › Forums › Adobe After Effects Expressions › alter or setting keyframes
-
alter or setting keyframes
Posted by Kay Bader on June 20, 2008 at 6:47 pmhi everyone,
does anyone know if it is possible to set keyframes or to change their values using an expression?
i kind of want to do the following:
either: – create keyframes at these times and give them these values
or: go to already existing keyframes and give them these valueswhen i set values triggered by a certain time there is no interpolation and the value remains 0, except for the exact trigger time. also when i set keyframes manually (which would be fine) and tried to change their values, it took no affect, unless on the exact triggertime.
when i use the linear interpolation expression it only seems to execute the last expression.
either way, when i do convert expression to keyframes it sets a keyframe on every single frame. but i need to have the keyframes at the right positions, to play around with the interpolation later on.help would be very very welcome!
thank you
kayKay Bader replied 18 years, 2 months ago 4 Members · 8 Replies -
8 Replies
-
Mike Clasby
June 22, 2008 at 6:22 pm“also when i set keyframes manually (which would be fine) and tried to change their values, it took no affect, unless on the exact triggertime.”
I don’t know why that would be unless they are Hold Keyframes, Right-click the Hold keyframe and change it to something else. Unless I don’t understand what you’re saying.
-
Kay Bader
June 22, 2008 at 9:52 pmthanks for the reply mike,
i dont think my problem has anything to do with hold frames.
i meant, that when i try to override existing keyframes by an expression, it doesnt seem to change the value of the keyframe itself.
i wrote something like:
if (time == key(1).time [10];
if (time == key(2).time [20];
etc…what happened was: the interpolation values remained bound to the old keyframe values and only when that specific condition (if (time ==….) was true, the value was as given in the expression. and when taking a look in the diagram view, it showed the keyframes still having their old values.
i got some basic programming skills, but am completely new to ae expressions, so i dont know if what i am missing the right command words (something like setKey[time,value] would be great) or if it is just not possible to do.
what i need is some way to create keyframes or override allready existing keyframes using an expression.
-
Kevin Camp
June 23, 2008 at 1:04 pmi’m a little confused here… it sounds like what you want is to have key frames interpolate the way key frames normally interpolate within ae… why not just change the values of the key frames by either positioning the time cursor on the key frame and making adjustments or by double clicking the key frame and entering new values…
it would be more work to have to have to enter new values in an expression and have it replace specific values of specific key frames…
what are you trying to accomplish by changing values with the expression? i think there may be an easier way to accomplish what you are looking for.
but if yo needed linear interpolation in you example, something like this should work:
if (time >= key(1).time) linear((time – key(1).time)/ (key(2).time-key(1).time), key(1).value, key(2).value);
if (time >= key(2).time) linear((time – key(2).time) / (key(3).time-key(2).time), key(2).value, key(3).value);Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW -
Kay Bader
June 23, 2008 at 2:03 pmhi kevin,
thanks for your answer. your code creates the correct values as i would need them, but it doesnt really change the keyframes. clicking on them after running the expression still shows the old values. and unfortunatly i need that whole keyframe thing completely working because i have to play around with the interpolation later on. using animation -> keyframe-assistant -> turning expression to keyframes (might not be the correct words, i tried to translate) just puts a keyframe on every frame, so thats still useless too.
to make it a bit clearer why i want an expression to change the values and why i dont want to do it just manually:
i have like 10 different videos with 400-500 keyframes each. the keyframes are always on the same position, but each video has different values for them. i have the values i need to enter in a list, that is generated by a java program i wrote. so it would be very easy to modify that list in a way, that i can simply copy and paste it to the expression and have the values written over the keyframes, if i knew the commands. that would be far easier and timesaving than manually typing them in. -
Kevin Camp
June 23, 2008 at 2:20 pmchange the values for the key frames to the values you need…
so it might look something like this:
if (key(1).time > time) value; //if needed set a start ‘value’
if (time >= key(1).time) linear((time – key(1).time)/ (key(2).time-key(1).time), 10, 20); //change ’10’ or ’20’ to suit needs
if (time >= key(2).time) linear((time – key(2).time) / (key(3).time-key(2).time), 20, 30); //change ’20’ or ’30’ to suit needsKevin Camp
Senior Designer
KCPQ, KMYQ & KRCW -
Kevin Camp
June 23, 2008 at 2:31 pmin addition you could probably get this to work within a loop and to draw your values from an array that you copy and paste…
i may be able to figure that out (i’m no java programmer), but it sounds like you may be able to do this… maybe that’s what you are already planning to do…?
Kevin Camp
Senior Designer
KCPQ, KMYQ & KRCW -
Dan Ebberts
June 23, 2008 at 3:11 pmIt sounds like you need to use a script, not an expression. A script will be able to change the values of the actual keyframes. Not too tough, once you get the hang of it.
Dan
-
Kay Bader
June 23, 2008 at 8:38 pmhey,
that script thing did the trick!
thank you so much, you saved me a lot of work
Reply to this Discussion! Login or Sign Up