Rollover expression on opacity

This expression allows you to replicate a rollover function. When object1 passes over object2, object2 changes from 0 to 100 opacity.

EXPRESSIONS
Expression code: 

Obj =XXXXX
ObjectX = Obj.transform.position[0];
ObjectY = Obj.transform.position[1];
Top =effect("UL")("Point")[1];
Bottom = effect("LR")("Point")[1];
Left = effect("UL")("Point")[0];
Right = effect("LR")("Point")[0];
if (ObjectX <= Left || ObjectX >= Right || ObjectY <= Top || ObjectY >= Bottom) 0 else 100;

Step 1: Add 2 point controls (expression controls) to the layer that will be turning on and off via the rollover. Name them UL, and LR. Step 2: Paste the expression into the Opacity channel of the same layer. Step 3: Pickwhip the XXXXX to the layer which will be used to trigger the rollover. Step 4: Use the UL and LR point controls to define the area (upper left and lower right) which will trigger the rollover state.

You may also be interested in