FORUMS: list search recent posts

randomly loop keyframes - change to color

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
wouter sel
randomly loop keyframes - change to color
on Sep 6, 2012 at 8:43:29 am

Hi, i want to randomly loop keyframes using an expression.
I've made 4 hold keyframes in the Change to Color effect of a layer;
so that's 4 specific colors (not random) i want to cycle in a random order over time.

I also want to be able to edit the speed of the color flickering.

Pre-comping the layer for time-remapping is not really an option,
since i have 100+ layers in the comp, and they all should flicker randomly between those 4 colors.


Return to posts index

Dan Ebberts
Re: randomly loop keyframes - change to color
on Sep 6, 2012 at 1:20:43 pm

Something like this should pick a random keyframe value every half second:


period = .5;
seed = Math.floor((time-inPoint)/period);
seedRandom(seed,true);
if (numKeys > 0){
n = Math.floor(random(numKeys))+1;
key(n).value;
}else
value



Dan



Return to posts index

wouter sel
Re: randomly loop keyframes - change to color
on Sep 6, 2012 at 1:31:11 pm

Thanks for the reply Dan, I'll give it a try!

meanwhile I've found this after some digging, and it works great:

posterizeTime(12); // value is in fps
r = Math.ceil(random(0,numKeys));
valueAtTime(key(r).time)


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2018 CreativeCOW.net All Rights Reserved
[TOP]