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

Help to understand expression : toComp(value);

Explorer ,
Nov 28, 2017 Nov 28, 2017

Hi there,

rather for help I am seeking understanding what's going on in the following simple case:

When I add a Point Control effect to the layer. The position of this point is absolute. I add a simple expression to it:

toComp(value);

(It seems, that "toWolrld" behaves just the same.)

After this treatment the Point Control seems to be positioned relatively to the layer which is applied on. So when I move the layer, the point moves with it, but the Point can be moved freely as well.

Would you kindly help me to understand why this works? I thought, that everyhting unparented is child of World. So why after this expression it seems to be child of the layer space itself?

Thank you.

TOPICS
Scripting
22.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

correct answers 1 Correct answer

Community Expert , Nov 28, 2017 Nov 28, 2017

Suppose you create a new 1000x1000 comp and add a new 500x500 solid to it, and add a Point Control to that. The initial value of the Point Control will be [250,250], which will be relative to the upper left corner of the solid, which puts it at the center of the solid (and coincidentally at the center of the comp).

If you now add the toComp(value) expression to the Point Control, it will convert the [250,250] in layer space to comp coordinates, which is the center of the comp, or [500,500]. Since

...
Translate
Community Expert ,
Nov 28, 2017 Nov 28, 2017

>The position of this point is absolute.

The value of the Point Control is relative to the upper left corner of the layer. Does that help?

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
Explorer ,
Nov 28, 2017 Nov 28, 2017

Hi Dan,

thank you for your response. I just don't understand what exactly happens behind that standalone toComp expression. But I don't want to bother you anymore. I would be better to deep dive to the Expression refference.

Take care 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
Community Expert ,
Nov 28, 2017 Nov 28, 2017

Suppose you create a new 1000x1000 comp and add a new 500x500 solid to it, and add a Point Control to that. The initial value of the Point Control will be [250,250], which will be relative to the upper left corner of the solid, which puts it at the center of the solid (and coincidentally at the center of the comp).

If you now add the toComp(value) expression to the Point Control, it will convert the [250,250] in layer space to comp coordinates, which is the center of the comp, or [500,500]. Since the value is always interpreted as being in layer space [500,500] puts the point at the lower right corner of the solid ([750,750] in comp space).

It's a little confusing, but I suppose the good news is that I can't think of a good reason you'd ever do it that way.

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
Advocate ,
Nov 29, 2017 Nov 29, 2017

Apparently, the original experiment was with a shape or text layer. Point controls behave differently for layers with and without a source.

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
Explorer ,
Nov 30, 2017 Nov 30, 2017
LATEST

Thank you UQg,

will try to figure it out.

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
Explorer ,
Nov 30, 2017 Nov 30, 2017

Awesome Dan,

thank you for your explanation effort!

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