Page 1 of 1

soft - don't set variables, lerp them

Posted: Wed Jul 20, 2016 10:36 pm
by Ulydev
Hey there, lövers!

Here's another minimalist library, soft.

By replacing

Code: Select all

variable = value
to

Code: Select all

variable:to(value)
it takes care of lerping the values, giving a smoother look to your games.

https://github.com/Ulydev/soft

Re: soft - don't set variables, lerp them

Posted: Thu Jul 21, 2016 12:05 am
by Kingdaro
Nice, beat me to it :P

Personally, I'd change the soft:set boolean param to the string 'reset'. This makes it a lot clearer what the function's doing with the second parameter from the outset, and allows the addition of other parameters if you like.

Re: soft - don't set variables, lerp them

Posted: Thu Jul 21, 2016 2:09 am
by Ulydev
Kingdaro wrote:Personally, I'd change the soft:set boolean param
Done, thanks for the suggestion! :nyu:

Re: soft - don't set variables, lerp them

Posted: Tue Aug 02, 2016 8:31 am
by ObeyJay
This looks great.
But what if I need to change the value :by() a given amount? (ie, relative to the current value instead of absolute)
Do you think it's worth implementing it?

Re: soft - don't set variables, lerp them

Posted: Sat Aug 06, 2016 5:38 am
by Ulydev
ObeyJay wrote:This looks great.
But what if I need to change the value :by() a given amount? (ie, relative to the current value instead of absolute)
Do you think it's worth implementing it?

Code: Select all

var:to( var:get(true) + x) 
Sure, I'll consider adding a shortcut.