Page 1 of 1

Frustrating Expressions error

Posted: July 10th, 2008, 10:54 am
by mtals4
Hey everyone first time posting here, but have been reading a lot of the other posts. Great information!

I cobbled/hacked together the following code from a tutorial I found on Dan's site about random motion.

The idea with this expression was to have a couple of 3D layers randomly float in the x and y axis, while allowing the Z axis to remain constant where I set it.

segMin & segMax control the length of time before change in vector.
minVal & maxVal control the range of motion.

I am using five floating layers and a controller null with sliders. The floating layers are children of the null controller.

When I RAM preview, scrub the playhead all the layers work great. Except when I place the comp in the render queue and start the render process I get the following error. And the floating layers don't float.

'After Effects warning: logged 9 errors, please check log. First error was 'warnings: Class 'Layer' has no property or method named 'start' Expression disabled.
Error occurred at line 23.
Comp: 'Blue Bars white bckgrnd'
Layer: 11 ('panel 36')
Property: 'Position'

Here is the code in the position property.
segMin = thisComp.layer("Panel Controller-1").effect("Seg Min Control")("Slider") //minimum segment duration
segMax = thisComp.layer("Panel Controller-1").effect("Seg Max Control")("Slider"); //maximum segment duration
minVal = thisComp.layer("Panel Controller-1").effect("Min Value Modifier")("Slider");
maxVal = thisComp.layer("Panel Controller-1").effect("Max Value Modifier")("Slider");

end = 0;
j = 0;
while ( time >= end){
j += 1;
seedRandom(j,true);
start = end;
end += random(segMin,segMax);
}
endVal = random(minVal,maxVal);
seedRandom(j-1,true);
dummy=random(); //this is a throw-away value
startVal = random(minVal,maxVal);

x = position[0];
y = position[1];
z = position[2];

linear(time,start,end,[x,startVal,z],[x,endVal,z])

I thank you in advance for any guidance on this issue.

Re: Frustrating Expressions error

Posted: July 10th, 2008, 12:15 pm
by lloydalvarez
Hard to say based on the info you provided why that expression is not working, but if you just want the layer to move randomly in x,y here's a much simpler way to do that:

Code: Select all

floatSpeed = 15;  //speed in fps of the float movement
a= 50; // amount to float

w=wiggle(floatSpeed,a);
[w[0],w[1],value[2]]
-Lloyd

Re: Frustrating Expressions error

Posted: July 14th, 2008, 8:39 am
by mtals4
lloyd, thanks for the help.

The code you provided worked great. The only issue I have is the movement generated is more of an 'easy ease' movement. The original code made the movement more linear, that is what I was trying for ... But sometimes time or lack it ruins everything.

Re: Frustrating Expressions error

Posted: July 14th, 2008, 2:09 pm
by Dan Ebberts
Matthew,

Sorry - I missed this earlier. Something like this should work:

Code: Select all

segMin = .5; //thisComp.layer("Panel Controller-1").effect("Seg Min Control")("Slider") //minimum segment duration
segMax = 1.0; //thisComp.layer("Panel Controller-1").effect("Seg Max Control")("Slider"); //maximum segment duration
minVal = -400; //thisComp.layer("Panel Controller-1").effect("Min Value Modifier")("Slider");
maxVal = 400; //thisComp.layer("Panel Controller-1").effect("Max Value Modifier")("Slider");

end = 0;
j = 0;
while ( time >= end){
j += 1;
seedRandom(j,true);
strt = end;
end += random(segMin,segMax);
}
endVal = random([minVal,minVal],[maxVal,maxVal]);
seedRandom(j-1,true);
dummy=random(); //this is a throw-away value
startVal = random([minVal,minVal],[maxVal,maxVal]);

xy = linear(time,strt,end,startVal,endVal)
value + [xy[0],xy[1],0]

Note that I substitued values for your sliders to test, but you should be able to switch back.

Dan

Re: Frustrating Expressions error

Posted: July 14th, 2008, 5:15 pm
by mtals4
Works beautifully! Dan you are the man!

Thank you so much! I still have a lot to learn about expressions....

Re: Frustrating Expressions error

Posted: July 15th, 2008, 2:53 pm
by mtals4
Dan,

I spoke a little too soon, I still think you are the man...

But, I cannot get this to work when I start a render in the queue. Even before I attach my sliders...

I posted a project that won't render, it contains the layer arrangement I am working with.
Again it all works during a RAM preview just not during a "real render".

The project can be downloaded here.
http://mixturefilms.com/clients/aehelp/.

Thank you in advance for any help you can provide.

Re: Frustrating Expressions error

Posted: July 15th, 2008, 7:06 pm
by Dan Ebberts
Hmm... that's strange. It looks like the expression is evaluating at a time before zero for some reason, which would leave the strt variable undefined. Try this slight variation:

Code: Select all

segMin = .5; //thisComp.layer("Panel Controller-1").effect("Seg Min Control")("Slider") //minimum segment duration
segMax = 1.0; //thisComp.layer("Panel Controller-1").effect("Seg Max Control")("Slider"); //maximum segment duration
minVal = -400; //thisComp.layer("Panel Controller-1").effect("Min Value Modifier")("Slider");
maxVal = 400; //thisComp.layer("Panel Controller-1").effect("Max Value Modifier")("Slider");

end = 0;
strt = 0;
j = 0;
while ( time >= end){
  j += 1;
  seedRandom(j,true);
  strt = end;
  end += random(segMin,segMax);
}
endVal = random([minVal,minVal],[maxVal,maxVal]);
seedRandom(j-1,true);
dummy=random(); //this is a throw-away value
startVal = random([minVal,minVal],[maxVal,maxVal]);

xy = linear(time,strt,end,startVal,endVal)
value + [xy[0],xy[1],0]

Dan

Re: Frustrating Expressions error

Posted: July 15th, 2008, 11:52 pm
by Paul Tuersley
Dan Ebberts wrote:Hmm... that's strange. It looks like the expression is evaluating at a time before zero for some reason, which would leave the strt variable undefined.
I believe the error is caused by motion blur. AE CS3 has a new default shutter angle of -90, so motion blur is centred around a keyframe rather than only blurring forwards in time. So to calculate motion blur on the first frame, it needs to evaluate the expression at a time before zero.

Paul

Re: Frustrating Expressions error

Posted: July 16th, 2008, 6:06 am
by Dan Ebberts
Ah, that makes perfect sense. Thanks Paul.

Dan

Re: Frustrating Expressions error

Posted: July 16th, 2008, 12:44 pm
by mtals4
Dan

Thank you for posting the update. Works great even when rendering.

Thank you everyone for their contribution.