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

Cancelling parent scaling in child

Guest
Jul 12, 2011 Jul 12, 2011

Any tips on getting a child to cancel out the scaling of its parent?  The parent in this case scales X and Y differently, And I can't figure out how to anti-scale the child so it doesn't stretch.

On the child, I'm trying to do an inverse proportion. (But this obviously applies it to both X and Y the same). Not sure sure how to call specific X or Y scale.

s = thisComp.layer("Parent").transform.scale;

[(1/s)]

Is giving me a scalar error (?)

TOPICS
Expressions
3.1K
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 ,
Jul 12, 2011 Jul 12, 2011

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 26, 2011 Jul 26, 2011

As always... brilliant! Thank you very much!

I keep thinking variables can only store one number, not a set of numbers that can be selectively plucked out of a series.  Would the programmy term be plucking an element out of a matrix (or is it array?)

If it was a 3D layer, it would be [value[0]/s[0],value[1]/s[1],value[2]/s[2]], right?

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 ,
Jul 26, 2011 Jul 26, 2011

Yes, arrays, and yes on the 3D version.

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 ,
Nov 28, 2014 Nov 28, 2014

Hey Dan!

I trotted this expression out again, but now I'm getting an error in CC 2014. Any ideas? My parent is scaled non-proportionally 100%,75%

Here's what the child has in the scale parameter:

s = parent.transform.scale/100;

[value[0]/s[0],value[1]/s[1]]

Screenshot-2014-11-28-15.41.12.gif

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 ,
Nov 28, 2014 Nov 28, 2014

I just tried it in CC 2014 with the parent at 100,75 and it works fine for me. I'm not sure what the problem could be.

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 ,
Nov 28, 2014 Nov 28, 2014

I'm using shape layers for both parent and child. Would that be an issue?

(And thanks for the super quick reply!)

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 ,
Nov 28, 2014 Nov 28, 2014

Using shape layers doesn't appear to make a difference.

>Also, where is Line 0??

Maybe you've managed to confuse the expression engine.

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 ,
Nov 28, 2014 Nov 28, 2014
LATEST

Aha! I figured it out. I was animating the parent from 0% to 75%. The 0 was causing a div by zero error. I changed it to .001% and the expression works now!

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 ,
Nov 28, 2014 Nov 28, 2014

Also, where is Line 0??

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