|03 March 2003||#1|
Join Date: Dec 2002
math function to fade var in Expression?
I have a variable in an expression and wish to fade
the value to 0 across whatever time. - is there an elegant math funtion to do this..
struggling with what should be a simple thing.
|03 March 2003||#2|
Join Date: Mar 2002
Hi, the linstep function can do that.
Variable.number = 5 - (linstep(0, 60, frame) * 5);
That will decrease the number 5 down to the number 0 over 60 frames.
Linstep ramps a number from 0 to 1 over a specified time, like this:
Variable.number = linstep("starting time", "ending time", "what the time is")
So Variable.number = linstep(0, 5, time)
Will ramp from 0 to 1 over 0 to 5 seconds.
~ Jared Martin
Maya, 3Delight, mentalray, Maxwell Render, ZBrush
Photoshop, Fusion, Vegas Pro, Syntheyes
|04 April 2003||#4|
Freelance 3d Animator/Motion Graphics Designer
Join Date: Nov 2002
You could also make a new variable, and make it equal to "old_variable/currentFrame". That way, as the animation played on, the new variable would continue to get samller.
You might have to multiply the currentFrame by something o get the starting psotion what you want.
I know this is a really rough solution, but it should work.
|04 April 2003||#5|
Join Date: Mar 2003
I like to use ramps. ramps are much friendlier than the linstep and smoothstep.
Take opacityPP on a particle for example. (I am assume we are talking about particles as this is the dynamics thread, but hey I can be wrong)
This is what I do.
create a PP attr named initOpacityPP
example.initOpacityPP = rand (.3,.7);
then i would add the allready built in scalar opacity attr
then i would make another attr on the particleShape node called
opacityMult I would then assign a ramp to that.
then for the opacityPP attr i would write.
example.opacityPP = initOpacity * opacity * opacityMult;
example.opacityPP = initOpacity * opacity * what ever the value of the bottom of the ramp used in opacityMult;
that way you get nice control over your falloff.
of course I use linstep and smoothstep from time to time but I like the ease of ramps.
|01 January 2006||#7|
Join Date: Sep 2003
Thread automatically closed
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
|Thread Closed share thread|