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

the position of the corner markers relative to the dimensions of the rectangle

Community Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

Hello. the question arose, which expression should be used so that when changing the size of the rectangle, the position of the markers on its corners was changed.
Screenshot 2023-11-29 125737.png
I used an expression based on the scale

try{
s = scale [0]/100;
L = thisLayer;
while (L.hasParent){
s *= L.parent.scale[0]/100;
L = L.parent;
}
w = value;
w/s
}catch(e){
value;
};


but it doesn't work for me, because the thickness of the stroke and the size of the markers change during non-proportional scaling. so I decided that changing the position of the markers relative to the size of the rectangle would solve this problem, but I don't know what expression to use for this. I will be grateful for your help)
in the attached video showed how it works based on scale

TOPICS
Expressions , How to , Scripting

Views

206

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

correct answers 1 Correct answer

Community Expert , Nov 29, 2023 Nov 29, 2023

I would use a Parametric Rectangle for the outline, then tie the position of four small corner markers created from identical little rectangles to the four corners of the big rectangle by expressions applied to their CorerBox/Transform Corner Box/Anchor Point property like this:

//Top Left Corner
ref = content("Master Rectangle").content("Rectangle Path 1").size/2;
[ref[0], ref[1]];

//Bottom Left Corner
ref = content("Master Rectangle").content("Rectangle Path 1").size/2;
[ref[0], -ref[1]];

//
...

Votes

Translate

Translate
Community Expert ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

I would use a Parametric Rectangle for the outline, then tie the position of four small corner markers created from identical little rectangles to the four corners of the big rectangle by expressions applied to their CorerBox/Transform Corner Box/Anchor Point property like this:

//Top Left Corner
ref = content("Master Rectangle").content("Rectangle Path 1").size/2;
[ref[0], ref[1]];

//Bottom Left Corner
ref = content("Master Rectangle").content("Rectangle Path 1").size/2;
[ref[0], -ref[1]];

// Bottom Right Corner
ref = content("Master Rectangle").content("Rectangle Path 1").size/2;
[-ref[0], -ref[1]];

// Top Right Corner
ref = content("Master Rectangle").content("Rectangle Path 1").size/2;
[-ref[0], ref[1]]

Then, all you have to do is adjust the size of the Master Rectangle, and the corner markers will all follow.

cornerMarker.gif

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 Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

thank you very much, everything worked👍👍👍

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 Beginner ,
Nov 29, 2023 Nov 29, 2023

Copy link to clipboard

Copied

LATEST

at first it did not work, but then I changed the order and method of creating rectangles and everything became as it should be

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