Skip to main content
Inspiring
November 16, 2022
Answered

Expression to lock a value to a first keyframe value?

  • November 16, 2022
  • 1 reply
  • 476 views

Greetings,

I have tracked out a clip using Mocha Pro and I want to use the Mocha Center Value, but I want my starting value to be 0,0, so I set up an expression that uses the Center value keyframes, but just subracts the first value (like shown below 780.9, 620.1). I have many sections where I'm doing this and I was wondering if there is a script I could write, so that I could replace the manual inputting of the starting Center value with something that just LOCKS onto the first keyframe value of the effect("Mocha Pro")("Center") keyframes? Thanks for your help 🙂

 

For reference:

Keyframe 1 of Center = 780.9,620.1

 

My current expression

effect("Mocha Pro")("Center")-[780.9,620.1]

This topic has been closed for replies.
Correct answer Dan Ebberts

I don't have Mocha Pro, so I'm just guessing it would be:

e = effect("Mocha Pro")("Center");
e.value - e.key(1).value;

1 reply

Dan Ebberts
Community Expert
Dan EbbertsCommunity ExpertCorrect answer
Community Expert
November 16, 2022

I don't have Mocha Pro, so I'm just guessing it would be:

e = effect("Mocha Pro")("Center");
e.value - e.key(1).value;
persystAuthor
Inspiring
November 16, 2022

Ah great, thanks Dan it worked! 

I see how the "e" variable is working here to shorten the text. I inputted it the long way first just to try it out.

effect("Mocha Pro")("Center")-effect("Mocha Pro")("Center").key(1).value