Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Opacity to 100% on framenumber equals layer name?

  • Opacity to 100% on framenumber equals layer name?

    Posted by Kristian Boruff on April 10, 2011 at 7:32 pm

    Hello,

    I’m working on a comp where I have to do a frame by frame correction in Photoshop.
    I’ve been naming the layers based off of the frame numbers as I’m going along.
    I’m hoping there is a way to make the imported layer appear and disappear based off the current frame number.
    For example, layer 80 is the corrected image of frame 80, so when After Effects reaches frame 80 the layer’s opacity is set to 100% and then reverts to 0% as soon as the frame is 81.

    So far I have the following in frame 80’s opacity layer:
    x=timeToFrames(time, 1 / thisComp.frameDuration, false);
    if (x=thisLayer.name) 100 else 0

    This is returning 100% all the time and I don’t know why. Since the frame number probably can’t be equal to a string variable, shouldn’t it always be 0%, or fail?

    Thanks!

    x=timeToFrames(time, 1 / thisComp.frameDuration, false);
    if (x=thisLayer.name) 100 else 0

    Dan Ebberts replied 15 years, 4 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    April 10, 2011 at 10:00 pm

    Try changing your “=” to “==”

    Dan

  • Dan Ebberts

    April 10, 2011 at 10:32 pm

    I see another problem. Try this as the second line:

    if (x==parseInt(thisLayer.name,10)) 100 else 0

    Dan

  • Kristian Boruff

    April 11, 2011 at 12:18 am

    Ah okay, so it’s like in Python. Is the ParseInt to add the leading zeros for the 00001 format frame numbers?
    Thanks for helping on this!

  • Dan Ebberts

    April 11, 2011 at 12:40 am

    No, parseInt()converts the text of the layer name to a number.

    Dan

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