-
Expressions question
I asked this question below, but it was kind of buried at the end of a question so I didnt get any response.
I was messing with the code that George Polevoy had posted to create a spring between objects(see below).
When I use it I keep getting the warning “expression must be of dimension 2, not 1.
I realize this is because it is only getting input for the x parameter and it is looking for the x,y but I can’t tell by looking at the code where the parameter is being declared.
Can any one help??
// AE expression by George Polevoy
// 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; Josh