| **offset corner pin with different x y offset values**
on Aug 1, 2017 at 4:09:38 pm |

Hello!

Suppose you have a keyframed corner pin effect. Is there a way to extend a pin point (example: top left corner point) with different offset values for X and Y using expressions?

I tried everything, but I can't get it to work: the extended point doesn't stick with the right proportion over the animation.

This expression is one of the many i applied without any success. It works only if offset X and Y values are equal (ex.

Any suggestion? Thanks.

`// CALCULATE CENTER COORDINATES`

TL = effect("Pin")(1);

TR = effect("Pin")(2);

DL= effect("Pin")(3);

DR = effect("Pin")(4);

var vertices_x = [];

var vertices_y = [];

var min_x = Math.min(TL[0],TR[0],DL[0],DR[0]);

var max_x = Math.max(TL[0],TR[0],DL[0],DR[0]);

var min_y = Math.min(TL[1],TR[1],DL[1],DR[1]);

var max_y = Math.max(TL[1],TR[1],DL[1],DR[1]);

var mid_x = (min_x + max_x) / 2;

var mid_y = (min_y + max_y) / 2;

center = [mid_x,mid_y];

// OFFSET

offset = [20,50];

// TOP LEFT VECTOR

vector = normalize(TL - center);

// CALCULATE NEW TOP LEFT

x = TL[0] + * vector[0] * offset[0];

y = TL[1] + * vector[1] * offset[1];

[x,y]

| **Re: offset corner pin with different x y offset values** on Aug 1, 2017 at 4:18:25 pm |

I'm guessing I don't understand what you're trying to do. Would this work?

offset = [20,50];

value - offset

Dan

| **Re: offset corner pin with different x y offset values** on Aug 1, 2017 at 4:44:30 pm |

Hello Dan!

I'll try to explain. Suppose the corner pin it's not only sliding, but it also rotates and scales over time. I need to calculate the rotation and the scale of the offset values. It's a bit like parenting, i suppose