Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Aftereffects expression to rotate a layer 180º based on the luminance of another layer working but not quite.

  • Aftereffects expression to rotate a layer 180º based on the luminance of another layer working but not quite.

    Posted by Martin Buchhorn on February 18, 2012 at 7:23 am

    I was hopping for a little help with this expression, forgive me but I’m very new to writing expressions and have modified one I found online to get to this point.
    My aim is to create a custom transition using triangles rather than the rectangles of Card Wipe that ships with AFX. The WHITE WIPE pre comp layer will control the rate of the transition and the number of triangles rotating at one time with a soft edged wipe.

    The expression is applied to the Y Rotation of the layer I wish to flip.

    amp = 180;
    sampleSize = [100,100];
    L = thisComp.layer(“WHITE WIPE”);
    P = L.fromComp(toComp(anchorPoint));
    lum = rgbToHsl(L.sampleImage(P,sampleSize/2,true,time))[2];
    (amp*lum)

    Right now it flips the layer but from 0 to 180º in just one frame as soon as the wipe layer moves off 100% black rather than the gradual rotation I’m after.
    Any help would be much appreciated.

    Andrew Somers replied 14 years, 6 months ago 2 Members · 1 Reply
  • 1 Reply
  • Andrew Somers

    February 20, 2012 at 9:12 pm

    This probably should be in the “Expression” forum.

    I just pasted your code into the Y rotation of a layer, I I think it is working as you would want it to.

    How are you controlling the white level? I’m using levels…

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy