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

Script crashes when applying an expression

Explorer ,
Nov 26, 2021 Nov 26, 2021

Hey,

this is the code not working:

 

            anchorBefore = shapeLayer.transform.anchorPoint.value;
            shapeLayer.transform.anchorPoint.expression = "layerBound=thisLayer.sourceRectAtTime(time);\nT=layerBound.top;\nL=layerBound.left;\nW=layerBound.width;\nH=layerBound.height;\n[L+W/2,T+H/2]";
            anchorAfter = shapeLayer.transform.anchorPoint.value;
            shapeLayer.transform.position.expression = "a = "+ anchorBefore +"-"+ anchorAfter +";\n[value[0]-a[0], value[1]-a[1]];";

 

 it crashes at this line of code:

 

            shapeLayer.transform.position.expression = "a = "+ anchorBefore +"-"+ anchorAfter +";\n[value[0]-a[0], value[1]-a[1]];";

 

if I just do something like that it works tho:

            shapeLayer.transform.position.expression = "[1920, 1080]";

 
Thanks in advance,
RedyMotion

TOPICS
Error or problem , How to , Scripting
126
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 26, 2021 Nov 26, 2021
LATEST

Forgot to mention but the variable "a" is defined higher in the code, that's not the problem since if I erase the part after the \n it still doesn't work

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