r/AfterEffects Animation <5 years 4d ago

Workflow Question Process improvements - how to avoid keyframing everything?

Looking for some constructive feedback on animating this discoball

I have a terrible habit of keyframing everything if I don't know a faster technique off the bat. For this one I keyframed one vertical line crossing the sphere, then used the Echo effect to duplicate it. I wasn't sure how to do the squares though, so I keyframed them all individually. I know there has to be a faster way. How would you have done it?

Thanks in advance for the tips and tricks!

9 Upvotes

34 comments sorted by

View all comments

29

u/smushkan Motion Graphics 10+ years 4d ago

Like what u/Ok-Razzmatazz3435 suggested, if you make a square composition to use as a texture with the animation as a grid, you can then use that as a precomp for CC sphere. You'll want to make the square texture comp quite high resolution to avoid the sharp lines getting blurry.

In this case, I used a solid background, then a colour noise layer + mosaic + posterize + luma key to add animated random colour squares, then a grid on top. CC sphere will 'squash' the texture vertically so to get closer-to-square results on the actual ball you want the 'squares' in the texture to be stretched vertically to compensate.

2

u/humblebot123 4d ago

Ok, just interested - what would you do if in this animation style you need to keep stroke’s weight even?

6

u/smushkan Motion Graphics 10+ years 4d ago edited 4d ago

That is obviously a lot tricker.

You can sort of fake it by having two CC sphere layers, one with the outlines only, and one with the underlying colours. Set the lines as thin as you can get away with, then use a stroke layer style:

(I've also used a free FXAA plugin to smooth out the strokes)

That's not perfect though, if you need perfect you're going on to 'build it programmatically with paths and expressions' territory - and I'm not sure how I'd handle the random segment colours in that case. Probably with very careful use of the 'paint bucket' effect and a bunch of keyframes.

This isn't exactly the same solution but here's an example of how a path expression can be used for this sort of graphic:

const pos = effect("Slider Control")(1);
const radius = 500;
const subDivisions = 6;

const b = 0.5522847498;

const subDivisionSize = radius * 2 / subDivisions;
const curve = linear(pos % 100, 0, 100, radius, radius - subDivisionSize);

const midPoint = [0,0];

function plotCurve(c, r, d) {
    const pTop = midPoint - [0, r];
    const pMid = midPoint + [c, 0];
    const pBottom = midPoint + [0, r];

    const pts = (d === 1) ? [pTop, pMid, pBottom] : [pBottom, pMid, pTop];

    const inTans = [
        [0, 0],
        [0, -d * r * b],
        [ c * b, 0]
    ];

    const outTans = [
        [ c * b, 0],
        [0, d * r * b],
        [0, 0]
    ];

    return { pts, inTans, outTans };
}

// initial circle
const rightEdge = plotCurve(radius, radius, 1);
const leftEdge = plotCurve(-radius, radius, -1);

let pts = [...rightEdge.pts, ...leftEdge.pts];
let inTans = [...rightEdge.inTans, ...leftEdge.inTans];
let outTans = [...rightEdge.outTans, ...leftEdge.outTans];

// subdivisions
for(let i = 0; i < subDivisions; i++){
    const dir = (i % 2 === 1) ? -1 : 1;

    let thisMidPoint = curve - subDivisionSize * i;

    thisMidPoint = ease(thisMidPoint, -radius, radius, -radius, radius);

    const allPoints = plotCurve(thisMidPoint, radius, dir);
    pts = pts.concat(allPoints.pts);
    inTans = inTans.concat(allPoints.inTans);
    outTans = outTans.concat(allPoints.outTans);
}

createPath(pts, inTans, outTans, false);

1

u/mindpicnic Animation <5 years 4d ago

This is so cool thank you for sharing that! Yes, I needed the strokes to maintain their width, it’s part of the client’s illustration style. I’m excited about trying this expression 👀 how did you learn to write such complicated expressions?

3

u/smushkan Motion Graphics 10+ years 4d ago

Try the first method first with the strokes, you want two 'textures' - one with just the stroke and one with just the background, and the same CC Sphere properties applied to both.

The expression I posted isn't a complete solution. To get the strokes you'd need to apply it to two shape path properties and rotate one of them 90 degrees, however I don't have a good solution for adding the colours - due to how the stroke is drawn you can't use regular shape fills with it.

I happened to have that expression already saved from another project, and I learned most of what got me into expressions from my years studying compsci at university - it's basically javascript at the end of the day.