ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Reveal Text using ease(), inPoint, outPoint

COW Forums : Adobe After Effects Expressions

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Jake Nelson-Dooley
Reveal Text using ease(), inPoint, outPoint
on Oct 19, 2018 at 1:46:25 pm

Hi expression folks,

I'm trying to create a preset that reveals and hides lines of text - trying to approximate the manual masking effect, or "shape reveal" text effect you see frequently.

Using a combination of Fast Box Blur, Curves, and CCcomposite (creates a box to use as an alpha), plus two different Transform effects (moving the text in and out of the alpha box) I was able to get a single text layer that reveals and hides itself based on the In and Out points... However, when saved as a preset and applied in a new Comp, it does not work anymore.

I must've made a mistake. If anyone can help me spot it, I'd really appreciate it!

p.s. if there's an existing preset for this, that's good too ☺



//##########First Transform Effect#################

//need the height of the text layer
var x = sourceRectAtTime();
//adding a few extra points padding
x_distance = x.height+3

//set duration equal to slider
durationIn = effect("durationIn")("Slider");
durationOut = effect("durationOut")("Slider");

if(time&lt;(inPoint+outPoint)/2)
//using easeOut with duration to slide the layer up
easeOut(time,inPoint,inPoint+durationIn,[this.position[0],this.position[1]-x_distance],[this.position[0],this.position[1]]);

else
easeIn(time, outPoint-durationOut, outPoint, [this.position[0],this.position[1]],[this.position[0],this.position[1]+x_distance]);

//##########Second Transform Effect#################
var x = sourceRectAtTime();

x_distance = x.height+3

//set duration equal to slider
durationIn = effect("durationIn")("Slider");
durationOut = effect("durationOut")("Slider");

if(time&lt;(inPoint+outPoint)/2)
easeOut(time,inPoint,inPoint+durationIn,[this.position[0],this.position[1]+x_distance],[this.position[0],this.position[1]]);

else
easeIn(time, outPoint-durationOut, outPoint, [this.position[0],this.position[1]],[this.position[0],this.position[1]-x_distance]);


Return to posts index

Filip Vandueren
Re: Reveal Text using ease(), inPoint, outPoint
on Oct 20, 2018 at 10:45:56 pm

If I understand your desired effect correctly (a simple Wipe down ?)
I would do it with two linear Wipes like this:

Wipe In efect: Wipe Angle = 0°, expression for Transition Completeness:


sr = thisLayer.sourceRectAtTime();

// get all cornerPoints, the layer could be rotated, so we need to check every corner for top/btoom status
TL=toComp([sr.left, sr.top]);
TR=toComp([sr.left+sr.width, sr.top]);
BL=toComp([sr.left, sr.top+sr.height]);
BR=toComp([sr.left+sr.width, sr.top+sr.height]);
textTop = Math.min(TL[1],TR[1],BL[1],BR[1]);
textBottom = Math.max(TL[1],TR[1],BL[1],BR[1]);

min= 100*textTop/thisComp.height;
max=100*textBottom/thisComp.height;

t1=inPoint;
t2=inPoint+effect("durationIN")("Slider").value;

100 - ease(time,t1,t2,min,max); // the WipeIn angle is 0° and works kinda backwards


WipeOut: Wipe Angle = 180° and expression for Transition completeness=

sr = thisLayer.sourceRectAtTime();

// get all cornerPoints, the layer could be rotated, so we need to check every corner for top/btoom status
TL=toComp([sr.left, sr.top]);
TR=toComp([sr.left+sr.width, sr.top]);
BL=toComp([sr.left, sr.top+sr.height]);
BR=toComp([sr.left+sr.width, sr.top+sr.height]);
textTop = Math.min(TL[1],TR[1],BL[1],BR[1]);
textBottom = Math.max(TL[1],TR[1],BL[1],BR[1]);

min= 100*textTop/thisComp.height;
max=100*textBottom/thisComp.height;

t1=outPoint - effect("durationOUT")("Slider").value;
t2=outPoint;

ease(time,t1,t2,min,max);


I used ease(), but you can use linear, easeIn() etc.



Return to posts index

Jake Nelson-Dooley
Re: Reveal Text using ease(), inPoint, outPoint
on Oct 22, 2018 at 12:25:36 pm

Thanks Filip, your code helped me get this working!\

If anyone wants to know, the mistake I made originally was to use this.position inside of the transform effect:
easeOut(time,inPoint,inPoint+durationIn,[this.position[0],this.position[1]-x_distance],[this.position[0],this.position[1]]);

I realize now the transform effect position values are constant at [960,540] for a 1080p composition.

Besides that, Filip's linear wipe approach is better than the "alpha box" I had before. I just added a transform effect to his code so the text slides up and down while it's being revealed.

Cheers!


Return to posts index

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