-
Java While Loop in AE CS4
I tend to make things difficult on myself when creating expressions so here’s what I got and correct if I’m just failing.
I’m trying to change the random seed of a Rough Edges every 5 frames. Rather than go every 5 frames and changing the value, I’m trying to write an expression. I’ve been testing the expression a Numbers effect so I can have a text box that shows me what’s going on. Well I know you can use some Java in AE so I went, “Hey! How about a while loop?” Well… I whipped up this expression and for whatever reason it keeps changing every frame.
So… what’s not working here?
if(time = 0){
x = random()*10;
v = Math.round(x);
}else{
i=2;
w=valueAtTime(time-1);
while(i<=4){
x=valueAtTime(time-i);
if(x=w){
fiveframes = false;
i++;
}else{
fiveframes = true;
i = 5;
}
}
if(fiveframes = true){
x=random()*10;
v=Math.round(x);
}else{
v=w;
}
}
v;You Don’t Say! Media
Director – Producer – EditorMacBook Pro 2009
Mac OS X 10.6.8
2.8 Ghz Intel Core 2 Duo
4 GB 1067 MHz DDR3
NVIDIA GeForce 9400M (256MB)
NVIDIA GeForce 9600M GT (512MB)
Apple Final Cut Studio 3
Adobe Production Suite CS4