• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

offset corner pin with different x y offset values

Explorer ,
Aug 01, 2017 Aug 01, 2017

Copy link to clipboard

Copied

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]

TOPICS
Expressions

Views

2.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2017 Aug 01, 2017

Copy link to clipboard

Copied

Doing this properly requires very heavy math. I do it for the "expressions instead of keyframes" option of MochaImport+.

It allows to move and even keyframe the corner pin corners freely and still make them move with the track automatically. But it requires some heavy preprocessing of the tracking data inside of MochaImport+ before the tracking data is generated.

See this tutorial to see it in action:

Tutorial Fixing Inaccurate Tracks with MochaImport+ v5.1

So if your corner pin comes from a mocha track, MochaImport+ is a good solution. Otherwise it will be very tricky.

Cheers,

Mathias

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 01, 2017 Aug 01, 2017

Copy link to clipboard

Copied

Well the reason your current code referenced above doesn't work is because you have "+ *" on lines 23 & 24, these should only be one or the other.

If it's a static amount of offset, why not just use this:

value + [20, 50]

?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 02, 2017 Aug 02, 2017

Copy link to clipboard

Copied

If I understood it correctly, the offset should not be static in comp space, but adjust according to the movement of the corner pin. Like a static offset in the space defined by the corner pin surface.

Mathias Möhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 04, 2017 Aug 04, 2017

Copy link to clipboard

Copied

LATEST

Right Mathias Moehl That's what I need! The corner pin points change position over time, so the distance between them. The offset should change it's relative distance too.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines