Vex smooth() function how to use it

   361   3   2
User Avatar
Member
975 posts
Joined: April 2008
Offline
I am trying to get a easy in/out interpolation on a ramp curve using the smooth() function but I was not able to get it right.
I know the output would supposed to be between 0 and 1 so I tried:

smooth(0,15,fit(@Frame,1,30,0,15)) * 15

I was trying to get a easy in/out between frames 1-30 where I have a linear ramp of values between 0-15 but it is not working this way everything goes to 0, what am I doing wrong?

Thanks!
Edited by mzigaib - Nov. 9, 2024 09:11:52
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
2126 posts
Joined: Sept. 2015
Offline
https://www.sidefx.com/docs/houdini/vex/functions/smooth.html [www.sidefx.com]

Computes a number between zero and one. Returns 0 if the amount passed in is less than or equal to value1, 1 if the amount is greater than or equal to value2.

I'm wondering if you need to assign the result of your fit function first before referencing the 'return' of the fit funtion.
Or cast the return of fit as a float(within the Smooth)?

Without the cast of fit, is the smooth function treating the return of the fit function as an integer (rounded down to zero)?

Sometimes vex functions don't play well with other embedded functions as arguments.
Edited by BabaJ - Nov. 9, 2024 16:09:39
User Avatar
Member
975 posts
Joined: April 2008
Offline
Thanks for the feedback
I am trying to use it on a channel as a expression, if I use the fit() function it works so I was assuming that it could work with the smooth function too, so maybe I can't use it on a channel as a expression?
https://vimeo.com/user2163076 [vimeo.com]
User Avatar
Member
975 posts
Joined: April 2008
Offline
Oh it did work with expression function smooth()and not with the VEX function.

Like this

smooth(fit(@Frame,1001,1024,0,15),0,15)
Edited by mzigaib - Nov. 9, 2024 18:26:35
https://vimeo.com/user2163076 [vimeo.com]
  • Quick Links