Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions offsetting mask shape like using loopOut(“offset”)

  • offsetting mask shape like using loopOut(“offset”)

    Posted by Raymond Tan on July 17, 2009 at 3:22 pm

    Hi everyone,

    I have a difficult challenge. How can we offset a mask shape by using the same technique we use in loopOut(“offset”).

    for example we have a small circle mask as the 1st keyframe, after 2 sec. we add the 2nd keyframe and resize it to a bigger circle, and then add the technique that will let the circle grow continuosly without adding more keyframes.

    I’ve read that we can’t use expressions on mask shapes.
    Any help on this matter is very much appreciated.

    best regards

    raymond

    Viktor Aleksandrovsky replied 1 month, 4 weeks ago 6 Members · 14 Replies
  • 14 Replies
  • Dan Ebberts

    July 17, 2009 at 3:59 pm

    You read correctly. How about using a circular layer as a track matte and scaling the layer?

    Dan

  • Raymond Tan

    July 18, 2009 at 6:54 pm

    Thank. However I’m trying to figure out the mask path to grow continuously without using the scale property.

    because this mask path will serve as a text path in which I will activate the “per-character 3d text” and the camera…

    So as the circular text path grows towards the camera, you can see the background texts getting smaller.

    If I use the scale property of this layer, the background text that suppose to gets smaller in relation to the camera doesn’t seem right.

    I can always do the old fashion way of adding more keyframes to continuously grow the circular path, but if there’s a better technique, it would be cool.

  • Dan Ebberts

    July 18, 2009 at 7:56 pm

    Ah, I see. While there aren’t a lot of things you can do expression-wise with paths, there are a couple of things that work. I don’t know if either help you much, but it’s a possibility. One thing that works is valueAtTime(). So you could keyframe the mask going from its minimum size to its maximum size linearly (only 2 keyframes) over a short period (say 4 seconds). Then you could control the size of the mask at any given time with a slider control and this expression applied to the mask path:

    control = effect(“Slider Control”)(“Slider”);
    t = key(numKeys).time;
    mask(“Mask 1”).maskPath.valueAtTime(t*control/100)

    The other thing you can do is use an expression to link one mask path to another. They only way I can see that being of use to you is if you needed a master control for multiple paths. You could use the valueAtTime() method for one mask and then tie all the others to that one.

    OK – I’m out of ideas.

    Dan

  • Raymond Tan

    July 19, 2009 at 7:01 am

    Thank you very very much, Dan…
    You have helped many clueless ae artist like myself when it comes to scripting and expression.

    I’m very excited to try this out this tuesday at work. This proj uses a lot of complicated keyframing that it drives me crazy just offsetting some text properties whenever a client wants some changes.

    I’ll keep you posted about it.

  • Chris Montel

    August 17, 2012 at 6:02 pm

    Hi everyone, just a complementary message to say that, yes, Mr Ebbert’s advice does work, and for those like me who need more details, it goes basically like this :

    You have already two keyframes changing the shape of a mask.

    -paste Dan’s expression as formulated above in the mask path field.

    The slider control can either be applied to the same layer as the mask path, or on a separate layer (I chose a null) if you have several. Dan’s expression to be applied to the mask path(s) becomes in this second case :

    control = thisComp.layer(“Nul 1”).effect(“Slider Control”)(“Curseur”);
    t = key(numKeys).time;
    mask(“Mask 1”).maskPath.valueAtTime(t*control/100)

    Apply the slider control and write the following expression :

    loopOut()

    in its slider control field. Create three keyframes, one as 0, the second as 100 (both share your two mask path’s keyframes), and the third 0, and you’re good.

    (note) for my particular purpose I was able to write 0 and 1 instead of 0 and 100, by deleting the “/100” in Dan’s expression, but maybe that percentage has an advantage I am not aware of !

    thanks again, this advice saved me a good deal…

  • Navarro Parker

    December 31, 2012 at 10:05 pm

    Is there a way to write this using a keyframe index number instead of it being time-based?

    So the slider only has to go between values of 1~2 (or what number of keyframes there are) instead of mentally calculating AE’s weird .time value?

  • Dan Ebberts

    December 31, 2012 at 10:54 pm

    That one might look like this:


    if (numKeys > 1 && time > key(numKeys).time){
    s = effect("Slider Control")("Slider");
    t1 = key(1).time;
    t2 = key(numKeys).time;
    t = linear(s,1,numKeys,t1,t2);
    valueAtTime(t1 + t);
    }else
    value

    Dan

  • Navarro Parker

    January 1, 2013 at 12:33 am

    Weird, the slider doesn’t seem to control anything.

    No matter though, your other expression does what I need:

    https://forums.creativecow.net/thread/227/20661#22871

    Thank you!!

  • Dan Ebberts

    January 1, 2013 at 12:53 am

    It does have a pretty small range (between 1 and the number of keyframes).

    Dan

  • David Cabestany

    January 10, 2014 at 9:57 pm

    When I added the loopOut(“cycle”) expression to the slider it doesn’t do anything. The keyframes work fine, but as soon as they should start looping they don’t.

Page 1 of 2

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