Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Animating a ‘Channel’ number, driven by a another object

  • Animating a ‘Channel’ number, driven by a another object

    Posted by Matt Comradski on October 17, 2011 at 5:21 pm

    Greetings,

    I have a fun challenge for you awesome expressions gurus:

    I have a vertical bar, showing Channel numbers (from 0 to 800, showing every 50th Channel like 50, 100, 150, etc.) To its side, there’s a pop-up bubble, showing the larger channel number with its station name. Also, I have a hand icon, simulating channel selection.

    What I’d like to happen:

    When I animate the hand position change up and down to simulate channel scrubbing, I’d like the text inside the pop-up bubble to change appropriately to where we are in the vertical bar. So when the hand moves up and down, the pop-up text dynamically changes to reflect where we are in the vertical channel labels. Makes sense?

    I could do this manually by creating multiple text fields in a pre-comp and manually staggering them after I animate the hand. However, this sounds like a pain and something tells me there’s a great way to use expressions for this.

    Any thoughts? I appreciate any ideas! Much thanks,

    Redpandavfx

    Matt Comradski replied 14 years, 7 months ago 2 Members · 4 Replies
  • 4 Replies
  • Dan Ebberts

    October 17, 2011 at 6:43 pm

    That sounds very do-able with an expression, but the details will depend on how you have things set up. I would guess that you’d define an array of channel names. The expression would calculate the index to the array, based on where the pointer is. You should be able to derive the channel number from the same index. It should be fairly simple–probably harder to describe it than to write it.

    Dan

  • Matt Comradski

    October 17, 2011 at 7:01 pm

    Great, that makes total sense. However, being a mostly-timeline AE user, writing expressions from scratch doesn’t come easy for me 😉

    Would you be able to point me to an existing/similar situation on these forums? I’d love to look at the code and customize it for my project.

    Thanks!

  • Dan Ebberts

    October 17, 2011 at 7:19 pm

    Here’s simple text expression that divides the comp height into five channels and displays the channel number (1-5) and the channel name as layer “Pointer” is moved up and down in the comp:

    pointer = thisComp.layer(“Pointer”).transform.position;
    chanNames = [“NBC”,”CBS”,”ABC”,”FOX”,”PBS”];
    chanSize = thisComp.height/chanNames.length;
    idx = Math.floor((thisComp.height – pointer[1])/chanSize);
    “” + (idx+1) + ” – ” + chanNames[idx]

    Dan

  • Matt Comradski

    October 17, 2011 at 7:51 pm

    That’s great! I really appreciate your help. Sending you a virtual ‘high-five’.

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