I was messing with the code that gerge had posted to create a spring between objects:
// AE expression by George Polevoy
// http://www.creativecow.net
// attaches an object to a “Controller” object with a “spring”
// You need another “Controller” which will drive animation of this one
// parameters
conserveMotion = 0.95; // valid range: 0.5 to 0.995
springResistance = 10; // positive values
prerollTime = 2; // value in seconds. greater values give more precise result
//
fps = 1.0 / this_comp.frame_duration;
if ( prerollTime > time ) prerollTime = time;
dt = this_comp.frame_duration;
frame = time * fps;
integrationTime = time – prerollTime;
s = [0,0];
p = this_comp.layer(“Controller”).position.value_at_time( integrationTime );
i = frame – prerollTime * fps;
for (; i < frame; i++, integrationTime += dt )
{
c = this_comp.layer("Controller").position.value_at_time( integrationTime );
d = c - p;
s = s + d * springResistance;
s = s * conserveMotion;
p = p + s * dt;
}
p;
When I do it I keep getting the warning "expression must be of dimension 2, not 1.
Anyone know what Im doing wrong?
Josh
Activity