Here's the situation: I'm not new to After Effects. I've been using it for a while and I could say I'm an intermediate user. My knowledge is limited to everything but expressions.
So, I have a white solid and a red solid. As the white solid increases width (scale), I want it to push the red solid. I'm not a newbie into programming, however, I'm either an advanced user. My guess on how to do it is the following one: get white's solid left and width properties from anchor point and add them to the X position of the red solid (red.xPosition = whiteWidth + whiteAnchorLeft
). Here's the actual code of my evil creation:
var white = thisComp.layer("white");
var whiteAnchorLeft = white.sourceRectAtTime(time-white.inPoint,true).left
var whiteWidth = white.sourceRectAtTime(time-white.inPoint,true).width
//[whiteAnchorLeft,whiteWidth]
transform.xPosition = whiteWidth + whiteAnchorLeft
This expression is inside of red > transform > x dimension
.
When I try to make this work, I get 1920 as X and it doesn't move. What am I doing wrong? Thanks in advance!
Note: [whiteAnchorLeft,whiteWidth]
is commented because After Effects is such an amazing software and it throws an error saying this "method is undefined" (???) althoug I've seen tutorials writing this down in the code.
;
s. You need semicolons after all but your first line, that's where that error comes from.transform.xPosition = someValue
you just putsomeValue
as the last line of the expression (apart from the fact thattransform.xPosition
isn't a thing, unless it's a variable that you've created).