After some further investigation I gathered some more Info about my Issue that might be interesting for others having the same problem:
Can I set/change a keyframe with expressions:
No, but you can read their values into variables and then change the variables which in the end change the property. It´s important to understand this seamingly irritating difference to build working expressions. Keyframes and all their “values” are read-only to begin with. Any expression can only overwrite/modify the values they take from them as they bring those modified values back into the property, not actually change the keyframe you see in the timeline. It’s inherent in how AE evaluates property streams:
Property base value –> Keyframe value –> Expression result (Including expression manuipulating effects like expression slider controls) –> Changed property value.
So the keyframe value can only be the base for changing the property value with expressions. Think of it as: You have to first convert the key().time or key().value or key.index into an expression variable. For example mytimevariable = key().time Then handle the expression variable as the “editable keyframe” and forget the actual keyframe on the layer in the timeline, as you can NOT change its value or its position on the timeline (time) or add new keyframes with expressions. Your new variable IS your keyframe from there on and that is editable and can be returned to the property as a value.
Puh. After I wrapped my head around this a lot of things made more sense.
In my current case I concluded I did not need the time remapping keyframe values at all but only the “time” property coming from the comps timeline progress and using that to manipulate the time value of the layer which I could adress through the time remap property:
invar = framesToTime(parseInt(thisComp.layer(“MainVideoInPoint”).text.sourceText));
outvar = framesToTime(parseInt(thisComp.layer(“MainVideoOutPoint”).text.sourceText));
linear(time, 0, thisComp.duration – framesToTime(1), invar, outvar);
I am using two textlayers to set the in and out boundries of the part of the original clip that get´s shown within my comp.
Interesting side note: thisComp.duration does not equal the time of the last frame of the comp. You have to subtract a frame. Which probably has something to do with the Comp starting at frame 0.
So thanks a lot! Problem solved!
HAYWOOD Digital Studio
http://www.haywood.de