View Full Version : 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-23-2003, 03:12 AM
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.
You diamond .... I had been fiddling with this function
but was not sure if it was the way to go
I`ll see if it will accomplish what I need to do
... will renew my efforts
Cheers 4 now
04-07-2003, 09:29 PM
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-09-2003, 12:07 AM
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.
Hi , Thanks
I`ll give this a try... sounds interesting anyway..
I `m quite into this ramp thing myself...
01-14-2006, 06:00 PM
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.
vBulletin v3.0.5, Copyright ©2000-2015, Jelsoft Enterprises Ltd.