springy expression

Moderators: Disciple, zlovatt

stubbs
Posts: 1
Joined: June 17th, 2010, 7:04 am

Hi!

This is a really great expression.
Now, I am trying to build a character rig with this expression and the puppet tool.

so I have this "leader" layer and this "head" layer.
The "head" layer has the said (below) expression so it follows the "leader" and creates a dynamic motion.
But of course the "head" is locked by the expression, so i can not animate it independently.

All I need is the same behavior as if I would use parenting: the "head" follows the "leader"'s motion but can also be animated to the character can move its head.

also i want to have more layers follow the "leader" layer but not generate a delay within eachother, only a delay to the "leader" layer. BUT i want to controll their springyness individually, so simple parenting wont do.
I tried to change the expression so it does not get this "stack delay" but i had no clue...

any ideas in how to change the expression to do said above things ?

cheers
Neil

Code: Select all

P = thisComp.layer("leader").position; 

delay = 0.8; // link to a slider for easy tweaking 
de = delay*thisComp.frameDuration*(index-thisComp.layer("leader").index); 

F = thisComp.layer(index-1).position.valueAtTime(time-de); 

xyz = position.valueAtTime(0) - thisComp.layer(index-1).position.valueAtTime(0); 

n = 0; 
if (P.numKeys > 0){ 
n = P.nearestKey(time).index; 
if (P.key(n).time > time){ 
n--; 
} 
} 
if (n == 0){ 
t = 0; 
}else{ 
t = time - P.key(n).time; 
} 

if (n > 0){ 
v = P.velocityAtTime(P.key(n).time - thisComp.frameDuration/10); 
amp = 0.05; // link to a slider for easy tweaking 
freq = 2; // link to a slider for easy tweaking 
decay = 2; // link to a slider for easy tweaking 
F + v*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t) + xyz; 
}else{ 
F + xyz; 
}
Post Reply