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

Attaching layers to edges of other layers

Enthusiast ,
Jun 29, 2010 Jun 29, 2010

Copy link to clipboard

Copied

Here's a mockup of I'd like to do:

(click to see animated GIF)

Sizing-Frame-2_3.gif

The smaller square layer is "attached" to a corner of the larger solid. As the larger solid moves, the square maintains its relative position. It also rotates along with it.  However, when the larger solid is scaled, the square remains at the same size.

TOPICS
Expressions

Views

1.0K

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 , Jun 30, 2010 Jun 30, 2010

Try this:

s = parent.transform.scale/100;
[value[0]/s[0],value[1]/s[1]]

Dan

Votes

Translate

Translate
Community Expert ,
Jun 29, 2010 Jun 29, 2010

Copy link to clipboard

Copied

You could just parent the smaller square to the larger and use an expression like this to counteract the scale of the parent:

s = parent.transform.scale[0]/100;
value/s

Dan

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
Enthusiast ,
Jun 30, 2010 Jun 30, 2010

Copy link to clipboard

Copied

I will try that.  Thank you!

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
Enthusiast ,
Jun 30, 2010 Jun 30, 2010

Copy link to clipboard

Copied

That works great, Rick.  But it breaks if I non-proportionally scale my parent.

Would this work?

sx = parent.transform.scale[0]/100

sy = parent.transform.scale[1]/100

[value/sx,value/sy]

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 ,
Jun 30, 2010 Jun 30, 2010

Copy link to clipboard

Copied

Try this:

s = parent.transform.scale/100;
[value[0]/s[0],value[1]/s[1]]

Dan

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
Enthusiast ,
Jul 09, 2010 Jul 09, 2010

Copy link to clipboard

Copied

LATEST

Thanks Dan! Worked like a charm!

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