Activity › Forums › Adobe After Effects Expressions › game of life
-
game of life
Posted by Adrian Germain on November 10, 2007 at 5:15 pmHi all. I’m trying to translate a cellular automaton script to an after effects animation and i have a question. My idea is to put opacity switchers to each cell layer and to manage them from a null layer. Could i do this with indexing? Thanks.
Dan Ebberts replied 18 years, 6 months ago 2 Members · 4 Replies -
4 Replies
-
Dan Ebberts
November 10, 2007 at 6:08 pmI think I’d do the life calculation in a text layer. You can play around with the idea by applying this test expression to a text layer:
s = “”
numDigits = 10;
for (i = 1; i <= numDigits; i++){ s += Math.round(random()); if (i < numDigits) s += ","; } s Then apply this opacity expression to 10 solid layers (make sure they're above the text layer in the layer stack): s = thisComp.layer("control layer").text.sourceText.split(","); if(parseInt(s[index-1]))100 else 0 That should give you the idea. Dan -
Adrian Germain
November 12, 2007 at 9:10 pmThanks a lot Dan.
Just one thing.
When you say:
if(parseInt(s[index-1]))
which is the condition? -
Adrian Germain
November 13, 2007 at 3:42 amI’ve made a 3X3 cell like this:
123
456
789On the text layer i used:
f=timeToFrames(t = time + thisComp.displayStartTime, fps = 1 / thisComp.frameDuration, isDuration = false);
b=f.toString(2);
b.split(“”,10);It looks like a time binary counter but something is wrong.
binary scheme not in sync with frames number. -
Dan Ebberts
November 13, 2007 at 2:40 pmYou know, you don’t actually need the commas. I modified your binary counter to this ten-digit counter:
f=timeToFrames( time);
(f+1024).toString(2).substr(1);Then used this opacity expression:
thisComp.layer(“control”).text.sourceText.substr(-index,1)*100
Dan
Reply to this Discussion! Login or Sign Up