how to use linear() as expression

   6528   4   1
User Avatar
Member
4 posts
Joined: Aug. 2010
Offline
this probably isn't that too difficult of a question, but try as hard as i might i can't find how to properly use it. i've looked in the documentation for all the different versions, but none of them say what parameters are needed.

thanks.
User Avatar
Member
1908 posts
Joined: Nov. 2006
Offline
The linear expression is intended only for use with channel keyframes and can't be used as a regular expression. What exactly are you attempting to achieve? Linear blending between two values?

If that's what you are going for you can get the same results to some animation curves using some expressions. Attached is an example of using expressions to animate some nulls with either linear() or cubic() interpolation.

Attachments:
expression_anim_curves.hip (54.1 KB)

Graham Thompson, Technical Artist @ Rockstar Games
User Avatar
Member
4 posts
Joined: Aug. 2010
Offline
i don't think that's what i want then.

basically i want to animate something from y=5 to y=0 over a specific time like 5 frames using an expression that i can use in an if() expression. i have a lot of objects that i don't want to manually keyframe and i want to create a cascading effect where they fall in place. if you could point me in the right direction that would be great.
User Avatar
Member
201 posts
Joined: July 2005
Offline
You could try the fit expression. Something like this is the y channel:
fit($F,1,5,0,5)
which will move the object in y from 0 to 5 during frames 1-5.

If you have several objects that do the same motion but delayed in time, you could place in their y channels an expression like chf(“/obj/foo”, $F-3) … /obj/foo is the node you put the fit expression on. In this example, the y motion is delayed by 3 frames.

HTH
Cheers,
Rob
Digital Supervisor | Stargate Studios Toronto
User Avatar
Staff
2540 posts
Joined: July 2005
Offline
Attributes are always used when proceduralizing this sort of thing.

Use the Smooth() expression which does an ease between the end points.

Say you have a custom point/prim attribute called float “fall” that varies from 4 to 0. You could do:

smooth($FALL, 4, 0)

smooth() returns 0 to 1 so wrap around a fit01() expression for control:

fit01(smooth($FALL, 4, 0))
There's at least one school like the old school!
  • Quick Links