fredag den 22. november 2019

Dimensions of a text or layer

The expression allows you to calculate the dimensions of the text or any other layer.
Can be useful for creating a substrate that will automatically change size,
depending on the width of the text.

title = thisComp.layer("Text Layer") ; // Layer
indW = 10; // Spacing width
indH = 10; // Spacing  height
rect = title.sourceRectAtTime(time,false);
x = rect.width+indW;
y = rect.height+indH;
[x,y]

Type on text with blinking cursor

The expression creates a typing animation with a blinking cursor. 
Applies to the Source Text parameter of the text layer. 


 
Speed = 10; // Speed typing
Blink = 2; // The speed of blinking cursor
CursorType = "|" // Type of the cursor. This is usually a vertical line "|" or the bottom dash "_"

F = Math.round(time*Blink % 1);
L = text.sourceText.length;
T = (time - thisLayer.inPoint)*Speed;
if(F ==1 | (T0) ){Fl=CursorType;}else{Fl="";}
substr(0,T) + Fl

Loop wiggle 2

With this expression by Dan Ebberts, you can loop a shake animation for a given duration.



freq = 1; // Frequency
amp = 110; // Amplitude
loopTime = 3; // Cycle time (in seconds)
t = time % loopTime;
wiggle1 = wiggle(freq, amp, 1, 0.5, t);
wiggle2 = wiggle(freq, amp, 1, 0.5, t - loopTime);
linear(t, 0, loopTime, wiggle1, wiggle2)

Rebound bounce

With this expression, you can create a rebound effect of the object from the floor. Allows you to animate almost any parameter.


e = .3; // Bouncing
g = 1; // Gravity
nMax = 10; // Maximum bounces

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time) n--;
}
if (n > 0){
t = time - key(n).time;
v = -velocityAtTime(key(n).time - .001)*e;
vl = length(v);
if (value instanceof Array){
vu = (vl > 0) ? normalize(v) : [0,0,0];
}else{
vu = (v < 0) ? -1 : 1;
}
tCur = 0;
segDur = 2*vl/(g*1000);
tNext = segDur;
nb = 1; // number of bounces
while (tNext < t && nb <= nMax){
vl *= e;
segDur *= e;
tCur = tNext;
tNext += segDur;
nb++
}
if(nb <= nMax){
delta = t - tCur;
value +  vu*delta*(vl - (g*1000)*delta/2);
}else{
value
}
}else
value

Damping - Bounce

One of the most popular expressions for After Effects. It allows animate virtually any parameter with a damping effect.


amp = .04;// The higher the value, the greater the amplitude
freq = 2;// The higher the value, the higher the frequency
decay = 5;// The higher the value, the smaller the delay

n = 0;
if (numKeys > 0){
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0){
t = 0;
}else{
t = time - key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
value + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

tirsdag den 14. juni 2016

New Camera Orientation expression

//Put Expression in Orintation

L = thisComp.layer("Camera 1"); 
u = fromWorldVec(L.toWorldVec([1,0,0])); 
v = fromWorldVec(L.toWorldVec([0,1,0])); 
w = normalize(fromWorldVec(L.toWorldVec([0,0,1])));

sinb = clamp(w[0],-1,1);
b = Math.asin(sinb);
cosb = Math.cos(b); 
if (Math.abs(cosb) > .0005){
 c = -Math.atan2(v[0],u[0]); 
 a = -Math.atan2(w[1],w[2]); 
}else{
 a = (sinb < 0 ? -1 : 1)*Math.atan2(u[1],v[1]); c = 0; 
}
[radiansToDegrees(a),radiansToDegrees(b),radiansToDegrees(c)]


// by on creativecow Sep 8, 2012 at 2:54:19 am

torsdag den 10. september 2015

Delay from parent

//Redgiant.com
// Harry Frank

(was put in the Position Expresion)

delay=0.2;
parent.fromWorld(toWorld([0,0,0],time-delay));
AE POSTWORK blog is virtually just a notepad, where I put all the AE expressions up I finde and use, its so I can easily get to them wherever I am and no matter what computer I sit at. I do not write my own expressions, so all expressions on the page is downloaded from the web,or modify versions i found. and tutorials etc.. I will try to credit those who have made expressions if I can.

Now, with tips and tricks for AE & C4D.
No more forgetting the little tricks and tips I found on my road with After Effects, etc.

Sebabba