Skip to main content
zachary_
Participant
July 24, 2022
Answered

Expression for opposite position?

  • July 24, 2022
  • 1 reply
  • 532 views

Hey there,

 

I'm trying to create a bezier point rig where the left handle (bez-handle-left) mirrors the right handle's (bez-handle-right) position behavior: when right handle moves right, left handle moves left; when right handle moves up, left handle moves down, etc.

 

I scoured the Internet but didn't have much luck. Tried writing a few options myself too but fear I may be overthinking it.

 

Would appreciate some guidance!

 

Thanks

This topic has been closed for replies.
Correct answer zsaaro
//get information
var centerPos = thisComp.layer("center").position; // parent to "point's position
var otherTangentPos = thisComp.layer("outTangent").position; // parent to other tangent's position

// subtract the center from the other tangent to get a relative offset
var relativeOutTangentPos = otherTangentPos - centerPos;

// flip
var flippedRelative = relativeOutTangentPos * -1;

// add back the center point to get the new position
centerPos + flippedRelative

Apply this to one of the tangents, and parent to the center point and the other tangent at the top of the expression.

1 reply

zsaaro
zsaaroCorrect answer
Inspiring
July 24, 2022
//get information
var centerPos = thisComp.layer("center").position; // parent to "point's position
var otherTangentPos = thisComp.layer("outTangent").position; // parent to other tangent's position

// subtract the center from the other tangent to get a relative offset
var relativeOutTangentPos = otherTangentPos - centerPos;

// flip
var flippedRelative = relativeOutTangentPos * -1;

// add back the center point to get the new position
centerPos + flippedRelative

Apply this to one of the tangents, and parent to the center point and the other tangent at the top of the expression.

zachary_
zachary_Author
Participant
July 24, 2022

Incredible, thanks so much! Appreciate the comments on each line too, nice to know how everything works together.