math function to fade var in Expression?

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

Thread Tools Display Modes
  03 March 2003
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
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.

Get it?
~ Jared Martin

Maya, 3Delight, mentalray, Maxwell Render, ZBrush
Photoshop, Fusion, Vegas Pro, Syntheyes
  03 March 2003
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
Thanx alot

Cheers 4 now
  04 April 2003
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
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.
  04 April 2003
Hi , Thanks

I`ll give this a try... sounds interesting anyway..
I `m quite into this ramp thing myself...
  01 January 2006
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.
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
Thread Closed share thread

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Society of Digital Artists

Powered by vBulletin
Copyright 2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump

All times are GMT. The time now is 06:10 PM.

Powered by vBulletin
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.