ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

move on event

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Alex Weil
move on event
on Jun 7, 2018 at 3:05:05 pm

is it possible to move an layer if something happens, for example, when my solid is higher than wide, layer 2 should move from p1 to p2 and vice versa. i coded something like that, but its not moving on the event.

w=thisComp.layer("Black Solid 1").width/100*thisComp.layer("Black Solid 1").transform.scale[0];
h=thisComp.layer("Black Solid 1").height/100*thisComp.layer("Black Solid 1").transform.scale[1];

if (h < w) {
} else {

Return to posts index

Kalleheikki Kannisto
Re: move on event
on Jun 8, 2018 at 1:52:22 pm

From the looks of it you're attempting to apply the expression to time remapping. That could be done, I guess, but it would make more sense to apply an expression to the layer position.

What the problem with your current expression is, is that the linear expression is trying to remap the first second of time (0-1) on the timeline to a "range" between two keyframe objects, which basically doesn't make much sense.

Now, since expressions are not aware of time, you need a loop to check backwards (or forwards or both) from the current frame for past and future values, frame by frame.

For instance, in order to find out how many frames ago the value changed from H>W to H
Kalleheikki Kannisto
Senior Graphic Designer

Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 All Rights Reserved