Tutorial 190: Cicada

Joe Clay | Aug 23, 2019

I was working on some other ideas for this week's After Effects tutorial, and I wasn't really getting anywhere. So I took some time to do other things and just take a break. Wednesday morning, I was rowing and while I row, I watch videos on YouTube. Great Big Story just published an excellent documentary series on Cicada 3301, so I was watching the last two episodes and I thought their graphic treatment was interesting.

I've been a fan of Cicada 3301 and puzzles like that in general. When I was a lot younger, I discovered notpron and spent a while going through it. I never finished it because I didn't have the time, though I should probably go back to it. But ciphers, steganography, etc. have always been really intriguing to me.

So, combining that with my love of Albert Omoss' work on the FITC Tokyo 2015 titles I quickly thought of a way to build a stupidly simple L-system-ish expression to make generative lines. We randomly choose directions and lengths, and draw points at 90 degree angles. So we end up with interesting paths, almost like a 2D version of the old pipes screensaver!

Taking those paths and combining them with shape modifiers we can make all sorts of things—lines, boxes, paths for movement, etc. You could even take these and use other modifiers like twist to get really odd looks and movement. This technique renders pretty quickly too. Our example is a little slow, but it has camera blurs, grading, and more so keep that in mind!

Have fun experimenting with this. I'm sure there's a lot more that can be done with this if you take the time to explore! Tweet us @workbench_tv if you make anything with this! And grab the Cicada drawing from aniszewskas here if you want to use it.

Expression Code

Make sure to add all of the slider controls necessary and rename them. We need Random Seed, Steps, Max Length, Stroke, Offset, and Completion sliders. The expression below should be applied to a path in a shape layer. Stroke, Offset, and Completion sliders are basically just pickwhipped to Stroke Width, an Offset modifier, and the End property of a Trim Paths modifier.

s = thisComp.layer("Controller").effect("Random Seed")("Slider");
n = thisComp.layer("Controller").effect("Steps")("Slider");
l = thisComp.layer("Controller").effect("Max Length")("Slider");

seedRandom(s, true);
var pts = [];
var x = y = 0;
pts.push([x,y]);

for(i = 0; i < n; i++) {
    var d = Math.floor(random(l));
    var r = Math.floor(random(4));
    switch(r) {
        case 0:
            x += d;
            break;
        case 1:
            y += d;
            break;
        case 2:
            x -= d;
            break;
        case 3:
            y -= d;
            break;
    }
    pts.push([x,y]);
}

createPath(pts, [], [], false);

Grab the Project Files

The best way to get our project files is to become a patron on Patreon. For $5 a month, you get access to all of the tutorial project files we've made available as well as other monthly projects, rigs, R&D, elements, early product previews, and BTS content not available anywhere else! You can also purchase just this project file on our Gumroad Store if you would rather do that.

Get access to all of our project files on Patreon or Get this single project file on Gumroad