Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Forums Adobe After Effects Expressions Change Color In layer order every 5 frames

  • Change Color In layer order every 5 frames

  • josh boyd

    March 17, 2020 at 5:32 pm

    I have a composition with close to 200 layers, and i want to make it where the color changes from a dark blue to a red. I was looking for an expression i could just copy and paste to all layers.

    I dont know expressions super well, but basically an expression that gets the layer number and multiplies it by 5 to get the frame it is supposed to change at. I want the transition from the color to color to be about 10 seconds. Is this possible? Or is this too much?

    Thank you so much!

  • Andrei Popa

    March 17, 2020 at 6:17 pm

    This should work.
    Replace the hex numbers between quotes with the hex number of your colors.

    linear(time,index*5,index*5+10,hexToRgb("FF0000"),hexToRgb("000000"))

    Andrei
    My Envato portfolio.

  • josh boyd

    March 17, 2020 at 6:23 pm

    This is what I am sort of looking for, except could it be every the 5 sec be every fifth frame and the duration be 10 frames instead of 10 sec.

    Thank you so much!

  • josh boyd

    March 17, 2020 at 6:32 pm

    I think i figured it out, as i am slowly learning this expression language.

    I just change time to timeToFrames(time)?

  • Andrei Popa

    March 17, 2020 at 7:17 pm

    Close!

    But this is the expression you need.

    linear(time,framesToTime(index*5),framesToTime(index*5+10),hexToRgb("FF0000"),hexToRgb("000000"))

    Every expression in After Effects calculates time in number, not frames. The 15th frame in a 30 fps composition is a 0.5 time. For example framesToTime(15) turns the number 15 into a 0.5 in a 30 fps composition. That is exactly the kind of transformation you need.

    Andrei
    My Envato portfolio.

  • josh boyd

    March 17, 2020 at 9:19 pm

    Thank Andrei, I love when people explain it. It helps me understand how it is happening so i can learn more.

Viewing 1 - 6 of 6 posts

Log in to reply.

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