-
Simulate Pan-Behind Tool
I’m posting this again because I wasn’t getting any help on my last post on the subject, but I really feel this would be a very helpful expression not just to me, but to many others. And it should be a nice challenge for you math guys (calling Dan Ebberts).
I’m trying to simulate the function of the pan-behind tool so that I can animate the movement of a layer’s anchor point without the layer moving. If you use the pan-behind tool on the anchor point of a layer, you’ll see that what it’s actually doing is moving the layer in the opposite direction. This is all well and good until you attempt to keyframe the anchor point’s movement, at which time it no longer works as expected.
If I could come up with an expression to add to the Position of a layer that moves it inversely to the movement of the anchor point, I could do this.
What I did was added a Null Object to the scene and linked its Position property to the Anchor Point property using the pickwhip. I then added this code to the Position property of the layer:
tempX=thisComp.layer(“Null 1”).transform.position[0];
tempY=thisComp.layer(“Null 1”).transform.position[1];
x=tempX+571; //571 is the width of the comp – the width of the layer
y=tempY+637.5; //637.5 is the height of comp – the height of the layer
[x,y]It works perfectly until I rotate the layer, at which point when the Anchor Point is moved, the layer also shifts position. If someone who is good at math can figure out what needs to be done so that rotation is taken into account, this expression would very helpful to me and I imagine a great many other people.
THANKS!