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

HELP, Why is this wrong, both should return a numeric value.

Explorer ,
Nov 29, 2023 Nov 29, 2023

transform.zPosition = thisComp.layer("text_02").transform.zPosition + 12;

 

 

 

TOPICS
Expressions
488
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 29, 2023 Nov 29, 2023

It looks OK--where have you applied the expression? Are you getting an error message?

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

If you have applied the expression to a layer that doesn't have position dimensions separated, it would need to be more like this:

z = thisComp.layer("text_02").transform.zPosition + 12;
[value[0],value[1],z]
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 29, 2023 Nov 29, 2023

Same results Error can't return results in numeric value

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

Can you post a screen shot that shows the expression in the timeline and the error message?

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

Adobe After Effects 2024 - I__Family_Little Butt_#1 - After Effects_Happy Holidays_edited.jpg

 My guess I am wrong, I know C##, and Visual Basic to me that should work. So don't laugh

 

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

Actually to me the 1st post should have worked.  

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

You'll get that error if text_02 doesn't have separated dimensions for position. If that's the case, this should work:

 

z = thisComp.layer("text_02").transform.position[2] + 12;
[value[0],value[1],z]

 

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

Maybe I should tell you what I am looking for. I need an expression that moves layers below on the z axis a  # of pixels Hope that makes sense.

 

Thank

Mark

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

If neither layer has dimensions separated, the last one I posted should do the trick.

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

If you just want to move a layer a number of pixels in the z direction, something like this should work:

n = 12;
value + [0,0,n]
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