Expression "this" or "current value"

Say I have keyframe data in the X position channel of an axis node. Now I want to add values from the X position channel of a second axis node. This seems like something expressions should be able to do but I just don’t know the syntax for it.

There is a link function that can link and add values easily enough, but this replaces the data with the linked data plus whatever value. I want to add to the existing value. So, something like:

this.position.x + axis2.position.x

Where the first part is referencing the existing data and then adding the axis2 data to it.

Is there a way to do what I want without having to duplicate the axis with the existing data and then make an expression to add that together with the second axis data to be applied to a third axis to finally make it work?

1 Like

I don’t think Flame expressions can do that.

After Effects has a ‘value’ variable that does exactly this, but I’m not aware of an equivalent in Flame.

There is an eval() function that returns the value of a channel at a given frame, but I’ve never used that to get the channel I’m currently in - but maybe that’d work?

You don’t need three different nodes though; you could put one value in pos.x and a different value in centre.x and add those two together in a second axis node.

-Ted

1 Like

Thanks for the quick reply.

Dang. I was really hoping it was just a simple expression value I wasn’t aware of. I tried the eval function referencing itself but I get an expression loop error.

What I’m ultimately trying to do is be able to correct drift in a perspective grid track. I figured if I could just use the tracking data that is there and give it a nudge with another axis through expressions that would do the trick.

if you are just wanting to add or subtract a constant value to an animation curve you can just translate y the whole curve!

1 Like

Unfortunately no. You’d have to create another perspective grid and link it to the original one with expressions on inividual channels. Then modify the drifting channel by adding the the value from your corrective data.

Something like:

modified.upperleft.x = original.upperleft.x + corrective.position.x

1 Like

This is exactly what I’ve done in the past. But it’s a little more friction than what I’d like so I figured I’d ask in case I was missing something with my limited expression powers. :slight_smile:

It’s hard to adjust a curve smoothly to account for drift that changes over a track. In this instance I have a 120 frame shot. The first 85 frames or so tracked well but then the track begins to drift due to the nature of the shot (goes out of focus while coming at camera). From a distance, it seems ok but when you get into the nitty gritty of things and try to make something stick you can see the drift happen. I just want another control to adjust what is already there for the frames that need it, which drift further out of alignment toward the last frame. Even with setting up the expression, I think it will be faster to adjust - and likely smoother results - than trying to modify the drifting keyframes.

Vote early, vote often :smiley:
Flame Feedback: Self-referencing expressions to pull original keyframed values

2 Likes

Why don’t you create a new axis with the sum of the two you would like to add?
For that matter, you could put the second axis between the first and the thing you’re wanting to move. No expression at all!
Maybe I’m missing something…

I don’t think I explained what I was trying to do very well from the start. Too abstract now that I read it again.

This was all in service of correcting a drifting perspective grid track. So I want post-track nudging of the track data for each corner. Screenshot attached of what I ended up doing, which isn’t all that bad to setup but should be easier if expressions supported something like .this or .current_value for self referencing.

So, in this setup, I attach the shape I want to constrain the track within to the perspective grid in the teal compass in the schematic. Do the tracking. Then, I attach the shape to the bottom perspective grid that is driven by the first perspective grid track plus whatever x/y nudging I do in the axis nodes in the teal compass. As long as I get a halfway decent track initially, it’s really fast to add a few keyframes to whatever corners drift using the axis nodes.

1 Like