Activity › Forums › Adobe After Effects Expressions › Looping a mask path
-
Looping a mask path
Posted by Jesse Gibson on March 28, 2013 at 10:09 amI’m trying to loop a mask path to reveal and conceal an illustrator file of a row of arrows in order to make them flash on and off. I’ve keyframed it and just copy/pasted the keyframes but it would be much simpler to use the loop expression but I can’t get it to work.
I have tried using scripts suggested by Dan on this thread: https://forums.creativecow.net/thread/227/20661#22869 but it doesn’t loop my mask.
Any suggestions?
Thanks.
Rotem Lu replied 9 years, 11 months ago 3 Members · 9 Replies -
9 Replies
-
Dan Ebberts
March 28, 2013 at 1:23 pmI just tried the expression and it works for me. Does it do anything at all when you try it?
Dan
-
Jesse Gibson
April 3, 2013 at 1:45 pmHi Dan
I must be doing something wrong as it doesn’t seem to do anything at all. It doesn’t give me an error though so perhaps there is something I’m missing.
I’ve attached a screenshot below which shows the expression and the keyframes as well as the mask path as it is halfway through revealing the arrow layer from AI. At the moment, when the keyframes end the path stops moving.
Thanks
Jesseif (numKeys >1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
seg = Math.floor(delta/span);
t = delta%span;
valueAtTime((seg%2) ? (t1 + t) : (t2 - t));
}else
value -
Dan Ebberts
April 4, 2013 at 1:06 amIt’s hard to tell from what I can see. If you can isolate just that piece of your project and post the .aep, I’ll take a look at it.
Dan
-
Jesse Gibson
April 4, 2013 at 8:53 amThanks Dan – I really appreciate you taking a look at this.
I’ve attached the project and media below with the stock arrows mask expression revealed. I’m trying to use an expression to make the arrows reveal and conceal at a tempo I can easily tweak and then replicate for the second set of arrows (preferably by pick whipping the expression but otherwise just by adding the same frequency/time value).
Let me know if you need anything else.
Cheers
Jesse5772_maskpathpingpongfolder.zip
-
Dan Ebberts
April 4, 2013 at 1:48 pmYou have a bunch of keyframes for that mask that are beyond the out point of the layer (around 12 – 14 seconds). If you delete those it seems to work fine.
Dan
-
Jesse Gibson
April 4, 2013 at 2:56 pmAha – don’t know how I managed to do that. Rookie error.
Thanks very much for sorting me out. Much obliged.
Cheers
Jesse -
Rotem Lu
May 22, 2016 at 7:40 pmHi Dan,
thanks for this post already helped me allot,
wanted to ask if I want the loop to start after few number of keys
how can i modify it ?
thank you
Rotemif (numKeys >1 && time > key(numKeys).time){
t1 = key(1).time;
t2 = key(numKeys).time;
span = t2 - t1;
delta = time - t2;
t = delta%span;
valueAtTime(t1 + t)
}else
value -
Dan Ebberts
May 22, 2016 at 9:32 pmIf you wanted, for example, to start looping frome the 3rd key, you would just change the second line from this:
t1 = key(1).time;
to this:
t1 = key(3).time;
Dan
Reply to this Discussion! Login or Sign Up