Activity › Forums › Adobe After Effects Expressions › Expressions help!
-
Expressions help!
Posted by Stephen Reber on September 8, 2008 at 7:06 pmHey guys,
I’m just starting to get into more complicated expressions… well, more complicated than the “wiggle” expression anyway.
I need some help creating an expression that would make an object desaturate as it gets farther from the camera.
Thanks in advance…
Stephen =]
Dan Ebberts replied 17 years, 8 months ago 2 Members · 4 Replies -
4 Replies
-
Dan Ebberts
September 8, 2008 at 7:54 pmThis would be for the Saturation parameter of the Color Balance (HLS) effect:
near = 800; // distance to begin desaturation
far = 2500; //distance for complete desaturation
C = thisComp.activeCamera;
d = length(C.toWorld([0,0,0]), toWorld(anchorPoint));
ease(d,near,far,value,-100)Dan
-
Stephen Reber
September 13, 2008 at 8:50 pmDan…
Thanks for the help!
I actually have another question. I was looking to wiggle a scale value in one direction, and I found you expression on your site. But I am trying to figure out why what I was doing before didn’t work…
This didn’t work…
rs = seedRandom(1,1);
r = random(1,100);
w = wiggle(1,40);x = scale[0] + (rs,r)+ (w) ;
y = scale[1]+ (rs,r);[x,y];
I can’t figure out why, because adding the “(rs,r)” worked, how come + (w) won’t.
Then I tried…
rs = seedRandom(1,1);
r = random(1,100);
w = wiggle(1,40);x = scale[0] + (rs,r) ;
y = scale[1]+ (rs,r);y + w;
[x,y];
Thought that would work too, but no.
Adding your expression finally worked…
rs = seedRandom(1,1);
r = random(1,100);
w = wiggle(1,40);x = scale[0] + (rs,r) ;
y = scale[1]+ (rs,r);[value[0],w[1]];
Why??
Thanks again for your help Dan, or anyone else who want to chime in.
-
Stephen Reber
September 13, 2008 at 8:55 pm… just noticed that the wiggle expression shuts off my random expression. How do I fix that?
-
Dan Ebberts
September 13, 2008 at 9:56 pmSo what is it that you’re trying to do exactly? Did you want to wiggle just the x scale value, but also add the same random value to both x and y?
That would look like this:
w = wiggle(2,50);
seedRandom(1,true);
r = random(1,100);
[w[0],value[1]] +[r,r]A few observations about your expression:
You don’t need to plug your seed random call into a variable. This is all you need to do:
seedRandom(1,true)
The result of wiggle() includes the value of the property you apply it to, so you don’t want to add value[1] and w[1] (which is effectively what you did) or you’ll get double the value you’re after.
This statement doesn’t do anything useful because the value is not saved and it’s not the last statement executed:
y + w;
I’m not sure what your intention was with the + (rs,r), but again – there’s no reason to save the result of seedRandom() and even less reason to use it later. 🙂
Keep swinging away though, it’ll make more sense as you go along.
Dan
Reply to this Discussion! Login or Sign Up