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 CLOSED
 
Thread Tools Search this Thread Display Modes
Old 03 March 2003   #1
math function to fade var in Expression?

Hi,

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.


Cheers
 
Old 03 March 2003   #2
Hi, the linstep function can do that.

Example:

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
 
Old 03 March 2003   #3
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
 
Old 04 April 2003   #4
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.
 
Old 04 April 2003   #5
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.
//runtime

example.opacityPP = initOpacity * opacity * opacityMult;


//creation

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.
 
Old 04 April 2003   #6
Hi , Thanks

I`ll give this a try... sounds interesting anyway..
I `m quite into this ramp thing myself...
Cheers
 
Old 01 January 2006   #7
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.
 
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
CGSociety
Society of Digital Artists
www.cgsociety.org

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

All times are GMT. The time now is 09:05 PM.


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