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

Attaching layers to edges of other layers

Enthusiast ,
Jun 29, 2010 Jun 29, 2010

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
1.3K
Translate
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

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

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

Translate
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

I will try that.  Thank you!

Translate
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

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]

Translate
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

Try this:

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

Dan

Translate
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
LATEST

Thanks Dan! Worked like a charm!

Translate
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