Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Switching back and forth between 2 layers

  • Switching back and forth between 2 layers

    Posted by Dean Morgan on November 19, 2013 at 10:09 am

    I am animating a mouse cursor that has two different states, one being the arrow and the other being a hand.

    I am currently doing this by manually keyframing the opacity so that only one is showing at a time.

    I have never really dealt with expressions in any real sense other than using pre-written ones from users on here and other sites but I have a general understanding of how things should probably work.

    I have looked through various sites so far for some references on how this may be done but cannot seem to find anything that would help in writing a script that does something like this.

    I had an idea that setting up a slider controller to a null object, and having that control the opacity of the layers in the following way…

    Layer 1 (Arrow) would be 100 minus the Slider Controller Value
    Layer 2 (Hand) would be the Slider Controller Value

    In my head the method should be this simple, but I can’t seem to find the resources online for where to start writing this properly. I can find much more advanced things and have been having a play with some of those, but I can’t find anything that would help with this.

    The problem I am having is inverting the slider value, or adding the maths too the expression. I managed to link up both layers to the slider but they would only return the same result.

    Could anyone please help me out with this, and if possible hook me up with some good websites, books or videos about expressions and scripting for beginners. I used to work with JavaScript about 10 years back and I do remember some of the basic ideas behind it, but there are massive gaps in my memory, and with it tied into after effects I think it’s best I try and learn from the ground up.

    Cheers,

    Dean

    Dan Ebberts replied 12 years, 9 months ago 2 Members · 2 Replies
  • 2 Replies
  • Dean Morgan

    November 19, 2013 at 3:14 pm

    I actually figured this out just now after a bit more reading…

    On one layer I used the following expression

    100-thisComp.layer("Transparency Switch").effect("Slider Control")("Slider")

    and on the other I used the simple

    thisComp.layer("Transparency Switch").effect("Slider Control")("Slider")

    I knew it should of been dead straight forward but I couldn’t find any basic help on expressions, so my second question still stands.

    Can anyone hook me up with some dead simple guides for working with expressions?

  • Dan Ebberts

    November 19, 2013 at 3:27 pm

    just add 100- in front of the slider reference, like this:

    100-thisComp.layer(“control”).effect(“Slider Control”)(“Slider”)

    Dan

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