Skip to main content
Known Participant
November 26, 2021
Question

Script crashes when applying an expression

  • November 26, 2021
  • 1 reply
  • 149 views

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

This topic has been closed for replies.

1 reply

Known Participant
November 26, 2021

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