-
Changing Keyframe Time Through Expressions
Hello, I’m trying to create a template for my team’s video editors working with Premiere Pro.
It’s supposed to be a transition with adjustable speed by keying s, m, or f in Premiere’s Live Text templates feature.
English is not my first language, and I am a rookie with expressions (self-taught to boot) so please bear with me.
The transition has 4 keyframes, 2 in and 2 out. Fast transition will result in -1s for keyframe 2 and +1s for keyframe 3 and the opposite for slow transition. Medium speed will not change the timing of the keyframes. The reason I want to manipulate keyframes instead of using the ease expression is because I want to preserve my speed graph.
So far I came up with this:
//Transition Speed
var mod2 = thisComp.layer("Speed (s/m/f)");
var mod2spd = mod2.text.sourceText;var ti = thisComp.layer ("Transition A");
var tp = ti.transform.position;
var tpk2 = tp.key(2).time;
var tpk3 = tp.key(3).time;if (mod2spd == "s" || mod2spd == "S")
tpk2+1, tpk3-1
else if (mod2spd == "m" || mod2spd == "M")
tpk2, tpk3
else if (mod2spd == "f" || mod2spd == "F")
tpk2-1, tpk3+1
else
tpk2, tpk3valueAtTime
Obviously I received the orange error message but the error message isn’t helping either, it says “Error at line 0 in the property “Position” of layer 3 (‘Transition A’) in comp ‘Helper Transition’. Object of type Function found where a Number, Array, or Property is needed., an expression was disabled as a result of an error.”Can someone explain my mistake and how do I achieve what I wanted to make?
Thank you.