Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Converting Linear Wipe to layer space

• Converting Linear Wipe to layer space

Posted by on September 13, 2023 at 1:34 pm

Hey folks!

Just wanted to share an expression that converts the Linear Wipe’s Transition Completion percentages to layer space for continuously rasterized layers like shapes & text.

Transition Completion:

```const { left: l, width: w, top: t, height: h } = sourceRectAtTime();

const rectToPercent = (x, y) => [toComp([x, y])[0] / width * 100, toComp([x, y])[1] / height * 100];

const [left, top] = rectToPercent(l - 1, t - 1);
const [right, bottom] = rectToPercent(l + w + 1, t + h + 1);

const directions = {
0: [100 - bottom, 100 - top],
90: [left, right],
180: [top, bottom],
270: [100 - right, 100 - left],
};

const angle = Math.abs(effect("Linear Wipe")("Wipe Angle") + 360) % 360;
const [wipeStart, wipeEnd] = directions[angle];

linear(value, 0, 100, wipeStart, wipeEnd);```

Angle:

`(Math.round(value / 90) * 90) % 360;`

For now, I snapped the angles to increments of 90° because I haven’t figured out how to interpolate between the corners yet. But for anyone satisfied with wiping left, right, up, or down – this does the trick.

Alternatively, I made a preset that lets you wipe in & out using a single instance of the Linear Wipe effect and a single slider going from -100 to 100% (0% being center).