ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Tricking linear wipe to use a vector image's actual size instead of the frame.

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Justin Maloney
Tricking linear wipe to use a vector image's actual size instead of the frame.
on Dec 5, 2018 at 7:12:37 pm

Hey there, I'm making a template for a client that uses alot of text layers. They like this effect for animating them on using linear wipe but because text are vectors in AE the wipe starts at the side of the frame and it throws them off. They're quite new to Motion Graphics so I'm trying to make this as easy as possible for them and keep pre-comps to a minimum.

I'm posting this in the Expressions sub-forum since I figure an answer would lie there. Is there a way to use the image itself to influence the completion rate?

Thanks in advance!

PS: I'm using an expression on the wipe effect already to animate it based on inPoint and outPoint, similar to "fade - frames" behavior.

AnimateInTime = thisComp.frameDuration * effect("Animate In+Out - frames")("Fade In Duration (frames)");
AnimateOutTime = thisComp.frameDuration * effect("Animate In+Out - frames")("Fade Out Duration (frames)");

AnimateInCompletion = linear(time, inPoint, inPoint+AnimateInTime+0.001, 0, 100);
AnimateOutCompletion = linear(time, outPoint-AnimateOutTime-0.001, outPoint, 100, 0);

X = (AnimateInCompletion * AnimateOutCompletion) / 100;

linear(X, 0, 100, 100, 0);



Return to posts index

Kalleheikki Kannisto
Re: Tricking linear wipe to use a vector image's actual size instead of the frame.
on Dec 9, 2018 at 10:26:54 am

Sounds like a sourceRectAtTime() matter. If it is a linear horizontal wipe, you would need to know the left and right edges of the text block --which you can get with sourceRectAtTime() -- and adjust the completion settings 0-100 so that the range gets mapped to the area of the text block. What you need is the left and right edges as a percentage of the screen width. If you're going from left to right, the screen left edge is 0 and the right edge is 100. The left edge of the text layer is X1 (percent) and the right edge is X2 (percent). You need to remap the completion 0 to 100 to this X1 to X2 range with the linear() expression.

Kalleheikki Kannisto
Senior Graphic Designer


Return to posts index

Justin Maloney
Re: Tricking linear wipe to use a vector image's actual size instead of the frame.
on Jan 16, 2019 at 8:40:52 pm

Hey dude, thanks for the reply!

I was trying to use sourceRectAtTime().left to find the left most edge of the text layer but I can't tell if its even returning the correct value. I tried sending that value to the source text so that I could see it but the value never changes when I move or otherwise modify the layer.

Am I using sourceRectAtTime().left wrong?

W = (sourceRectAtTime().width /1920)*100; /// the width of the object ///
L = (sourceRectAtTime().left /1920)*100; /// distance to left side ///
R = (W + L); /// distance to right side ///


AnimateInTime = thisComp.frameDuration * effect("Animate In+Out - frames")("Fade In Duration (frames)");
AnimateOutTime = thisComp.frameDuration * effect("Animate In+Out - frames")("Fade Out Duration (frames)");

AnimateInCompletion = linear(time, inPoint, inPoint+AnimateInTime+0.001, 0, 100);
AnimateOutCompletion = linear(time, outPoint-AnimateOutTime-0.001, outPoint, 100, 0);

C = (AnimateInCompletion * AnimateOutCompletion) / 100;

linear(C, 0, 100, 100, 0);



Return to posts index


Jan Hofmeister
Re: Tricking linear wipe to use a vector image's actual size instead of the frame.
on Apr 4, 2019 at 12:58:50 pm

I have come up with this expression to do it (just paste it in the linear wipe percentage). For now this only works for a left to right wipe (-90° angle), so some of the calculations need to be flipped to work in the other direction. The buffer variable is just used to wipe away an extra pixel on both ends, because sometimes a column of subpixels stays visible on either side of the text layer.

I guess it would be very hard to adapt this to arbitrary wipe angles, but changing sourceRectAtTime().left to sourceRectAtTime().top and sourceRectAtTime().width to sourceRectAtTime().height should at least allow for vertical wipes.

buffer = 1;
x_start = thisLayer.position[0] + sourceRectAtTime().left - buffer;
x_end = thisLayer.position[0] + sourceRectAtTime().left + sourceRectAtTime().width + buffer;
c_w = thisComp.width;

100-linear(value, 0, 100, ((x_start/c_w))*100, ((x_end/c_w))*100)


Return to posts index

Jan Hofmeister
Re: Tricking linear wipe to use a vector image's actual size instead of the frame.
on Apr 4, 2019 at 1:02:28 pm

I can't see a way to edit my post, so just a little addition: I missed the fact that you already have an expression in the wipe value. But I guess this can somehow be combined by replacing all my value statements in the expression with some variable that's referring to what your already existing expression spits out.


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2019 CreativeCOW.net All Rights Reserved
[TOP]