soft - don't set variables, lerp them

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
User avatar
Ulydev
Party member
Posts: 439
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

soft - don't set variables, lerp them

Post by Ulydev » Wed Jul 20, 2016 10:36 pm

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

User avatar
Kingdaro
Party member
Posts: 395
Joined: Sun Jul 18, 2010 3:08 am

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

Post by Kingdaro » Thu Jul 21, 2016 12:05 am

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.

User avatar
Ulydev
Party member
Posts: 439
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

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

Post by Ulydev » Thu Jul 21, 2016 2:09 am

Kingdaro wrote:Personally, I'd change the soft:set boolean param
Done, thanks for the suggestion! :nyu:

ObeyJay
Prole
Posts: 4
Joined: Thu Apr 23, 2015 6:22 pm

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

Post by ObeyJay » Tue Aug 02, 2016 8:31 am

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?

User avatar
Ulydev
Party member
Posts: 439
Joined: Mon Nov 10, 2014 10:46 pm
Location: Paris
Contact:

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

Post by Ulydev » Sat Aug 06, 2016 5:38 am

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.

Post Reply

Who is online

Users browsing this forum: No registered users and 5 guests