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.
Frustrating Expressions error
Matthew
mixturefilms.com
mixturefilms.com
- lloydalvarez
- Enhancement master
- Posts: 460
- Joined: June 17th, 2004, 9:27 am
- Location: New York City, NY
- Contact:
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:
-Lloyd
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, 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.
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.
Matthew
mixturefilms.com
mixturefilms.com
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
Matthew,
Sorry - I missed this earlier. Something like this should work:
Note that I substitued values for your sliders to test, but you should be able to switch back.
Dan
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
Works beautifully! Dan you are the man!
Thank you so much! I still have a lot to learn about expressions....
Thank you so much! I still have a lot to learn about expressions....
Matthew
mixturefilms.com
mixturefilms.com
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.
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.
Matthew
mixturefilms.com
mixturefilms.com
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
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:
Dan
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
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
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.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.
Paul
-
- Posts: 320
- Joined: June 26th, 2004, 10:01 am
- Location: Folsom, CA
- Contact:
Ah, that makes perfect sense. Thanks Paul.
Dan
Dan
Dan
Thank you for posting the update. Works great even when rendering.
Thank you everyone for their contribution.
Thank you for posting the update. Works great even when rendering.
Thank you everyone for their contribution.
Matthew
mixturefilms.com
mixturefilms.com